Skip to content

Commit

Permalink
fix: close resource (PR #546)
Browse files Browse the repository at this point in the history
  • Loading branch information
asashour authored and skylot committed Mar 31, 2019
1 parent b09c7ba commit a6f935e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions jadx-core/src/main/java/jadx/core/Jadx.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package jadx.core;

import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
Expand Down Expand Up @@ -126,10 +127,12 @@ public static String getVersion() {
if (classLoader != null) {
Enumeration<URL> resources = classLoader.getResources("META-INF/MANIFEST.MF");
while (resources.hasMoreElements()) {
Manifest manifest = new Manifest(resources.nextElement().openStream());
String ver = manifest.getMainAttributes().getValue("jadx-version");
if (ver != null) {
return ver;
try (InputStream is = resources.nextElement().openStream()) {
Manifest manifest = new Manifest(is);
String ver = manifest.getMainAttributes().getValue("jadx-version");
if (ver != null) {
return ver;
}
}
}
}
Expand Down

0 comments on commit a6f935e

Please sign in to comment.