Skip to content

Commit 0a415fb

Browse files
committed
Close builder
1 parent 110843f commit 0a415fb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

server/src/main/java/org/elasticsearch/action/index/IndexRequest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,7 @@ public BytesReference source() {
425425
public void setStructuredSource(ESONSource.ESONObject esonSource) {
426426
this.useStructuredSource = true;
427427
this.structuredSource = esonSource;
428-
try {
429-
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
428+
try (XContentBuilder builder = XContentFactory.contentBuilder(contentType)) {
430429
ESONXContentSerializer.flattedToXContent(esonSource, builder, ToXContent.EMPTY_PARAMS);
431430
source = BytesReference.bytes(builder);
432431
} catch (IOException e) {

0 commit comments

Comments
 (0)