Upgrade to Jackson 2.8.10 (#27230)

While it's not possible to upgrade the Jackson dependencies 
to their latest versions yet (see #27032 (comment) for more) 
it's still possible to upgrade to the latest 2.8.x version.
This commit is contained in:
Tanguy Leroux 2017-11-06 10:20:05 +01:00 committed by GitHub
parent e440e23ad1
commit 43e7a4a349
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 55 additions and 11 deletions

View File

@ -5,8 +5,8 @@ lucene = 7.1.0
# optional dependencies # optional dependencies
spatial4j = 0.6 spatial4j = 0.6
jts = 1.13 jts = 1.13
jackson = 2.8.6 jackson = 2.8.10
snakeyaml = 1.15 snakeyaml = 1.17
# when updating log4j, please update also docs/java-api/index.asciidoc # when updating log4j, please update also docs/java-api/index.asciidoc
log4j = 2.9.1 log4j = 2.9.1
slf4j = 1.6.2 slf4j = 1.6.2

View File

@ -0,0 +1 @@
eb21a035c66ad307e66ec8fce37f5d50fd62d039

View File

@ -1 +0,0 @@
2ef7b1cc34de149600f5e75bc2d5bf40de894e60

View File

@ -0,0 +1 @@
eb21a035c66ad307e66ec8fce37f5d50fd62d039

View File

@ -1 +0,0 @@
2ef7b1cc34de149600f5e75bc2d5bf40de894e60

View File

@ -0,0 +1 @@
1c58cc9313ddf19f0900cd61ed044874278ce320

View File

@ -1 +0,0 @@
b88721371cfa2d7242bb5e52fe70861aa061c050

View File

@ -0,0 +1 @@
e853081fadaad3e98ed801937acc3d8f77580686

View File

@ -1 +0,0 @@
71590ad45cee21249774e2f93e5eca66e446cef3

View File

@ -0,0 +1 @@
1e08caf1d787c825307d8cc6362452086020d853

View File

@ -1 +0,0 @@
8bd44d50f9a6cdff9c7578ea39d524eb519e35ab

View File

@ -1 +0,0 @@
3b132bea69e8ee099f416044970997bde80f4ea6

View File

@ -0,0 +1 @@
7a27ea250c5130b2922b86dea63cbb1cc10a660c

View File

@ -34,6 +34,7 @@ public class FastStringReader extends Reader implements CharSequence {
private int length; private int length;
private int next = 0; private int next = 0;
private int mark = 0; private int mark = 0;
private boolean closed = false;
/** /**
* Creates a new string reader. * Creates a new string reader.
@ -49,9 +50,10 @@ public class FastStringReader extends Reader implements CharSequence {
* Check to make sure that the stream has not been closed * Check to make sure that the stream has not been closed
*/ */
private void ensureOpen() throws IOException { private void ensureOpen() throws IOException {
if (length == -1) if (closed) {
throw new IOException("Stream closed"); throw new IOException("Stream closed");
} }
}
@Override @Override
public int length() { public int length() {
@ -196,7 +198,7 @@ public class FastStringReader extends Reader implements CharSequence {
*/ */
@Override @Override
public void close() { public void close() {
length = -1; closed = true;
} }
@Override @Override

View File

@ -42,6 +42,48 @@ import static org.hamcrest.Matchers.nullValue;
public class XContentParserTests extends ESTestCase { public class XContentParserTests extends ESTestCase {
public void testFloat() throws IOException {
final XContentType xContentType = randomFrom(XContentType.values());
final String field = randomAlphaOfLengthBetween(1, 5);
final Float value = randomFloat();
try (XContentBuilder builder = XContentBuilder.builder(xContentType.xContent())) {
builder.startObject();
if (randomBoolean()) {
builder.field(field, value);
} else {
builder.field(field).value(value);
}
builder.endObject();
final Number number;
try (XContentParser parser = createParser(xContentType.xContent(), builder.bytes())) {
assertEquals(XContentParser.Token.START_OBJECT, parser.nextToken());
assertEquals(XContentParser.Token.FIELD_NAME, parser.nextToken());
assertEquals(field, parser.currentName());
assertEquals(XContentParser.Token.VALUE_NUMBER, parser.nextToken());
number = parser.numberValue();
assertEquals(XContentParser.Token.END_OBJECT, parser.nextToken());
assertNull(parser.nextToken());
}
assertEquals(value, number.floatValue(), 0.0f);
if (xContentType == XContentType.CBOR) {
// CBOR parses back a float
assertTrue(number instanceof Float);
} else {
// JSON, YAML and SMILE parses back the float value as a double
// This will change for SMILE in Jackson 2.9 where all binary based
// formats will return a float
assertTrue(number instanceof Double);
}
}
}
public void testReadList() throws IOException { public void testReadList() throws IOException {
assertThat(readList("{\"foo\": [\"bar\"]}"), contains("bar")); assertThat(readList("{\"foo\": [\"bar\"]}"), contains("bar"));
assertThat(readList("{\"foo\": [\"bar\",\"baz\"]}"), contains("bar", "baz")); assertThat(readList("{\"foo\": [\"bar\",\"baz\"]}"), contains("bar", "baz"));

View File

@ -108,7 +108,7 @@ public final class RandomObjects {
//with CBOR we get back a float //with CBOR we get back a float
expectedParsedValues.add(randomFloat); expectedParsedValues.add(randomFloat);
} else if (xContentType == XContentType.SMILE) { } else if (xContentType == XContentType.SMILE) {
//with SMILE we get back a double //with SMILE we get back a double (this will change in Jackson 2.9 where it will return a Float)
expectedParsedValues.add(randomFloat.doubleValue()); expectedParsedValues.add(randomFloat.doubleValue());
} else { } else {
//with JSON AND YAML we get back a double, but with float precision. //with JSON AND YAML we get back a double, but with float precision.