mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-25 09:28:27 +00:00
Use currentName instead of text() to parse field names.
Original commit: elastic/x-pack-elasticsearch@f4b75c3f2d
This commit is contained in:
parent
d904fa5931
commit
fbe777005b
@ -105,7 +105,7 @@ public class LicensesMetaData extends AbstractDiffable<MetaData.Custom> implemen
|
||||
XContentParser.Token token;
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
String fieldName = parser.text();
|
||||
String fieldName = parser.currentName();
|
||||
if (fieldName != null) {
|
||||
// for back compat with 1.x license metadata
|
||||
if (fieldName.equals(Fields.TRIAL_LICENSES) || fieldName.equals(Fields.SIGNED_LICENCES)) {
|
||||
|
@ -100,7 +100,7 @@ public class TriggerService extends AbstractComponent {
|
||||
if (token != XContentParser.Token.FIELD_NAME) {
|
||||
throw new ElasticsearchParseException("could not parse trigger for [{}]. expected trigger type string field, but found [{}]", jobName, token);
|
||||
}
|
||||
String type = parser.text();
|
||||
String type = parser.currentName();
|
||||
token = parser.nextToken();
|
||||
if (token != XContentParser.Token.START_OBJECT) {
|
||||
throw new ElasticsearchParseException("could not parse trigger [{}] for [{}]. expected trigger an object as the trigger body, but found [{}]", type, jobName, token);
|
||||
@ -128,7 +128,7 @@ public class TriggerService extends AbstractComponent {
|
||||
if (token != XContentParser.Token.FIELD_NAME) {
|
||||
throw new ElasticsearchParseException("could not parse trigger event for [{}] for watch [{}]. expected trigger type string field, but found [{}]", context, watchId, token);
|
||||
}
|
||||
String type = parser.text();
|
||||
String type = parser.currentName();
|
||||
token = parser.nextToken();
|
||||
if (token != XContentParser.Token.START_OBJECT) {
|
||||
throw new ElasticsearchParseException("could not parse trigger event for [{}] for watch [{}]. expected trigger an object as the trigger body, but found [{}]", context, watchId, token);
|
||||
|
Loading…
x
Reference in New Issue
Block a user