JDK-6559347 : Request to include Xalan (XSLTC) version 2.7.0 in the next release of Java
  • Type: Enhancement
  • Component: xml
  • Sub-Component: javax.xml.transform
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Future Project
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-05-18
  • Updated: 2012-04-25
  • Resolved: 2009-09-02
Related Reports
Relates :  
Description
Whilst loading an XSLT containing a large number of statements in an optionally executable block (<xsl:for-each>, <xsl:if> or <xsl:when>) the following Exception is thrown:  
com.sun.org.apache.bcel.internal.generic.ClassGenException: Branch target offset too large for short at  com.sun.org.apache.bcel.internal.generic.BranchInstruction.dump(BranchInstruction.java:99) at com.sun.org.apache.bcel.internal.generic.InstructionList.getByteCode(InstructionList.java:980) 
at com.sun.org.apache.bcel.internal.generic.MethodGen.getMethod(MethodGen.java:587) 
at com.sun.org.apache.xalan.internal.xsltc.compiler.Mode.compileNamedTemplate(Mode.java:581) 
at com.sun.org.apache.xalan.internal.xsltc.compiler.Mode.compileTemplates(Mode.java:591) 
at com.sun.org.apache.xalan.internal.xsltc.compiler.Mode.compileApplyTemplates(Mode.java:843) at com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.compileModes(Stylesheet.java:615) 
at com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.translate(Stylesheet.java:730) at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.java:335) 
at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.java:410) 
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:791) 
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:619) 
at com.swift.translate.engine.Engine.translate(Engine.java:115) 
at com.swift.translate.engine.Engine.translate(Engine.java:103) 
at com.swift.translate.engine.Engine.main(Engine.java:189) 
Error: javax.xml.transform.TransformerException: Branch target offset too large for short 
javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet 
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:824) 
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:619)  
... 
This problem arises when using the default XSLT implementation packaged with Sun JRE 1.5.0_10, 1.5.0_11 or 1.6.0.  
Note that the problem is registered as type 'bug' with priority 'blocker' with the Apache Xalan project. This issue was fixed in April 2006. The fix is part of Xalan version 2.7.0. Full details of the bug can be found at http://issues.apache.org/jira/browse/XALANJ-1324.  
 
Problem Reproducer  
A sample Java class, XSLT and XML with which the problem can be reproduced are attached. To get this example to run, simply copy all three attached files to a local directory; open a command prompt and change to the directory where the files were copied; compile the Java file using the command "javac Transform.java"; finally, run the program using the command "java -cp . Transform". The stack trace listed above was given by Sun JRE using the default XSLT implementation. 

 To deploy a workaround in our own code is a massive undertaking because it would have to be redeployed to all our customers, who in turn would have to rebuild some of their own
applications. It makes more sense for our customers to upgrade to a
later JRE that incorporates the later Xalan version. Logistically it's
much simpler and cleaner. Also, from a Sun business perspective I
believe it also makes sense to upgrade the Xalan version in Java.

Comments
EVALUATION The user had filed the following issue as a precondition for this request: http://issues.apache.org/jira/browse/XALANJ-2404 The issue has not been fixed. Furthermore, updating to later or current releases of XSLTC, and for that matter, Xerces, will depend on the approval of future JAXP project.
02-09-2009