Skip to content

Commit

Permalink
add close
Browse files Browse the repository at this point in the history
  • Loading branch information
momo199059 committed Dec 20, 2021
1 parent b637058 commit 89af537
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class AppBundleAnalyzer {

private static final Logger logger = Logger.getLogger(AppBundleAnalyzer.class.getName());
private final Path bundlePath;
private ZipFile bundleZip;

public AppBundleAnalyzer(Path bundlePath) {
checkFileExistsAndReadable(bundlePath);
Expand All @@ -26,10 +27,17 @@ public AppBundleAnalyzer(Path bundlePath) {

public AppBundle analyze() throws IOException {
TimeClock timeClock = new TimeClock();
ZipFile bundleZip = new ZipFile(bundlePath.toFile());
bundleZip = new ZipFile(bundlePath.toFile());
AppBundle appBundle = AppBundle.buildFromZip(bundleZip);
// bundleZip.close();
System.out.println(String.format("analyze bundle file done, const %s", timeClock.getCoast()));
return appBundle;
}

public void closeFile() throws IOException {
if(bundleZip != null){
bundleZip.close();
bundleZip = null;
System.out.println(String.format("bundle zip close"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ public static ObfuscateBundleCommand fromFlags(ParsedFlags flags) throws Documen
public Path execute() throws IOException, InterruptedException {
TimeClock timeClock = new TimeClock();

AppBundle appBundle = new AppBundleAnalyzer(getBundlePath()).analyze();
AppBundleAnalyzer analyzer = new AppBundleAnalyzer(getBundlePath());
AppBundle appBundle = analyzer.analyze();
// filter file
if (getFilterFile().isPresent() && getFilterFile().get()) {
Set<String> fileFilterRules = new HashSet<>();
Expand Down Expand Up @@ -243,6 +244,7 @@ storeFile, getStorePassword().get(), getKeyAlias().get(), getKeyPassword().get()
getNetFileSizeDescription(rawSize),
getNetFileSizeDescription(filteredSize)
));
analyzer.closeFile();
return getOutputPath();
}

Expand Down

0 comments on commit 89af537

Please sign in to comment.