Skip to content

Commit

Permalink
Close iterating sdf reader in finally block
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasSchaub committed Dec 20, 2023
1 parent 67ba808 commit 10cbf6a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public ErtlFunctionalGroupsFinderPerformanceSnapshotApp(String[] anArgs) throws
FileInputStream tmpDBFileInputStream = null;
ExecutorService executor = null;
PrintWriter tmpResultsPrintWriter = null;
IteratingSDFReader tmpDBReader = null;
boolean tmpHasAnErrorOccurred = false;
try {
if (anArgs.length != 2) {
Expand Down Expand Up @@ -180,7 +181,7 @@ public ErtlFunctionalGroupsFinderPerformanceSnapshotApp(String[] anArgs) throws
tmpResultsPrintWriter.println("Application initialized. Loading database file named " + anArgs[0] + ".");
tmpResultsPrintWriter.flush();
System.out.println("\nApplication initialized. Loading database file named " + anArgs[0] + ".");
IteratingSDFReader tmpDBReader = new IteratingSDFReader(tmpDBFileInputStream,
tmpDBReader = new IteratingSDFReader(tmpDBFileInputStream,
SilentChemObjectBuilder.getInstance(),
true);
List<IAtomContainer> tmpMoleculesList = new LinkedList<>();
Expand Down Expand Up @@ -255,6 +256,9 @@ public ErtlFunctionalGroupsFinderPerformanceSnapshotApp(String[] anArgs) throws
if (!Objects.isNull(tmpDBFileInputStream)) {
tmpDBFileInputStream.close();
}
if (!Objects.isNull(tmpDBReader)) {
tmpDBReader.close();
}
if (tmpHasAnErrorOccurred) {
System.exit(1);
}
Expand Down

0 comments on commit 10cbf6a

Please sign in to comment.