Skip to content

Commit 79a8454

Browse files
committed
address some review comments
1 parent 79964d8 commit 79a8454

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

core/src/main/java/org/elasticsearch/ElasticsearchException.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,6 @@ public static ElasticsearchException fromXContent(XContentParser parser) throws
471471
String type = null, reason = null, stack = null;
472472
ElasticsearchException cause = null;
473473
Map<String, List<String>> metadata = new HashMap<>();
474-
//TODO should this be a Map<String, List<String>> instead?
475474
Map<String, Object> headers = new HashMap<>();
476475

477476
do {
@@ -485,7 +484,6 @@ public static ElasticsearchException fromXContent(XContentParser parser) throws
485484
} else if (STACK_TRACE.equals(currentFieldName)) {
486485
stack = parser.text();
487486
} else {
488-
//TODO here we need to parse multiple values
489487
metadata.put(currentFieldName, Collections.singletonList(parser.text()));
490488
}
491489
} else if (token == XContentParser.Token.START_OBJECT) {
@@ -514,13 +512,12 @@ public static ElasticsearchException fromXContent(XContentParser parser) throws
514512
//while key-value pairs are. Those become part of the metadata set and inherit the "es." prefix as that is currently required
515513
//by addMetadata. The prefix will get stripped out anyways when printing metadata out so it will be invisible.
516514
//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
518516
//are only parsed in the high level REST client. Maybe this is a good reason to have parsing code for exceptions in the client
519517
//only, also because while response may moved out of core one day, exception most likely won't.
520518
e.addMetadata("es." + entry.getKey(), entry.getValue());
521519
}
522520
for (Map.Entry<String, Object> header : headers.entrySet()) {
523-
//TODO lists should be supported
524521
e.addHeader(header.getKey(), String.valueOf(header.getValue()));
525522
}
526523
return e;

core/src/test/java/org/elasticsearch/rest/BytesRestResponseTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public void testWithHeaders() throws Exception {
5757
BytesRestResponse response = new BytesRestResponse(channel, new WithHeadersException());
5858
assertEquals(2, response.getHeaders().size());
5959
assertThat(response.getHeaders().get("n1"), notNullValue());
60-
assertThat(response.getHeaders().get("n1"), notNullValue());
6160
assertThat(response.getHeaders().get("n1"), contains("v11", "v12"));
6261
assertThat(response.getHeaders().get("n2"), notNullValue());
6362
assertThat(response.getHeaders().get("n2"), contains("v21", "v22"));

0 commit comments

Comments
 (0)