HBASE-18754 (addendum) close the input resource

This commit is contained in:
Chia-Ping Tsai 2017-10-25 12:31:37 +08:00
parent dd70cc3081
commit 2e6481386b
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());
}
}
}