Skip to content

Commit 9002f7d

Browse files
committed
Add console output when failing to load deobfuscator from a jar file
1 parent d14384d commit 9002f7d

File tree

1 file changed

+17
-28
lines changed

1 file changed

+17
-28
lines changed

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

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ private static ByteLoader auto(boolean recurse)
9191
/**
9292
* Iterate files to detect the Deobfuscator jar.
9393
*
94-
* @param dir
95-
* @param recurse
94+
* @param dir directory to look in
95+
* @param recurse whether to recurse into subdirectories
9696
* @return JavaDeobfuscator loader.
9797
*/
9898
private static ByteLoader iter(File dir, boolean recurse)
@@ -110,28 +110,20 @@ private static ByteLoader iter(File dir, boolean recurse)
110110
if (deobfuscator.exists())
111111
try
112112
{
113-
ByteLoader v = fromJar(deobfuscator);
114-
if (v != null)
115-
{
116-
return v;
117-
}
118-
} catch (IOException e)
119-
{
120-
} catch (InvalidJarException e)
113+
return fromJar(deobfuscator);
114+
} catch (IOException | InvalidJarException e)
121115
{
116+
System.err.println("Failed to load deobfuscator from " + deobfuscator.getAbsolutePath());
117+
e.printStackTrace();
122118
}
123119
if (deobfuscator100.exists())
124120
try
125121
{
126-
ByteLoader v = fromJar(deobfuscator100);
127-
if (v != null)
128-
{
129-
return v;
130-
}
131-
} catch (IOException e)
132-
{
133-
} catch (InvalidJarException e)
122+
return fromJar(deobfuscator100);
123+
} catch (IOException | InvalidJarException e)
134124
{
125+
System.err.println("Failed to load deobfuscator from " + deobfuscator100.getAbsolutePath());
126+
e.printStackTrace();
135127
}
136128
for (File file : files)
137129
{
@@ -149,15 +141,11 @@ else if (file.getName().endsWith(".jar"))
149141
{
150142
try
151143
{
152-
ByteLoader v = fromJar(file);
153-
if (v != null)
154-
{
155-
return v;
156-
}
157-
} catch (IOException e)
158-
{
159-
} catch (InvalidJarException e)
144+
return fromJar(file);
145+
} catch (IOException | InvalidJarException e)
160146
{
147+
System.err.println("Failed to load deobfuscator from " + file.getAbsolutePath());
148+
e.printStackTrace();
161149
}
162150
}
163151
}
@@ -167,9 +155,10 @@ else if (file.getName().endsWith(".jar"))
167155
/**
168156
* Read a map from the given data file.
169157
*
170-
* @param dataFile File to read from.
158+
* @param jar File to read from.
171159
* @return Map of class names to their bytecode.
172-
* @throws InvalidJarException
160+
* @throws IOException Jar could not be read.
161+
* @throws InvalidJarException Thrown if jar loaded was not an instance of JavaDeobfuscator
173162
*/
174163
private static Map<String, byte[]> readClasses(File jar) throws IOException, InvalidJarException
175164
{

0 commit comments

Comments
 (0)