JDK-4071592 : java.io.UTFDataFormatException raised by javac
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 1.1.3,1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5.1,solaris_2.6
  • CPU: sparc
  • Submitted: 1997-08-13
  • Updated: 2000-02-02
  • Resolved: 2000-02-02
Related Reports
Duplicate :  
Relates :  
Description
while trying workaround for bug#4071527,
$ javac -J-oss64m a.java
java.io.UTFDataFormatException
        at java.io.DataOutputStream.writeUTF(DataOutputStream.java)
        at sun.tools.asm.StringConstantData.write(StringConstantData.java)
        at sun.tools.asm.ConstantPool.write(ConstantPool.java)
        at sun.tools.javac.SourceClass.compileClass(SourceClass.java)
        at sun.tools.javac.SourceClass.compile(SourceClass.java)
        at sun.tools.javac.Main.compile(Main.java)
        at sun.tools.javac.Main.main(Main.java)
error: An exception has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
1 error

Comments
WORK AROUND Don't use strings too long to be represented (that is, that will result in more than 64k bytes in the UTF-8 encoding described in the VM spec section 4.4.7).
11-06-2004

EVALUATION java.io.DataOutputStream.writeUTF throws a java.io.UTFDataFormatException when the string to be encoded is too long. This is a limitation of the VM format. This exception should be caught and a nice message given to explain why compilation is failing. david.stoutamire@Eng 1997-08-26
26-08-1997