1

I have generated two java bytecode files 1.class and 2.class, they are different if using hex file viewer inspect them:

enter image description here

However the decompiled p-code are all the same:

I can also use jd-gui to decompile them into Java source code and again the two byte code files generate exactly the same Java source code:

enter image description here

So it looks all good, however when I load the two copies of bytecode into class loader, the 1.class copy gives me the following errors:

enter image description here

Anyone has any clue?

Gelin Luo
  • 14,035
  • 27
  • 86
  • 139
  • Execute `javap -c -l 1.class` and check if all entries in the LineNumberTable are pointing to a valid bytecode index. You could even do a diff with the output from 2.class. This should show you the differences. – SubOptimal Jan 27 '15 at 09:41
  • @SubOptimal yes you are right. I did that and captured the differences. Strange that ASM bytecode outline view didn't give me the information – Gelin Luo Jan 28 '15 at 20:32

1 Answers1

3

If you print out line number information using javap -l, you can find that 2.class has the following line number table for doIt(String, String, AppContext):

LineNumberTable:
  line 56: 0
  line 57: 11
  line 58: 19
  line 60: 23
  line 61: 65

According to this, line number 61 links to byte code index 65 while the same method is only defined by altogether 64 byte. Accordingly, this table cannot be correct and a validator error is thrown.

Rafael Winterhalter
  • 42,759
  • 13
  • 108
  • 192
  • Exactly I captured that also, and now the issue is fixed by removing the LINE NUMBER instruction prior to the RETURN instruction – Gelin Luo Jan 28 '15 at 20:31