Skip to content

Commit

Permalink
Close zip entry streams.
Browse files Browse the repository at this point in the history
  • Loading branch information
alesj authored and n1hility committed Apr 3, 2013
1 parent b629641 commit cdf950c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/main/java/org/jboss/jandex/JarIndexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,23 @@ public static Result createJarIndex(File jarFile, Indexer indexer, boolean modif
if (clone.getMethod() != ZipEntry.STORED)
clone.setCompressedSize(-1);
zo.putNextEntry(clone);
copy(jar.getInputStream(entry), zo);
final InputStream stream = jar.getInputStream(entry);
try {
copy(stream, zo);
} finally {
safeClose(stream);
}
}

if (entry.getName().endsWith(".class")) {
try {
ClassInfo info = indexer.index(jar.getInputStream(entry));
final InputStream stream = jar.getInputStream(entry);
ClassInfo info;
try {
info = indexer.index(stream);
} finally {
safeClose(stream);
}
if (verbose && info != null)
printIndexEntryInfo(info);
} catch (Exception e) {
Expand Down

0 comments on commit cdf950c

Please sign in to comment.