Skip to content

Commit

Permalink
Fix #663
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 27, 2021
1 parent ce8bd73 commit b789bf2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
1 change: 1 addition & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ JSON library.
#456: Add `JsonParser.readAsValue(ResolvedType)`
#492: Ensure primitive type names in error message enclosed in backticks
#551: Remove `JsonGenerator.setPrettyPrinter()` from 3.0
#663: Rename `JsonEOFException` as `UnexpectedEndOfInputException`
#670: Replace references to "field" in `JsonGenerator`, `JsonParser` method names with "property"
#671: Replace `getCurrentLocation()`/`getTokenLocation()` with
`currentLocation()`/`currentTokenLocation()`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.core.exc.InputCoercionException;
import com.fasterxml.jackson.core.exc.UnexpectedEndOfInputException;
import com.fasterxml.jackson.core.exc.StreamReadException;
import com.fasterxml.jackson.core.exc.WrappedIOException;
import com.fasterxml.jackson.core.io.JsonEOFException;
import com.fasterxml.jackson.core.io.NumberInput;
import com.fasterxml.jackson.core.sym.PropertyNameMatcher;
import com.fasterxml.jackson.core.type.ResolvedType;
Expand Down Expand Up @@ -896,7 +896,7 @@ protected void _reportInvalidEOFInValue(JsonToken type) throws StreamReadExcepti
}

protected void _reportInvalidEOF(String msg, JsonToken currToken) throws StreamReadException {
throw new JsonEOFException(this, currToken, "Unexpected end-of-input"+msg);
throw new UnexpectedEndOfInputException(this, currToken, "Unexpected end-of-input"+msg);
}

protected void _reportMissingRootWS(int ch) throws StreamReadException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package com.fasterxml.jackson.core.io;
package com.fasterxml.jackson.core.exc;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.core.exc.StreamReadException;

/**
* Specialized {@link StreamReadException} that is thrown when end-of-input
* is reached unexpectedly, either within token being decoded, or during
* skipping of intervening white-space that is not between root-level
* tokens (that is, is within JSON Object or JSON Array construct).
* is reached unexpectedly, usually within token being decoded, but possibly
* within intervening non-token content (for formats that have that, such
* as whitespace for textual formats)
*/
public class JsonEOFException
public class UnexpectedEndOfInputException
extends StreamReadException
{
private static final long serialVersionUID = 3L;
Expand All @@ -21,7 +20,7 @@ public class JsonEOFException
*/
protected final JsonToken _token;

public JsonEOFException(JsonParser p, JsonToken token, String msg) {
public UnexpectedEndOfInputException(JsonParser p, JsonToken token, String msg) {
super(p, msg);
_token = token;
}
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/com/fasterxml/jackson/core/TestExceptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import java.io.StringWriter;

import com.fasterxml.jackson.core.exc.UnexpectedEndOfInputException;
import com.fasterxml.jackson.core.exc.StreamReadException;
import com.fasterxml.jackson.core.exc.StreamWriteException;
import com.fasterxml.jackson.core.io.JsonEOFException;
import com.fasterxml.jackson.core.json.JsonFactory;

public class TestExceptions extends BaseTest
Expand Down Expand Up @@ -79,7 +79,7 @@ private void _testEofExceptions(int mode) throws Exception
try {
p.nextToken();
fail("Should get exception");
} catch (JsonEOFException e) {
} catch (UnexpectedEndOfInputException e) {
verifyException(e, "close marker for Array");
}
p.close();
Expand All @@ -92,7 +92,7 @@ private void _testEofExceptions(int mode) throws Exception
try {
p.nextToken();
fail("Should get exception");
} catch (JsonEOFException e) {
} catch (UnexpectedEndOfInputException e) {
verifyException(e, "close marker for Object");
}
p.close();
Expand All @@ -102,7 +102,7 @@ private void _testEofExceptions(int mode) throws Exception
try {
p.nextToken();
fail("Should get exception");
} catch (JsonEOFException e) {
} catch (UnexpectedEndOfInputException e) {

verifyException(e, "in property name");
assertEquals(JsonToken.PROPERTY_NAME, e.getTokenBeingDecoded());
Expand All @@ -114,7 +114,7 @@ private void _testEofExceptions(int mode) throws Exception
try {
p.nextToken();
fail("Should get exception");
} catch (JsonEOFException e) {
} catch (UnexpectedEndOfInputException e) {
verifyException(e, "unexpected end-of-input");
verifyException(e, "Object entries");
}
Expand Down

0 comments on commit b789bf2

Please sign in to comment.