Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions buildSrc/version.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ lucene = 7.1.0-snapshot-f33ed4ba12a
# optional dependencies
spatial4j = 0.6
jts = 1.13
jackson = 2.8.6
snakeyaml = 1.15
jackson = 2.8.10
snakeyaml = 1.17
# when updating log4j, please update also docs/java-api/index.asciidoc
log4j = 2.9.1
slf4j = 1.6.2
Expand Down
1 change: 1 addition & 0 deletions client/sniffer/licenses/jackson-core-2.8.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eb21a035c66ad307e66ec8fce37f5d50fd62d039
1 change: 0 additions & 1 deletion client/sniffer/licenses/jackson-core-2.8.6.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions core/licenses/jackson-core-2.8.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eb21a035c66ad307e66ec8fce37f5d50fd62d039
1 change: 0 additions & 1 deletion core/licenses/jackson-core-2.8.6.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions core/licenses/jackson-dataformat-cbor-2.8.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1c58cc9313ddf19f0900cd61ed044874278ce320
1 change: 0 additions & 1 deletion core/licenses/jackson-dataformat-cbor-2.8.6.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions core/licenses/jackson-dataformat-smile-2.8.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e853081fadaad3e98ed801937acc3d8f77580686
1 change: 0 additions & 1 deletion core/licenses/jackson-dataformat-smile-2.8.6.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions core/licenses/jackson-dataformat-yaml-2.8.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1e08caf1d787c825307d8cc6362452086020d853
1 change: 0 additions & 1 deletion core/licenses/jackson-dataformat-yaml-2.8.6.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion core/licenses/snakeyaml-1.15.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions core/licenses/snakeyaml-1.17.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7a27ea250c5130b2922b86dea63cbb1cc10a660c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class FastStringReader extends Reader implements CharSequence {
private int length;
private int next = 0;
private int mark = 0;
private boolean closed = false;

/**
* Creates a new string reader.
Expand All @@ -49,8 +50,9 @@ public FastStringReader(String s) {
* Check to make sure that the stream has not been closed
*/
private void ensureOpen() throws IOException {
if (length == -1)
if (closed) {
throw new IOException("Stream closed");
}
}

@Override
Expand Down Expand Up @@ -196,7 +198,7 @@ public void reset() throws IOException {
*/
@Override
public void close() {
length = -1;
closed = true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,48 @@

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 {
assertThat(readList("{\"foo\": [\"bar\"]}"), contains("bar"));
assertThat(readList("{\"foo\": [\"bar\",\"baz\"]}"), contains("bar", "baz"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public static Tuple<List<Object>, List<Object>> randomStoredFieldValues(Random r
//with CBOR we get back a float
expectedParsedValues.add(randomFloat);
} 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());
} else {
//with JSON AND YAML we get back a double, but with float precision.
Expand Down