Skip to content
Commits on Source (5)
jackson-core (2.10.1-1) unstable; urgency=medium
[ Mechtilde ]
* [63928b7] New upstream version 2.10.1
* [4ef437a] Updated debian/control
* [d389c02] Apply patches newly
-- Mechtilde Stehmann <mechtilde@debian.org> Mon, 23 Dec 2019 21:04:45 +0100
jackson-core (2.10.0-1) unstable; urgency=medium
[ Mechtilde ]
......
......@@ -3,13 +3,11 @@ Section: java
Priority: optional
Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
Uploaders:
Wolodja Wentland <debian@babilen5.org>
, Mechtilde Stehmann <mechtilde@debian.org>
Build-Depends:
debhelper-compat (= 12),
default-jdk,
maven-debian-helper (>= 1.6.5),
xmlstarlet
Mechtilde Stehmann <mechtilde@debian.org>
Build-Depends: debhelper-compat (= 12)
, default-jdk
, maven-debian-helper (>= 1.6.5)
, xmlstarlet
Build-Depends-Indep:
default-jdk-doc
, junit4
......@@ -17,7 +15,7 @@ Build-Depends-Indep:
, libmaven-enforcer-plugin-java
, libmaven-javadoc-plugin-java
, libreplacer-java
Standards-Version: 4.4.0
Standards-Version: 4.4.1
Rules-Requires-Root: no
Vcs-Git: https://salsa.debian.org/java-team/jackson-core.git
Vcs-Browser: https://salsa.debian.org/java-team/jackson-core
......
Description: packaging no bundle
Forwarded: No
Author: Mechtilde Stehmann <mechtilde@debian.org>
Last-Update: 2019-09-28
Author: "Mechtilde Stehmann" <"mechtilde@debian.org">
Last-Update: 2019-12-23
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
<artifactId>jackson-core</artifactId>
<name>Jackson-core</name>
<version>2.10.0</version>
<version>2.10.1</version>
- <packaging>bundle</packaging>
+ <packaging>jar</packaging>
<description>Core Jackson processing abstractions (aka Streaming API), implementation for JSON</description>
......
Description: deactivate code coverage
Forwarded: No
Author: Mechtilde Stehmann <mechtilde@debian.org>
Last-Update: 2019-09-28
Author: "Mechtilde Stehmann" <"mechtilde@debian.org">
Last-Update: 2019-12-23
--- a/pom.xml
+++ b/pom.xml
@@ -57,7 +57,7 @@
......@@ -9,7 +9,7 @@ Last-Update: 2019-09-28
<!-- 26-Aug-2019, tatu: JaCoCo for code coverage -->
- <plugin>
+ <!-- <plugin>
+ <!-- <plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.4</version>
......
no-bundle.patch
skip-jacoco.patch
01-no-bundle.patch
02-skip-jacoco.patch
......@@ -3,13 +3,13 @@
<parent>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-base</artifactId>
<version>2.10.0</version>
<version>2.10.1</version>
</parent>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<name>Jackson-core</name>
<version>2.10.0</version>
<version>2.10.1</version>
<packaging>bundle</packaging>
<description>Core Jackson processing abstractions (aka Streaming API), implementation for JSON</description>
<inceptionYear>2008</inceptionYear>
......@@ -19,7 +19,7 @@
<connection>scm:git:git@github.com:FasterXML/jackson-core.git</connection>
<developerConnection>scm:git:git@github.com:FasterXML/jackson-core.git</developerConnection>
<url>http://github.com/FasterXML/jackson-core</url>
<tag>jackson-core-2.10.0</tag>
<tag>jackson-core-2.10.1</tag>
</scm>
<properties>
......
......@@ -116,9 +116,12 @@ Arnaud Roger (arnaudroger@github)
* Contributed #359: FilteringGeneratorDelegate does not override writeStartObject(Object forValue)
(2.8.8)
Wil Selwood (wselwood@github)
Emily Selwood (emilyselwood@github)
* Reported #382: ArrayIndexOutOfBoundsException from UTF32Reader.read on invalid input
(2.8.9)
* Reported #578: Array index out of bounds in hex lookup
(2.10.1)
Alex Yursha (AlexYursha@github)
* Contributed #312: Add `JsonProcessingException.clearLocation()` to allow clearing
......@@ -193,3 +196,7 @@ Fabien Renaud (fabienrenaud@github)
* Reported, contributed fix fir #533: UTF-8 BOM not accounted for in
`JsonLocation.getByteOffset()`
(2.10.0)
Todd O'Bryan (toddobryan@github)
* Contributed fix fox #455: Jackson reports wrong locations for JsonEOFException
(2.10.1)
......@@ -14,6 +14,15 @@ JSON library.
=== Releases ===
------------------------------------------------------------------------
2.10.1 (09-Nov-2019)
#455: Jackson reports wrong locations for JsonEOFException
(reported by wastevenson@github, fix contributed by Todd O'B
#567: Add `uses` for `ObjectCodec` in module-info
(reported by Marc M)
#578: Array index out of bounds in hex lookup
(reported by Emily S)
2.10.0 (26-Sep-2019)
#433: Add Builder pattern for creating configured Stream factories
......
......@@ -906,7 +906,7 @@ public abstract class JsonGenerator
throw new IllegalArgumentException("null array");
}
_verifyOffsets(array.length, offset, length);
writeStartArray();
writeStartArray(array, length);
for (int i = offset, end = offset+length; i < end; ++i) {
writeNumber(array[i]);
}
......@@ -930,7 +930,7 @@ public abstract class JsonGenerator
throw new IllegalArgumentException("null array");
}
_verifyOffsets(array.length, offset, length);
writeStartArray();
writeStartArray(array, length);
for (int i = offset, end = offset+length; i < end; ++i) {
writeNumber(array[i]);
}
......@@ -954,7 +954,7 @@ public abstract class JsonGenerator
throw new IllegalArgumentException("null array");
}
_verifyOffsets(array.length, offset, length);
writeStartArray();
writeStartArray(array, length);
for (int i = offset, end = offset+length; i < end; ++i) {
writeNumber(array[i]);
}
......
......@@ -174,11 +174,13 @@ public final class CharTypes
}
/**
* Lookup table for the first 128 Unicode characters (7-bit ASCII)
* Lookup table for the first 256 Unicode characters (ASCII / UTF-8)
* range. For actual hex digits, contains corresponding value;
* for others -1.
*<p>
* NOTE: before 2.10.1, was of size 128, extended for simpler handling
*/
private final static int[] sHexValues = new int[128];
private final static int[] sHexValues = new int[256];
static {
Arrays.fill(sHexValues, -1);
for (int i = 0; i < 10; ++i) {
......@@ -223,7 +225,9 @@ public final class CharTypes
public static int charToHex(int ch)
{
return (ch > 127) ? -1 : sHexValues[ch];
// 08-Nov-2019, tatu: As per [core#540] and [core#578], changed to
// force masking here so caller need not do that.
return sHexValues[ch & 0xFF];
}
public static void appendQuoted(StringBuilder sb, String content)
......
......@@ -48,7 +48,6 @@ public enum JsonReadFeature
* of single quotes (apostrophe, character '\'') for
* quoting Strings (names and String values). If so,
* this is in addition to other acceptable markers.
* but not by JSON specification).
*<p>
* Since JSON specification requires use of double quotes for
* field names,
......
......@@ -67,12 +67,6 @@ public enum JsonWriteFeature
* if format uses escaping mechanisms (which is generally true
* for textual formats but not for binary formats).
*<p>
* Note that this setting may not necessarily make sense for all
* data formats (for example, binary formats typically do not use
* any escaping mechanisms; and some textual formats do not have
* general-purpose escaping); if so, settings is simply ignored.
* Put another way, effects of this feature are data-format specific.
*<p>
* Feature is disabled by default.
*/
@SuppressWarnings("deprecation")
......
......@@ -246,19 +246,20 @@ public class ReaderBasedJsonParser // final in 2.3, earlier
{
final int bufSize = _inputEnd;
_currInputProcessed += bufSize;
_currInputRowStart -= bufSize;
// 26-Nov-2015, tatu: Since name-offset requires it too, must offset
// this increase to avoid "moving" name-offset, resulting most likely
// in negative value, which is fine as combine value remains unchanged.
_nameStartOffset -= bufSize;
if (_reader != null) {
int count = _reader.read(_inputBuffer, 0, _inputBuffer.length);
if (count > 0) {
_inputPtr = 0;
_inputEnd = count;
_currInputProcessed += bufSize;
_currInputRowStart -= bufSize;
// 26-Nov-2015, tatu: Since name-offset requires it too, must offset
// this increase to avoid "moving" name-offset, resulting most likely
// in negative value, which is fine as combine value remains unchanged.
_nameStartOffset -= bufSize;
return true;
}
// End of input
......
......@@ -211,15 +211,6 @@ public class UTF8StreamJsonParser
protected final boolean _loadMore() throws IOException
{
final int bufSize = _inputEnd;
_currInputProcessed += _inputEnd;
_currInputRowStart -= _inputEnd;
// 26-Nov-2015, tatu: Since name-offset requires it too, must offset
// this increase to avoid "moving" name-offset, resulting most likely
// in negative value, which is fine as combine value remains unchanged.
_nameStartOffset -= bufSize;
if (_inputStream != null) {
int space = _inputBuffer.length;
if (space == 0) { // only occurs when we've been closed
......@@ -230,6 +221,15 @@ public class UTF8StreamJsonParser
if (count > 0) {
_inputPtr = 0;
_inputEnd = count;
_currInputProcessed += _inputEnd;
_currInputRowStart -= _inputEnd;
// 26-Nov-2015, tatu: Since name-offset requires it too, must offset
// this increase to avoid "moving" name-offset, resulting most likely
// in negative value, which is fine as combine value remains unchanged.
_nameStartOffset -= bufSize;
return true;
}
// End of input
......@@ -3281,10 +3281,10 @@ public class UTF8StreamJsonParser
_reportInvalidEOF(" in character escape sequence", JsonToken.VALUE_STRING);
}
}
int ch = _inputBuffer[_inputPtr++] & 0xFF;
int ch = _inputBuffer[_inputPtr++];
int digit = CharTypes.charToHex(ch);
if (digit < 0) {
_reportUnexpectedChar(ch, "expected a hex-digit for character escape sequence");
_reportUnexpectedChar(ch & 0xFF, "expected a hex-digit for character escape sequence");
}
value = (value << 4) | digit;
}
......
......@@ -2352,7 +2352,7 @@ public class NonBlockingJsonParser
while (true) {
int digit = CharTypes.charToHex(c);
if (digit < 0) {
_reportUnexpectedChar(c, "expected a hex-digit for character escape sequence");
_reportUnexpectedChar(c & 0xFF, "expected a hex-digit for character escape sequence");
}
value = (value << 4) | digit;
if (++bytesRead == 4) {
......
......@@ -17,4 +17,7 @@ module com.fasterxml.jackson.core {
exports com.fasterxml.jackson.core.sym;
exports com.fasterxml.jackson.core.type;
exports com.fasterxml.jackson.core.util;
// 03-Oct-2019, tatu: [core#567] Add self-use to avoid warnings
uses com.fasterxml.jackson.core.ObjectCodec;
}
......@@ -20,4 +20,12 @@ public class TestCharTypes
assertEquals(expected, actual);
}
}
public void testHexOutOfRange()
{
final int[] inputs = {0, -1, 1, 129, -129};
for (int input : inputs) {
assertEquals(-1, CharTypes.charToHex(input));
}
}
}
package com.fasterxml.jackson.core.read;
import java.util.Arrays;
import java.util.List;
import com.fasterxml.jackson.core.BaseTest;
import com.fasterxml.jackson.core.JsonLocation;
import com.fasterxml.jackson.core.JsonParser;
/**
* Set of tests that checks getCurrentLocation() and getTokenLocation() are as expected during
* parsing.
*/
public class LocationDuringReaderParsingTest extends BaseTest
{
public void testLocationAtEndOfParse() throws Exception
{
for (LocationTestCase test : LocationTestCase.values()) {
//System.out.println(test.name());
testLocationAtEndOfParse(test);
}
}
public void testInitialLocation() throws Exception
{
for (LocationTestCase test : LocationTestCase.values()) {
//System.out.println(test.name());
testInitialLocation(test);
}
}
public void testTokenLocations() throws Exception
{
for (LocationTestCase test : LocationTestCase.values()) {
//System.out.println(test.name());
testTokenLocations(test);
}
}
private void testLocationAtEndOfParse(LocationTestCase test) throws Exception
{
JsonParser p = createParserUsingReader(test.json);
while (p.nextToken() != null) {
p.nextToken();
}
assertCurrentLocation(p, test.getFinalLocation());
p.close();
}
private void testInitialLocation(LocationTestCase test) throws Exception
{
JsonParser p = createParserUsingReader(test.json);
JsonLocation loc = p.getCurrentLocation();
p.close();
assertLocation(loc, at(1, 1, 0));
}
private void testTokenLocations(LocationTestCase test) throws Exception
{
JsonParser p = createParserUsingReader(test.json);
int i = 0;
while (p.nextToken() != null) {
assertTokenLocation(p, test.locations.get(i));
i++;
}
assertEquals(test.locations.size(), i + 1); // last LocData is end of stream
p.close();
}
private void assertCurrentLocation(JsonParser p, LocData loc)
{
assertLocation(p.getCurrentLocation(), loc);
}
private void assertTokenLocation(JsonParser p, LocData loc)
{
assertLocation(p.getTokenLocation(), loc);
}
private void assertLocation(JsonLocation pLoc, LocData loc)
{
String expected = String.format("(%d, %d, %d)",
loc.lineNumber, loc.columnNumber, loc.offset);
String actual = String.format("(%d, %d, %d)", pLoc.getLineNr(), pLoc.getColumnNr(),
pLoc.getByteOffset() == -1 ? pLoc.getCharOffset() : pLoc.getByteOffset());
assertEquals(expected, actual);
}
private static class LocData
{
private long lineNumber;
private long columnNumber;
private long offset;
LocData(long lineNumber, long columnNumber, long offset)
{
this.lineNumber = lineNumber;
this.columnNumber = columnNumber;
this.offset = offset;
}
}
private static LocData at(long lineNumber, long columnNumber, long offset)
{
return new LocData(lineNumber, columnNumber, offset);
}
/**
* Adapted liberally from https://github.com/leadpony/jsonp-test-suite, also
* released under the Apache License v2.
*/
enum LocationTestCase
{
SIMPLE_VALUE("42", at(1, 1, 0), at(1, 3, 2)),
SIMPLE_VALUE_WITH_PADDING(" 1337 ", at(1, 4, 3), at(1, 10, 9)),
SIMPLE_VALUE_WITH_MULTIBYTE_CHARS("\"Правда\"",
at(1, 1, 0),
at(1, 9, 8)
),
SIMPLE_VALUE_INCLUDING_SURROGATE_PAIR_CHARS("\"a П \uD83D\uDE01\"",
at(1, 1, 0),
at(1, 9, 8) // reader counts surrogate pairs as two chars
),
ARRAY_IN_ONE_LINE("[\"hello\",42,true]",
at(1, 1, 0), // [
at(1, 2, 1), // "hello"
at(1, 10, 9), // 42
at(1, 13, 12), // true
at(1, 17, 16), // ]
at(1, 18, 17) // end of input
),
ARRAY_IN_ONE_LINE_WITH_PADDING(" [ \"hello\" , 42 , true ] ",
at(1, 3, 2), // [
at(1, 5, 4), // "hello"
at(1, 17, 16), // 42
at(1, 26, 25), // true
at(1, 33, 32), // ]
at(1, 37, 36) // end of input
),
ARRAY_IN_MULTIPLE_LINES("[\n" + " \"hello\",\n" + " 42,\n" + " true\n" + "]",
at(1, 1, 0), // [
at(2, 5, 6), // "hello"
at(3, 5, 19), // 42
at(4, 5, 27), // true
at(5, 1, 32), // ]
at(5, 2, 33) // end of input
),
ARRAY_IN_MULTIPLE_LINES_WITH_WEIRD_SPACING(" [\n" + " \"hello\" , \n" + " 42 ,\n" + " true\n" + " ]",
at(1, 2, 1), // [
at(2, 3, 5), // "hello"
at(3, 2, 18), // 42
at(4, 7, 31), // true
at(5, 2, 37), // ]
at(5, 3, 38) // end of input
),
ARRAY_IN_MULTIPLE_LINES_CRLF("[\r\n" + " \"hello\",\r\n" + " 42,\r\n" + " true\r\n" + "]",
at(1, 1, 0), // [
at(2, 5, 7), // "hello"
at(3, 5, 21), // 42
at(4, 5, 30), // true
at(5, 1, 36), // ]
at(5, 2, 37) // end of input
),
OBJECT_IN_ONE_LINE("{\"first\":\"hello\",\"second\":42}",
at(1, 1, 0), // {
at(1, 2, 1), // "first"
at(1, 10, 9), // "hello"
at(1, 18, 17), // "second"
at(1, 27, 26), // 42
at(1, 29, 28), // }
at(1, 30, 29) // end of input
),
OBJECT_IN_MULTIPLE_LINES("{\n" + " \"first\":\"hello\",\n" + " \"second\":42\n" + "}",
at(1, 1, 0), // {
at(2, 5, 6), // "first"
at(2, 13, 14), // "hello"
at(3, 5, 27), // "second"
at(3, 14, 36), // 42
at(4, 1, 39), // }
at(4, 2, 40) // end of input
),
OBJECT_IN_MULTIPLE_LINES_CRLF("{\r\n" + " \"first\":\"hello\",\r\n" + " \"second\":42\r\n" + "}",
at(1, 1, 0), // {
at(2, 5, 7), // "first"
at(2, 13, 15), // "hello"
at(3, 5, 29), // "second"
at(3, 14, 38), // 42
at(4, 1, 42), // }
at(4, 2, 43) // end of input
),
;
final String json;
final List<LocData> locations;
LocationTestCase(String json, LocData... locations)
{
this.json = json;
this.locations = Arrays.asList(locations);
}
LocData getFinalLocation()
{
return locations.get(locations.size() - 1);
}
}
}
package com.fasterxml.jackson.core.read;
import java.util.Arrays;
import java.util.List;
import com.fasterxml.jackson.core.BaseTest;
import com.fasterxml.jackson.core.JsonLocation;
import com.fasterxml.jackson.core.JsonParser;
/**
* Set of tests that checks getCurrentLocation() and getTokenLocation() are as expected during
* parsing.
*/
public class LocationDuringStreamParsingTest extends BaseTest
{
public void testLocationAtEndOfParse() throws Exception
{
for (LocationTestCase test : LocationTestCase.values()) {
//System.out.println(test.name());
testLocationAtEndOfParse(test);
}
}
public void testInitialLocation() throws Exception
{
for (LocationTestCase test : LocationTestCase.values()) {
//System.out.println(test.name());
testInitialLocation(test);
}
}
public void testTokenLocations() throws Exception
{
for (LocationTestCase test : LocationTestCase.values()) {
//System.out.println(test.name());
testTokenLocations(test);
}
}
private void testLocationAtEndOfParse(LocationTestCase test) throws Exception
{
JsonParser p = createParserUsingStream(test.json, "UTF8");
while (p.nextToken() != null) {
p.nextToken();
}
assertCurrentLocation(p, test.getFinalLocation());
p.close();
}
private void testInitialLocation(LocationTestCase test) throws Exception
{
JsonParser p = createParserUsingStream(test.json, "UTF8");
JsonLocation loc = p.getCurrentLocation();
p.close();
assertLocation(loc, at(1, 1, 0));
}
private void testTokenLocations(LocationTestCase test) throws Exception
{
JsonParser p = createParserUsingStream(test.json, "UTF8");
int i = 0;
while (p.nextToken() != null) {
assertTokenLocation(p, test.locations.get(i));
i++;
}
assertEquals(test.locations.size(), i + 1); // last LocData is end of stream
p.close();
}
private void assertCurrentLocation(JsonParser p, LocData loc)
{
assertLocation(p.getCurrentLocation(), loc);
}
private void assertTokenLocation(JsonParser p, LocData loc)
{
assertLocation(p.getTokenLocation(), loc);
}
private void assertLocation(JsonLocation pLoc, LocData loc)
{
String expected = String.format("(%d, %d, %d)",
loc.lineNumber, loc.columnNumber, loc.offset);
String actual = String.format("(%d, %d, %d)", pLoc.getLineNr(), pLoc.getColumnNr(),
pLoc.getByteOffset() == -1 ? pLoc.getCharOffset() : pLoc.getByteOffset());
assertEquals(expected, actual);
}
private static class LocData
{
private long lineNumber;
private long columnNumber;
private long offset;
LocData(long lineNumber, long columnNumber, long offset)
{
this.lineNumber = lineNumber;
this.columnNumber = columnNumber;
this.offset = offset;
}
}
private static LocData at(long lineNumber, long columnNumber, long offset)
{
return new LocData(lineNumber, columnNumber, offset);
}
/**
* Adapted liberally from https://github.com/leadpony/jsonp-test-suite, also
* released under the Apache License v2.
*/
enum LocationTestCase
{
SIMPLE_VALUE("42", at(1, 1, 0), at(1, 3, 2)),
SIMPLE_VALUE_WITH_PADDING(" 1337 ", at(1, 4, 3), at(1, 10, 9)),
SIMPLE_VALUE_WITH_MULTIBYTE_CHARS("\"Правда\"",
at(1, 1, 0),
at(1, 15, 14) // one byte for each ", two for each Cyrillic char
),
SIMPLE_VALUE_INCLUDING_SURROGATE_PAIR_CHARS("\"a П \uD83D\uDE01\"",
at(1, 1, 0),
at(1, 12, 11) // one byte for each ", a and space; two for П, four for smiley emoji
),
ARRAY_IN_ONE_LINE("[\"hello\",42,true]",
at(1, 1, 0), // [
at(1, 2, 1), // "hello"
at(1, 10, 9), // 42
at(1, 13, 12), // true
at(1, 17, 16), // ]
at(1, 18, 17) // end of input
),
ARRAY_IN_ONE_LINE_WITH_PADDING(" [ \"hello\" , 42 , true ] ",
at(1, 3, 2), // [
at(1, 5, 4), // "hello"
at(1, 17, 16), // 42
at(1, 26, 25), // true
at(1, 33, 32), // ]
at(1, 37, 36) // end of input
),
ARRAY_IN_MULTIPLE_LINES("[\n" + " \"hello\",\n" + " 42,\n" + " true\n" + "]",
at(1, 1, 0), // [
at(2, 5, 6), // "hello"
at(3, 5, 19), // 42
at(4, 5, 27), // true
at(5, 1, 32), // ]
at(5, 2, 33) // end of input
),
ARRAY_IN_MULTIPLE_LINES_WITH_WEIRD_SPACING(" [\n" + " \"hello\" , \n" + " 42 ,\n" + " true\n" + " ]",
at(1, 2, 1), // [
at(2, 3, 5), // "hello"
at(3, 2, 18), // 42
at(4, 7, 31), // true
at(5, 2, 37), // ]
at(5, 3, 38) // end of input
),
ARRAY_IN_MULTIPLE_LINES_CRLF("[\r\n" + " \"hello\",\r\n" + " 42,\r\n" + " true\r\n" + "]",
at(1, 1, 0), // [
at(2, 5, 7), // "hello"
at(3, 5, 21), // 42
at(4, 5, 30), // true
at(5, 1, 36), // ]
at(5, 2, 37) // end of input
),
OBJECT_IN_ONE_LINE("{\"first\":\"hello\",\"second\":42}",
at(1, 1, 0), // {
at(1, 2, 1), // "first"
at(1, 10, 9), // "hello"
at(1, 18, 17), // "second"
at(1, 27, 26), // 42
at(1, 29, 28), // }
at(1, 30, 29) // end of input
),
OBJECT_IN_MULTIPLE_LINES("{\n" + " \"first\":\"hello\",\n" + " \"second\":42\n" + "}",
at(1, 1, 0), // {
at(2, 5, 6), // "first"
at(2, 13, 14), // "hello"
at(3, 5, 27), // "second"
at(3, 14, 36), // 42
at(4, 1, 39), // }
at(4, 2, 40) // end of input
),
OBJECT_IN_MULTIPLE_LINES_CRLF("{\r\n" + " \"first\":\"hello\",\r\n" + " \"second\":42\r\n" + "}",
at(1, 1, 0), // {
at(2, 5, 7), // "first"
at(2, 13, 15), // "hello"
at(3, 5, 29), // "second"
at(3, 14, 38), // 42
at(4, 1, 42), // }
at(4, 2, 43) // end of input
),
;
final String json;
final List<LocData> locations;
LocationTestCase(String json, LocData... locations)
{
this.json = json;
this.locations = Arrays.asList(locations);
}
LocData getFinalLocation()
{
return locations.get(locations.size() - 1);
}
}
}
......@@ -35,8 +35,9 @@ public class ParserDupHandlingTest
public void testSimpleDupsBytes() throws Exception
{
JsonFactory nonDupF = new JsonFactory();
JsonFactory dupF = new JsonFactory();
dupF.enable(JsonParser.Feature.STRICT_DUPLICATE_DETECTION);
JsonFactory dupF = JsonFactory.builder()
.enable(StreamReadFeature.STRICT_DUPLICATE_DETECTION)
.build();
for (String doc : DUP_DOCS) {
// First, with static setting
_testSimpleDupsFail(doc, dupF, MODE_INPUT_STREAM, "a", false);
......@@ -51,8 +52,9 @@ public class ParserDupHandlingTest
public void testSimpleDupsDataInput() throws Exception
{
JsonFactory nonDupF = new JsonFactory();
JsonFactory dupF = new JsonFactory();
dupF.enable(JsonParser.Feature.STRICT_DUPLICATE_DETECTION);
JsonFactory dupF = JsonFactory.builder()
.enable(StreamReadFeature.STRICT_DUPLICATE_DETECTION)
.build();
for (String doc : DUP_DOCS) {
_testSimpleDupsFail(doc, dupF, MODE_DATA_INPUT, "a", false);
_testSimpleDupsFail(doc, nonDupF, MODE_DATA_INPUT, "a", true);
......