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.9.2
snakeyaml = 1.18
# when updating log4j, please update also docs/java-api/index.asciidoc
log4j = 2.9.1
slf4j = 1.6.2
Expand Down
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 client/sniffer/licenses/jackson-core-2.9.2.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aed20e50152a2f19adc1995c8d8f307c7efa414d
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-core-2.9.2.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aed20e50152a2f19adc1995c8d8f307c7efa414d
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-cbor-2.9.2.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9ad705ca14f5d1879dfffc3d94a521bf2f2e8ea7
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-smile-2.9.2.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a7cf50aff5bd96e3a0ba551a688bf402e2a594c3
1 change: 0 additions & 1 deletion core/licenses/jackson-dataformat-yaml-2.8.6.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions core/licenses/jackson-dataformat-yaml-2.9.2.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cafb9bafb3fc94ac18ed53043396f2c7bccd6c4f
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.18.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e4a441249ade301985cb8d009d4e4a72b85bf68e
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@

/**
* A character stream whose source is a string that is <b>not thread safe</b>
* <p>
* (shay.banon
* )
*/
public class FastStringReader extends Reader implements CharSequence {

private String str;
private int length;
private int next = 0;
private int mark = 0;
private boolean closed = false;

/**
* Creates a new string reader.
Expand All @@ -49,8 +47,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) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FastStringReader uses a length equal to -1 to indicate that the reader has been closed. But once closed, the CharSequence's length() method reports an invalid value making use of subSequence(int,int) method fail. I fixed that by adding a closed flag instead of relying on length value.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has been caught by tests, because Jackson 2.9.2 is more descriptive than 2.8.6 when reporting JSON location in exception messages and uses CharSequence's length() method here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

throw new IOException("Stream closed");
}
}

@Override
Expand Down Expand Up @@ -196,7 +195,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 @@ -72,18 +72,18 @@ public void testParseTopLevelBuilderEmptyObject() throws IOException {
public void testParseTopLevelBuilderMalformedJson() throws IOException {
for (String requestBody : Arrays.asList("\"\"", "\"someString\"", "\"{\"")) {
try (XContentParser parser = createParser(JsonXContent.jsonXContent, requestBody)) {
ParsingException exception =
expectThrows(ParsingException.class, () -> RestActions.getQueryContent(parser));
ParsingException exception = expectThrows(ParsingException.class, () -> RestActions.getQueryContent(parser));
assertEquals("Expected [START_OBJECT] but found [VALUE_STRING]", exception.getMessage());
}
}
}

public void testParseTopLevelBuilderIncompleteJson() throws IOException {
for (String requestBody : Arrays.asList("{", "{ \"query\" :")) {
final String incomplete = "{\"query\":";
for (int i = 1; i <= incomplete.length(); i++) {
String requestBody = incomplete.substring(0, i);
try (XContentParser parser = createParser(JsonXContent.jsonXContent, requestBody)) {
ParsingException exception =
expectThrows(ParsingException.class, () -> RestActions.getQueryContent(parser));
ParsingException exception = expectThrows(ParsingException.class, () -> RestActions.getQueryContent(parser));
assertEquals("Failed to parse", exception.getMessage());
assertEquals(JsonEOFException.class, exception.getRootCause().getClass());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void testInvalidJson() {
Exception exception = expectThrows(IllegalArgumentException.class, () -> jsonProcessor.execute(ingestDocument));
assertThat(exception.getCause().getCause().getMessage(), equalTo("Unrecognized token"
+ " 'invalid': was expecting ('true', 'false' or 'null')\n"
+ " at [Source: invalid json; line: 1, column: 8]"));
+ " at [Source: (org.elasticsearch.common.io.FastStringReader)\"invalid json\"; line: 1, column: 8]"));
}

public void testFieldMissing() {
Expand Down