Skip to content

Commit 1ceab6c

Browse files
committed
fix test
1 parent 6db8667 commit 1ceab6c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

server/src/main/java/org/elasticsearch/action/search/MultiSearchRequest.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,11 @@ public static void readMultiLineFormat(
272272
)
273273
) {
274274
Map<String, Object> source = parser.map();
275-
if (parser.nextToken() != null) {
275+
// In Jackson 2.21+, parser.map() leaves the parser at END_OBJECT, need to advance past it
276+
XContentParser.Token token = parser.currentToken() == XContentParser.Token.END_OBJECT
277+
? parser.nextToken()
278+
: parser.currentToken();
279+
if (token != null) {
276280
throw new XContentParseException(parser.getTokenLocation(), "Unexpected token after end of object");
277281
}
278282
Object expandWildcards = null;
@@ -360,7 +364,11 @@ public static void readMultiLineFormat(
360364
)
361365
) {
362366
consumer.accept(searchRequest, parser);
363-
if (parser.nextToken() != null) {
367+
// In Jackson 2.21+, after parsing, the parser may be at END_OBJECT, need to advance past it
368+
XContentParser.Token token = parser.currentToken() == XContentParser.Token.END_OBJECT
369+
? parser.nextToken()
370+
: parser.currentToken();
371+
if (token != null) {
364372
throw new XContentParseException(parser.getTokenLocation(), "Unexpected token after end of object");
365373
}
366374
}

0 commit comments

Comments
 (0)