mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
Adding checks for unexpected tokens in parser
This commit is contained in:
parent
c57672c9b3
commit
9ea18fc576
@ -278,6 +278,8 @@ public class HighlightBuilder extends AbstractHighlighterBuilder<HighlightBuilde
|
||||
} else {
|
||||
throw new ParsingException(parser.getTokenLocation(), "cannot parse object with name [{}]", topLevelFieldName);
|
||||
}
|
||||
} else if (topLevelFieldName != null) {
|
||||
throw new ParsingException(parser.getTokenLocation(), "unexpected token [{}] after [{}]", token, topLevelFieldName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -482,6 +484,8 @@ public class HighlightBuilder extends AbstractHighlighterBuilder<HighlightBuilde
|
||||
} else {
|
||||
throw new ParsingException(parser.getTokenLocation(), "cannot parse object with name [{}]", currentFieldName);
|
||||
}
|
||||
} else if (currentFieldName != null) {
|
||||
throw new ParsingException(parser.getTokenLocation(), "unexpected token [{}] after [{}]", token, currentFieldName);
|
||||
}
|
||||
}
|
||||
return field;
|
||||
|
Loading…
x
Reference in New Issue
Block a user