From f6ba8185ea2960ea8760d9bb175feda9e19cc699 Mon Sep 17 00:00:00 2001 From: Chia-Ping Tsai Date: Wed, 25 Oct 2017 12:31:37 +0800 Subject: [PATCH] HBASE-18754 (addendum) close the input resource --- .../apache/hadoop/hbase/regionserver/TimeRangeTracker.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java index 08d9853802a..203bea3d514 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/TimeRangeTracker.java @@ -199,8 +199,9 @@ public abstract class TimeRangeTracker { ProtobufUtil.mergeFrom(builder, data, pblen, data.length - pblen); return TimeRangeTracker.create(type, builder.getFrom(), builder.getTo()); } else { - DataInputStream in = new DataInputStream(new ByteArrayInputStream(data)); - return TimeRangeTracker.create(type, in.readLong(), in.readLong()); + try (DataInputStream in = new DataInputStream(new ByteArrayInputStream(data))) { + return TimeRangeTracker.create(type, in.readLong(), in.readLong()); + } } }