Skip to content
Snippets Groups Projects
Commit 92670388 authored by Jason Tedor's avatar Jason Tedor
Browse files

Elasticsearch 5: Close content builder

This commit wraps the usage of a content builder in a try-with-resources
block to ensure that it is correctly closed.
parent d791ae61
No related branches found
No related tags found
No related merge requests found
...@@ -150,8 +150,7 @@ public class ElasticsearchClient extends DB { ...@@ -150,8 +150,7 @@ public class ElasticsearchClient extends DB {
@Override @Override
public Status insert(String table, String key, Map<String, ByteIterator> values) { public Status insert(String table, String key, Map<String, ByteIterator> values) {
try { try (XContentBuilder doc = jsonBuilder()) {
final XContentBuilder doc = jsonBuilder();
doc.startObject(); doc.startObject();
for (final Entry<String, String> entry : StringByteIterator.getStringMap(values).entrySet()) { for (final Entry<String, String> entry : StringByteIterator.getStringMap(values).entrySet()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment