Skip to content

Commit

Permalink
Fixing the contract of nextToken to be compliant with com.fasterxml.j…
Browse files Browse the repository at this point in the history
…ackson.core.JsonParser.nextToken() and not throw an EOFException if at the end of the stream
  • Loading branch information
kutchar committed Mar 13, 2015
1 parent a788b01 commit 44be495
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Expand Up @@ -118,6 +118,10 @@ public JsonToken nextToken() throws IOException, JsonParseException {
}
}

if (!messageUnpacker.hasNext()) {
return null;
}

MessageFormat nextFormat = messageUnpacker.getNextFormat();
ValueType valueType = nextFormat.getValueType();

Expand Down
Expand Up @@ -19,6 +19,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNull;

public class MessagePackParserTest extends MessagePackDataformatTestBase {
@Test
Expand Down Expand Up @@ -309,13 +310,8 @@ public void testMessagePackParserDirectly() throws IOException {
assertEquals(-1, parser.getCurrentLocation().getLineNr());
assertEquals(16, parser.getCurrentLocation().getColumnNr());

try {
parser.nextToken();
assertTrue(false);
}
catch (EOFException e) {
// Expected
}
assertNull(parser.nextToken());

parser.close();
parser.close(); // Intentional
}
Expand Down

0 comments on commit 44be495

Please sign in to comment.