anmolnar commented on a change in pull request #1638:
URL: https://github.com/apache/zookeeper/pull/1638#discussion_r607945496
##########
File path:
zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/SnapStream.java
##########
@@ -104,10 +104,20 @@ public static CheckedInputStream getInputStream(File
file) throws IOException {
InputStream is;
switch (getStreamMode(file.getName())) {
case GZIP:
- is = new GZIPInputStream(fis);
+ try {
Review comment:
Put the entire block in a try-catch:
```java
try {
switch (getStreamMode(file.getName())) {
case GZIP:
is = new GZIPInputStream(fis);
break;
case SNAPPY:
is = new SnappyInputStream(fis);
break;
case CHECKED:
default:
is = new BufferedInputStream(fis);
}
return new CheckedInputStream(is, new Adler32());
} catch (IOException e) {
fis.close();
throw e;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]