Added patch from Thomas Oldervoll, to continue decompiling

after errors.


git-svn-id: https://svn.code.sf.net/p/jode/code/branches/branch_1_1@1375 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
hoenicke 22 years ago
parent 97b5c5bb0f
commit 6604df3248
  1. 10
      jode/ChangeLog
  2. 27
      jode/jode/decompiler/Main.java

@ -1,3 +1,13 @@
2003-06-11 Jochen Hoenicke <jochen@gnu.org>
Added patch from Thomas Oldervoll, to continue decompiling
after errors.
* jode/decompiler/Main.java (decompileClass): Handle all
exceptions and add names of failed classes to a vector.
(printSummary): New function.
(main): call printSummary.
2002-11-24 Jochen Hoenicke <jochen@gnu.org> 2002-11-24 Jochen Hoenicke <jochen@gnu.org>
* jode/bytecode/ClassInfo.java.in (deprecatedFlag): Added flag * jode/bytecode/ClassInfo.java.in (deprecatedFlag): Added flag

@ -30,12 +30,16 @@ import java.util.zip.ZipOutputStream;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Vector;
import gnu.getopt.LongOpt; import gnu.getopt.LongOpt;
import gnu.getopt.Getopt; import gnu.getopt.Getopt;
public class Main extends Options { public class Main extends Options {
private static int successCount = 0;
private static Vector failedClasses;
private static final int OPTION_START=0x10000; private static final int OPTION_START=0x10000;
private static final int OPTION_END =0x20000; private static final int OPTION_END =0x20000;
@ -190,11 +194,18 @@ public class Main extends Options {
writer.close(); writer.close();
/* Now is a good time to clean up */ /* Now is a good time to clean up */
System.gc(); System.gc();
successCount++;
} catch (IOException ex) { } catch (IOException ex) {
failedClasses.addElement(className);
GlobalOptions.err.println GlobalOptions.err.println
("Can't write source of "+className+"."); ("Can't write source of "+className+".");
GlobalOptions.err.println("Check the permissions."); GlobalOptions.err.println("Check the permissions.");
ex.printStackTrace(GlobalOptions.err); ex.printStackTrace(GlobalOptions.err);
} catch (Throwable t) {
failedClasses.addElement(className);
GlobalOptions.err.println
("Failed to decompile "+className+".");
t.printStackTrace(GlobalOptions.err);
} }
} }
@ -206,6 +217,7 @@ public class Main extends Options {
} catch (Throwable ex) { } catch (Throwable ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
printSummary();
/* When AWT applications are compiled with insufficient /* When AWT applications are compiled with insufficient
* classpath the type guessing by reflection code can * classpath the type guessing by reflection code can
* generate an awt thread that will prevent normal * generate an awt thread that will prevent normal
@ -214,12 +226,27 @@ public class Main extends Options {
System.exit(0); System.exit(0);
} }
private static void printSummary() {
GlobalOptions.err.println();
if (failedClasses.size() > 0) {
GlobalOptions.err.println("Failed to decompile these classes:");
Enumeration enum = failedClasses.elements();
while (enum.hasMoreElements()) {
GlobalOptions.err.println("\t" + enum.nextElement());
}
GlobalOptions.err.println("Failed to decompile " + failedClasses.size() + " classes.");
}
GlobalOptions.err.println("Decompiled " + successCount + " classes.");
}
public static void decompile(String[] params) { public static void decompile(String[] params) {
if (params.length == 0) { if (params.length == 0) {
usage(); usage();
return; return;
} }
failedClasses = new Vector();
String classPath = System.getProperty("java.class.path") String classPath = System.getProperty("java.class.path")
.replace(File.pathSeparatorChar, Decompiler.altPathSeparatorChar); .replace(File.pathSeparatorChar, Decompiler.altPathSeparatorChar);
String bootClassPath = System.getProperty("sun.boot.class.path"); String bootClassPath = System.getProperty("sun.boot.class.path");

Loading…
Cancel
Save