-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix Metadata and IndexMetadata XContent Parsing not Draining Parser #74844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Metadata and IndexMetadata XContent Parsing not Draining Parser #74844
Conversation
Exactly the same as elastic#73268 but for metadata and index metadata which can run into the same bug.
|
Pinging @elastic/es-distributed (Team:Distributed) |
| if (parser.currentToken() != XContentParser.Token.FIELD_NAME) { | ||
| throw new IllegalArgumentException("expected field name but got a " + parser.currentToken()); | ||
| } | ||
| XContentParserUtils.ensureExpectedToken(XContentParser.Token.FIELD_NAME, parser.currentToken(), parser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's fine to throw here a ParsingException instead of IllegalArgumentException?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's fine and maybe even preferable as it gives a much easier to interpret error message by including some bytes around the broken section in the message.
fcofdez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I left a minor question. 👍
|
Thanks Francisco! |
…lastic#74844) Exactly the same as elastic#73268 but for metadata and index metadata which can run into the same bug.
…lastic#74844) Exactly the same as elastic#73268 but for metadata and index metadata which can run into the same bug.
Exactly the same as #73268 but for metadata and index metadata which can run into
the same bug.