fix messagePack, try-with-resources
@@ -76,7 +76,7 @@ public class MessagePackSequenceFileReaderWriterFactory implements FileReaderWri
@Override
public KeyValue next() throws IOException {
if (mReader.next(mKey, mValue)) {
- MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(mKey.getBytes());
+ try(MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(mKey.getBytes())) {
int mapSize = unpacker.unpackMapHeader();
long offset = 0;
long timestamp = -1;
@@ -97,8 +97,8 @@ public class MessagePackSequenceFileReaderWriterFactory implements FileReaderWri
break;
}
}
- unpacker.close();
return new KeyValue(offset, keyBytes, Arrays.copyOfRange(mValue.getBytes(), 0, mValue.getLength()), timestamp);
+ }
} else {
return null;
}
