Skip to content

Commit

Permalink
[Issue #168] Close open resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcpierce committed Mar 4, 2020
1 parent 1b62d7d commit d3e89d6
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected ZipFile openArchive(File comicFile) throws ArchiveAdaptorException {

@Override
void saveComicInternal(Comic source, String filename, boolean renamePages)
throws ArchiveAdaptorException {
throws ArchiveAdaptorException, IOException {
logger.debug("Creating temporary file: " + filename);

ZipArchiveOutputStream zoutput = null;
Expand Down Expand Up @@ -171,11 +171,13 @@ void saveComicInternal(Comic source, String filename, boolean renamePages)
zoutput.write(page.getContent());
zoutput.closeArchiveEntry();
}

zoutput.finish();
zoutput.close();
} catch (IOException | ArchiveException error) {
throw new ArchiveAdaptorException("error creating comic archive", error);
} finally {
if (zoutput != null) {
zoutput.finish();
zoutput.close();
}
}
}

Expand Down

0 comments on commit d3e89d6

Please sign in to comment.