Skip to content

Commit 96fe38c

Browse files
committed
Catch deobfuscator jar loading problems even earlier.
1 parent c267435 commit 96fe38c

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/java/com/javadeobfuscator/deobfuscator/ui/SwingWindow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,9 +1448,9 @@ private static List<String> splitQuoteAware(String args1, char splitChar)
14481448

14491449
private static void loadWrappers()
14501450
{
1451-
WrapperFactory.setupJarLoader(false);
14521451
try
14531452
{
1453+
WrapperFactory.setupJarLoader(false);
14541454
deob = WrapperFactory.getDeobfuscator();
14551455
trans = WrapperFactory.getTransformers();
14561456
config = deob.getConfig();

src/java/com/javadeobfuscator/deobfuscator/ui/wrap/WrapperFactory.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static void setupJarLoader(File file) throws IOException, InvalidJarExcep
5959
*
6060
* @param recursive Check sub-directories of adjacent folders.
6161
*/
62-
public static void setupJarLoader(boolean recursive)
62+
public static void setupJarLoader(boolean recursive) throws FallbackException
6363
{
6464
loader = auto(recursive);
6565
}
@@ -84,7 +84,7 @@ private static ByteLoader fromJar(File jar) throws IOException, InvalidJarExcept
8484
* @param recurse Check sub-directories of adjacent folders.
8585
* @return JavaDeobfuscator loader. {@code null} if no JavaDeobfuscator jar could be found.
8686
*/
87-
private static ByteLoader auto(boolean recurse)
87+
private static ByteLoader auto(boolean recurse) throws FallbackException
8888
{
8989
return iter(new File(System.getProperty("user.dir")), recurse);
9090
}
@@ -96,14 +96,14 @@ private static ByteLoader auto(boolean recurse)
9696
* @param recurse whether to recurse into subdirectories
9797
* @return JavaDeobfuscator loader.
9898
*/
99-
private static ByteLoader iter(File dir, boolean recurse)
99+
private static ByteLoader iter(File dir, boolean recurse) throws FallbackException
100100
{
101101
System.out.println("Searching for deobfuscator in " + dir.getAbsolutePath());
102102
File[] files = dir.listFiles();
103103
// return if no files exist in the directory
104104
if (files == null)
105105
{
106-
return null;
106+
throw new FallbackException("Loading problem", "No files found in directory: " + dir.getAbsolutePath(), null);
107107
}
108108
// check for common names
109109
File deobfuscator = new File(dir, "deobfuscator.jar");
@@ -131,10 +131,11 @@ private static ByteLoader iter(File dir, boolean recurse)
131131
// check sub-dirs
132132
if (recurse && file.isDirectory())
133133
{
134-
ByteLoader v = iter(file, true);
135-
if (v != null)
134+
try
136135
{
137-
return v;
136+
return iter(file, true);
137+
} catch (FallbackException e) {
138+
// ignore
138139
}
139140
}
140141
// check files in the directory
@@ -150,7 +151,7 @@ else if (file.getName().endsWith(".jar"))
150151
}
151152
}
152153
}
153-
return null;
154+
throw new FallbackException("Loading problem", "No deobfuscator jar found in directory: " + dir.getAbsolutePath(), null);
154155
}
155156

156157
/**

0 commit comments

Comments
 (0)