HBASE-18754 (addendum) close the input resource

This commit is contained in:
Chia-Ping Tsai 2017-10-25 12:31:37 +08:00
parent f887a5a3af
commit f6ba8185ea
1 changed files with 3 additions and 2 deletions

View File

@ -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());
}
}
}