The code attribute length when dumped is not updated, and as such will write the old size of the attribute should the size of the actual byte code change.
A possible fix is adding:
to the first line of:
org.apache.bcel.classfile.Code.dump(DataOutputStream) throws IOException
When trying to execute code that has this error, it throws a ClassFormatException, Wrong code segment length (Should there be no other formatting errors with the code).