Skip to content

Commit

Permalink
Merge pull request #413 from cherylking/fixNPE
Browse files Browse the repository at this point in the history
Fix NPE on stream close
  • Loading branch information
cherylking authored Sep 15, 2023
2 parents 657b476 + 415d3e0 commit 26b75d2
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ public File generateJson(String targetJsonFile, Map<File, String> esaFileMap) th
}

} catch (PrivilegedActionException e) {
debug(e);
throw new PluginExecutionException("Could not load the jar " + installJarFile.getAbsolutePath(), e);
}
File targetFile = new File(targetJsonFile);
Expand All @@ -267,10 +268,17 @@ public File generateJson(String targetJsonFile, Map<File, String> esaFileMap) th
debug(e);
throw new PluginExecutionException("Cannot read or create json file " + targetJsonFile, e);
} finally {
try {
instream.close();
outstream.close();
} catch (IOException e) {
if (instream != null) {
try {
instream.close();
} catch (IOException e) {
}
}
if (outstream != null) {
try {
outstream.close();
} catch (IOException e) {
}
}
}
}
Expand Down

0 comments on commit 26b75d2

Please sign in to comment.