Skip to content

Commit 1ea3b5f

Browse files
authored
Improve error handling of TokenBuffer wrt malformed input (EOF handling) (#4260)
1 parent c0e8361 commit 1ea3b5f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/com/fasterxml/jackson/databind/util/TokenBuffer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import com.fasterxml.jackson.core.*;
99
import com.fasterxml.jackson.core.base.ParserMinimalBase;
10+
import com.fasterxml.jackson.core.io.JsonEOFException;
1011
import com.fasterxml.jackson.core.io.NumberInput;
1112
import com.fasterxml.jackson.core.json.JsonWriteContext;
1213
import com.fasterxml.jackson.core.util.ByteArrayBuilder;
@@ -1161,7 +1162,8 @@ public void copyCurrentStructure(JsonParser p) throws IOException
11611162
t = p.nextToken();
11621163
// fall-through to copy the associated value
11631164
} else if (t == null) {
1164-
throw new IllegalStateException("No token available from argument `JsonParser`");
1165+
// 13-Dec-2024, tatu: For some unexpected EOF cases we may end up here, so:
1166+
throw new JsonEOFException(p, null, "Unexpected end-of-input");
11651167
}
11661168

11671169
// We'll do minor handling here to separate structured, scalar values,

0 commit comments

Comments
 (0)