DO NOT REPLY [Bug 28069] New: - BCEL ClassParser throws ClassFormatException on Chinese locale class file

[email protected]
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28069>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28069

BCEL ClassParser throws ClassFormatException on Chinese locale class file

           Summary: BCEL ClassParser throws ClassFormatException on Chinese
                    locale class file
           Product: BCEL
           Version: 5.1
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Main
        AssignedTo: [email protected]
        ReportedBy: [email protected]


I get the following exception when I have the BCEL ClassParser parse a 
particular class file.

org.apache.bcel.classfile.ClassFormatException: Invalid byte tag in constant 
pool: 60
	at org.apache.bcel.classfile.Constant.readConstant(Constant.java:145)
	at org.apache.bcel.classfile.ConstantPool.<init>(ConstantPool.java:103)
	at org.apache.bcel.classfile.ClassParser.readConstantPool
(ClassParser.java:254)
	at org.apache.bcel.classfile.ClassParser.parse(ClassParser.java:162)
	at Test.main(Test.java:13)

Here is a little test class that I use to reproduce the error:

import org.apache.bcel.classfile.ClassParser;
import org.apache.bcel.classfile.JavaClass;
public class Test
{
	public static void main(String[] args)
	{
		try
		{
			ClassParser parser = new ClassParser(args[0]);
			JavaClass jc = parser.parse();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}

The exception occurs when it attempts to parse the 
LocaleElements_zh__PINYIN.class, which is a Chinese locale file found inside 
the icu4j.jar file... a jar that is part of the Jena distribution.

If you run the above test program with the argument of 
LocaleElements_zh__PINYIN.class as the first and only argument, you reproduce 
the exception. And, as I mentioned above, this class file can be found inside 
icu4j.jar. Go to the following web site to obtain the Jena distribution, which 
has the icu4j.jar file inside the lib/ directory:
http://prdownloads.sourceforge.net/jena/Jena-2.1.zip?download

The odd thing is, all of the other chinese (zh) files do not throw the 
exception... only the PINYIN file.

This bug occurred with BCEL version 5.1 running on Windows XP Professional: 
Version 2002, Service Pack 1.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.