Skip to content

Commit

Permalink
Adding null guard to temp file removal (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
monitorjbl committed Oct 14, 2018
1 parent 7c49263 commit 480b40d
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ public void init(InputStream is) {
} catch(IOException e) {
throw new ReadException("Unable to read input stream", e);
} catch(RuntimeException e) {
f.delete();
if(f != null) {
f.delete();
}
throw e;
}
}
Expand Down Expand Up @@ -196,13 +198,13 @@ public void close() throws IOException {
pkg.revert();
} finally {
if(tmp != null) {
if (log.isDebugEnabled()) {
if(log.isDebugEnabled()) {
log.debug("Deleting tmp file [" + tmp.getAbsolutePath() + "]");
}
tmp.delete();
}
if(sst instanceof BufferedStringsTable) {
if (log.isDebugEnabled()) {
if(log.isDebugEnabled()) {
log.debug("Deleting sst cache file [" + this.sstCache.getAbsolutePath() + "]");
}
((BufferedStringsTable) sst).close();
Expand Down

0 comments on commit 480b40d

Please sign in to comment.