AngryCarrot789 / BCEdit180

A java class file viewer and editor, written in C#. Similar to jclasslib but supports extra features such as copy and paste bytecode between methods

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix "Extra bytes at end of class file org/objectweb/asm/ClassReader"

AngryCarrot789 opened this issue · comments

Caused by: java.lang.ClassFormatError: Extra bytes at the end of class file org/objectweb/asm/ClassReader
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)

Even if no modifications are made, if you just open the ClassReader file from the asm-all-4.1 library, save, and place it back into the .jar file and try to load the class, you may get this error

I have no idea what's causing it... it could possibly be the exception table or local variable table

Fixed: it was caused by local variable table entries being stored in a dictionary, and due to some entries having duplicate indexes, they would be lost. Replacing the dictionaries with a list fixed it