@@ -471,7 +471,6 @@ public static ElasticsearchException fromXContent(XContentParser parser) throws
471
471
String type = null , reason = null , stack = null ;
472
472
ElasticsearchException cause = null ;
473
473
Map <String , List <String >> metadata = new HashMap <>();
474
- //TODO should this be a Map<String, List<String>> instead?
475
474
Map <String , Object > headers = new HashMap <>();
476
475
477
476
do {
@@ -485,7 +484,6 @@ public static ElasticsearchException fromXContent(XContentParser parser) throws
485
484
} else if (STACK_TRACE .equals (currentFieldName )) {
486
485
stack = parser .text ();
487
486
} else {
488
- //TODO here we need to parse multiple values
489
487
metadata .put (currentFieldName , Collections .singletonList (parser .text ()));
490
488
}
491
489
} else if (token == XContentParser .Token .START_OBJECT ) {
@@ -514,13 +512,12 @@ public static ElasticsearchException fromXContent(XContentParser parser) throws
514
512
//while key-value pairs are. Those become part of the metadata set and inherit the "es." prefix as that is currently required
515
513
//by addMetadata. The prefix will get stripped out anyways when printing metadata out so it will be invisible.
516
514
//The only potential problem would manifest if a parsed exception is serialized back to a version < 5.3.0 , then the additional
517
- //metadata would be sent back as es. response headers which is suprising . That said this never ever happens as exceptions
515
+ //metadata would be sent back as es. response headers which is surprising . That said this never ever happens as exceptions
518
516
//are only parsed in the high level REST client. Maybe this is a good reason to have parsing code for exceptions in the client
519
517
//only, also because while response may moved out of core one day, exception most likely won't.
520
518
e .addMetadata ("es." + entry .getKey (), entry .getValue ());
521
519
}
522
520
for (Map .Entry <String , Object > header : headers .entrySet ()) {
523
- //TODO lists should be supported
524
521
e .addHeader (header .getKey (), String .valueOf (header .getValue ()));
525
522
}
526
523
return e ;
0 commit comments