JDK-8033686 : Internal error for zero indent
  • Type: Bug
  • Component: tools
  • Sub-Component: javap
  • Affected Version: 8
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2014-02-05
  • Updated: 2014-07-29
  • Resolved: 2014-02-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u20Fixed 9 b04Fixed
Description
An attempt to set the indent to zero ("-XDindent:0 -v") leads to the crash while writing "Code" section:

....
public StructureSampleClass();
descriptor: ()V
flags: ACC_PUBLIC
Code:
stack=2, locals=1, args_size=1
Error: A serious internal error has occurred: java.lang.ArithmeticException: / b
y zero
Please file a bug report, and include the following information:
java.lang.ArithmeticException: / by zero
        at com.sun.tools.javap.CodeWriter.writeInstr(CodeWriter.java:125)
        at com.sun.tools.javap.CodeWriter.writeInstrs(CodeWriter.java:108)
        at com.sun.tools.javap.CodeWriter.write(CodeWriter.java:75)
        at com.sun.tools.javap.AttributeWriter.visitCode(AttributeWriter.java:21
9)
        at com.sun.tools.javap.AttributeWriter.visitCode(AttributeWriter.java:74
)
        at com.sun.tools.classfile.Code_attribute.accept(Code_attribute.java:102
)
        at com.sun.tools.javap.AttributeWriter.write(AttributeWriter.java:100)
        at com.sun.tools.javap.ClassWriter.writeMethod(ClassWriter.java:519)
        at com.sun.tools.javap.ClassWriter.writeMethods(ClassWriter.java:408)
        at com.sun.tools.javap.ClassWriter.write(ClassWriter.java:219)
        at com.sun.tools.javap.JavapTask.write(JavapTask.java:814)
        at com.sun.tools.javap.JavapTask.writeClass(JavapTask.java:636)
        at com.sun.tools.javap.JavapTask.run(JavapTask.java:590)
        at com.sun.tools.javap.JavapTask.run(JavapTask.java:455)
        at com.sun.tools.javap.Main.main(Main.java:46)
Comments
Should just ignore invalid values, i.e. <= 0
05-02-2014

Not a P2, since you need to use unsupported API or options to provoke the bug. Still should be fixed.
05-02-2014