Re: jad gibt Fehlermeldung aus



Responding to Thomas Weiler:

wenn ich versuche, eine Klasse mit Jad zu dekompilieren, bekomme ich
mehrfach folgende Fehlermeldung:

Overlapped try statements detected. Not all exception handlers will be
resolved
in the method helloworld

Der Code ist auch nur sehr schwer zu gebrauchen. Hat hier der Entwickler
Fallen eingebaut, dass das Dekompilieren nicht geht oder muss man Jad
hier umstellen?

Die Falle hat gegebenenfalls schon javac eingebaut.

<snip>
patrick@judgefang:/tmp/jad> cat Hello.java
public class Hello {
public static void main(String[] args) {
Object lock = new Object();
synchronized(lock) {
System.out.println("Hello");
}
}
}
patrick@judgefang:/tmp/jad> javac -target 1.3 -source 1.3 Hello.java
patrick@judgefang:/tmp/jad> javap -c Hello
Compiled from "Hello.java"
public class Hello extends java.lang.Object{
public Hello();
Code:
0: aload_0
1: invokespecial #1; //Method java/lang/Object."<init>":()V
4: return

public static void main(java.lang.String[]);
Code:
0: new #2; //class java/lang/Object
3: dup
4: invokespecial #1; //Method java/lang/Object."<init>":()V
7: astore_1
8: aload_1
9: dup
10: astore_2
11: monitorenter
12: getstatic #3; //Field
java/lang/System.out:Ljava/io/PrintStream;
15: ldc #4; //String Hello
17: invokevirtual #5; //Method
java/io/PrintStream.println:(Ljava/lang/String;)V
20: aload_2
21: monitorexit
22: goto 30
25: astore_3
26: aload_2
27: monitorexit
28: aload_3
29: athrow
30: return
Exception table:
from to target type
12 22 25 any
25 28 25 any

}

patrick@judgefang:/tmp/jad> ./jad Hello.class
Parsing Hello.class... Generating Hello.jad
Overlapped try statements detected. Not all exception handlers will be
resolved in the method main
</snip>

Das Problem hier ist der zweite, "rekursive" Exceptionhandler: from und
to sind identisch, der try-Block ist gleich dem catch-Block. Das laesst
sich schlecht in Source nachbilden. IIRC hat Sun dieses Muster seit
JDK1.4 eingebaut. Keine Ahnung, ob man jad das explizit beibiegen kann,
per Default scheint es das Muster aber schlicht zu ignorieren, der
generierte Code ist ok. Alleine daran sollte es also nicht liegen, wenn
der Code "schwer zu gebrauchen ist".

Viele Gruesse,
Patrick
.



Relevant Pages

  • Re: Fehler: at java.lang.Thread.run()V(Unknown Source)
    ... dass die andere Komponente evtl. ... Wenn du annehmen musst, dass eine Wiederholung nichts bringen wird, dann solltest du auch den Anwender informieren und den Vorgang, wenn er nicht sinnvoll fortgesetzt werden kann abbrechen. ... Wenn deine Komponente nun nicht direkt mit dem Endanwender kommunizieren kann, dann wäre das eine Gelegenheit eine eigene Exception einzuführen und diese zu werfen. ... // bisheriger Code, aber alle Stellen an denen das null ...
    (de.comp.lang.java)
  • Re: Exceptionhandliung vs return-codes vs Destruktoren (Re:CSVImport)
    ... Kann es nicht auch sein, dass man je nach Situation, einfach nur die am wenigsten nachteilige Lösung sucht? ... eine Reihe von Closeables hast, ... noch vor dem Beginn des #close) geworfene Exception als Verursacher-Exception, die nicht durch nachfolgende Exception verschluckt werden darf. ... Anderer Code verfehlt d). ...
    (de.comp.lang.java)
  • Re: YHO about Try-Catch use.
    ... great in moderation, but for some reason people ... An exception handler is a tool for error recovery. ... use of exception handlers, but the stress is on "strategic". ... Exception handlers for debugging are bogus. ...
    (microsoft.public.dotnet.general)
  • Re: [OT] Exceptionhandliung vs return-codes vs Destruktoren (Re: CSV Import)
    ... die Verwendung eines "Einweg" Objektes das durch die Verwendung des ... und resetten von state objekten grade in multi threaded code anschaut, ... Methodenaufruf mit Exception, sondern auch bedeutend hässlicher. ...
    (de.comp.lang.java)
  • Re: Secure C library
    ... > That's the only real advantage in maintaining the current call stack. ... If the callback returns, then the ... >> terminate the process or to throw an exception. ... Also note that with nested exception handlers, ...
    (comp.std.c)