Skip to content

Commit 1dcf070

Browse files
authored
refactor: source and tests (#4071)
1 parent 51b81f8 commit 1dcf070

File tree

72 files changed

+1170
-1476
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1170
-1476
lines changed

brut.apktool/apktool-cli/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ plugins {
99
dependencies {
1010
implementation(project(":brut.apktool:apktool-lib"))
1111
implementation(libs.commons.cli)
12-
implementation(libs.commons.io)
1312
r8(libs.r8)
1413
}
1514

brut.apktool/apktool-cli/src/main/java/brut/apktool/Main.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@
2525
import brut.androlib.exceptions.OutDirExistsException;
2626
import brut.androlib.res.AaptManager;
2727
import brut.androlib.res.Framework;
28-
import brut.directory.ExtFile;
2928
import brut.util.OSDetection;
3029
import org.apache.commons.cli.*;
31-
import org.apache.commons.io.IOUtils;
3230

3331
import java.io.File;
3432
import java.io.FileNotFoundException;
@@ -501,11 +499,8 @@ private static void cmdDecode(String[] args) throws AndrolibException {
501499
: apkName + ".out");
502500
}
503501

504-
try (ExtFile apkFile = new ExtFile(apkName)) {
505-
ApkDecoder decoder = new ApkDecoder(apkFile, config);
506-
decoder.decode(outDir);
507-
} catch (IOException ignored) {
508-
// Input file could not be closed, just ignore.
502+
try {
503+
new ApkDecoder(new File(apkName), config).decode(outDir);
509504
} catch (InFileNotFoundException | OutDirExistsException | FrameworkNotFoundException ex) {
510505
System.err.println(ex.getMessage());
511506
System.exit(1);
@@ -581,9 +576,7 @@ private static void cmdBuild(String[] args) throws AndrolibException {
581576
}
582577
}
583578

584-
ExtFile apkDir = new ExtFile(apkDirName);
585-
ApkBuilder builder = new ApkBuilder(apkDir, config);
586-
builder.build(outFile);
579+
new ApkBuilder(new File(apkDirName), config).build(outFile);
587580
}
588581

589582
private static void cmdInstallFramework(String[] args) throws AndrolibException {
@@ -878,17 +871,13 @@ public String getBaksmaliVersion() {
878871
}
879872

880873
private void load(Properties props, String name) {
881-
InputStream in = null;
882-
try {
883-
in = Main.class.getResourceAsStream(name);
874+
try (InputStream in = Main.class.getResourceAsStream(name)) {
884875
if (in == null) {
885876
throw new FileNotFoundException(name);
886877
}
887878
props.load(in);
888879
} catch (IOException ignored) {
889-
System.out.println("Could not load " + name);
890-
} finally {
891-
IOUtils.closeQuietly(in);
880+
System.err.println("Could not load resource: " + name);
892881
}
893882
}
894883
}

0 commit comments

Comments
 (0)