@@ -59,7 +59,7 @@ public static void setupJarLoader(File file) throws IOException, InvalidJarExcep
59
59
*
60
60
* @param recursive Check sub-directories of adjacent folders.
61
61
*/
62
- public static void setupJarLoader (boolean recursive )
62
+ public static void setupJarLoader (boolean recursive ) throws FallbackException
63
63
{
64
64
loader = auto (recursive );
65
65
}
@@ -84,7 +84,7 @@ private static ByteLoader fromJar(File jar) throws IOException, InvalidJarExcept
84
84
* @param recurse Check sub-directories of adjacent folders.
85
85
* @return JavaDeobfuscator loader. {@code null} if no JavaDeobfuscator jar could be found.
86
86
*/
87
- private static ByteLoader auto (boolean recurse )
87
+ private static ByteLoader auto (boolean recurse ) throws FallbackException
88
88
{
89
89
return iter (new File (System .getProperty ("user.dir" )), recurse );
90
90
}
@@ -96,14 +96,14 @@ private static ByteLoader auto(boolean recurse)
96
96
* @param recurse whether to recurse into subdirectories
97
97
* @return JavaDeobfuscator loader.
98
98
*/
99
- private static ByteLoader iter (File dir , boolean recurse )
99
+ private static ByteLoader iter (File dir , boolean recurse ) throws FallbackException
100
100
{
101
101
System .out .println ("Searching for deobfuscator in " + dir .getAbsolutePath ());
102
102
File [] files = dir .listFiles ();
103
103
// return if no files exist in the directory
104
104
if (files == null )
105
105
{
106
- return null ;
106
+ throw new FallbackException ( "Loading problem" , "No files found in directory: " + dir . getAbsolutePath (), null ) ;
107
107
}
108
108
// check for common names
109
109
File deobfuscator = new File (dir , "deobfuscator.jar" );
@@ -131,10 +131,11 @@ private static ByteLoader iter(File dir, boolean recurse)
131
131
// check sub-dirs
132
132
if (recurse && file .isDirectory ())
133
133
{
134
- ByteLoader v = iter (file , true );
135
- if (v != null )
134
+ try
136
135
{
137
- return v ;
136
+ return iter (file , true );
137
+ } catch (FallbackException e ) {
138
+ // ignore
138
139
}
139
140
}
140
141
// check files in the directory
@@ -150,7 +151,7 @@ else if (file.getName().endsWith(".jar"))
150
151
}
151
152
}
152
153
}
153
- return null ;
154
+ throw new FallbackException ( "Loading problem" , "No deobfuscator jar found in directory: " + dir . getAbsolutePath (), null ) ;
154
155
}
155
156
156
157
/**
0 commit comments