1

A friend of mine delivers Java applets and since his clients moved to Java 7, they started running into this issue: validateTree in Java 7.x doesnt work (in Java 6.x was fine)

The solution seems to be to wrap the call to validateTree as in:

synchronized(getTreeLock()) {
     validateTree();
}

I do not have the source .java file.

  • Is there a Java ByteCode Editor+Decompiler that would let me edit in those lines in plain-text Java?
  • If I do have to edit the .class file in bytecode, what are the instructions?

My view of the file with jd-gui (which does not let me edit the file though):

public final class XApplet extends JApplet
  implements ActionListener
public void init()
{
  ...
  validateTree();
}
Community
  • 1
  • 1
Cetin Sert
  • 4,497
  • 5
  • 38
  • 76
  • Is your friend by accident the person of [this question](http://stackoverflow.com/q/12821047/1076463) – Robin Oct 11 '12 at 11:01
  • @Robin :) No and although the approach is interesting. It would not help us in this case as we cannot control the runtimes of the people who download the applet. – Cetin Sert Oct 11 '12 at 11:05

1 Answers1

2

You can use a Java decompiler like JD or JAD to obtain a decompiled source code, then solve the problem in code and recompile your class. You need to decompile the code, not only show it.

PD: If he is your friend, you can get the source code, isn't it? It would be easier...

logoff
  • 3,347
  • 5
  • 41
  • 58
  • The decompiled source code depends on a large number of other files. My friend is on vacation with no access to source files in the near future o__O – Cetin Sert Oct 11 '12 at 11:01
  • 1
    if you can decompile it, you can recompile it. you have all the class files. – logoff Oct 11 '12 at 11:04
  • does a `.jar` file not depend on any external, in .NET parlance, 'assemblies'? – Cetin Sert Oct 11 '12 at 11:20
  • a JAR can depend on external resources, obviously. but it is not related with the decompilation and the recompilation. why do you ask it? – logoff Oct 11 '12 at 11:32