Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
Originally filed as CR 7167657 under java_incidents : javawebstart category FULL PRODUCT VERSION : java version "1.6.0_32" Java(TM) SE Runtime Environment (build 1.6.0_32-b05) Java HotSpot(TM) Client VM (build 20.7-b02, mixed mode, sharing) ADDITIONAL OS VERSION INFORMATION : C:\Users\Ryan\Documents\NetBeansProjects\TestJava23XsltBug\dist>ver Microsoft Windows [Version 6.1.7601] A DESCRIPTION OF THE PROBLEM : Java 1.6.0_32 fails to compile an XSLT which calls a static Java method with the error message mentioned below when the application is run via Java Web Start. The application executes correctly under 1.6.0_32 via command line. Note that the error message is mistaken regarding whether the extension function is state vs. non-static. This is a regression as the application (executed via Java Web Start) behaves correctly in Java 1.6.0_31. REGRESSION. Last worked in version 6u31 STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Compile and run the application included in the source code via Java Web Start. Observe the error message generated when running under 1.6.0_32 and observe the correct execution under 1.6.0_31. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The application is expected to execute correctly and to transform the XML document with the XSLT. The expected output to the Java Console window is below. ---------------------------------------------------- <html xmlns:ext="com.test.Test"> <body>one two</body> </html> ACTUAL - Instead, the application reports an error to the Java Console Window when it compiles the XSLT. ERROR MESSAGES/STACK TRACES THAT OCCUR : Java Web Start 1.6.0_32 Using JRE version 1.6.0_32-b05 Java HotSpot(TM) Client VM User home directory = C:\Users\Ryan ---------------------------------------------------- c: clear console window f: finalize objects on finalization queue g: garbage collect h: display this help message m: print memory usage o: trigger logging p: reload proxy configuration q: hide console r: reload policy configuration s: dump system and deployment properties t: dump thread list v: dump thread stack 0-5: set trace level to <n> ---------------------------------------------------- ERROR: 'The first argument to the non-static Java function 'append' is not a valid object reference.' FATAL ERROR: 'Could not compile stylesheet' javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(Unknown Source) at com.test.Test.main(Test.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.sun.javaws.Launcher.executeApplication(Unknown Source) at com.sun.javaws.Launcher.executeMainClass(Unknown Source) at com.sun.javaws.Launcher.doLaunchApp(Unknown Source) at com.sun.javaws.Launcher.run(Unknown Source) at java.lang.Thread.run(Unknown Source) REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- package com.test; import java.io.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; public class Test { private Test() {} private static final String XML = "<test></test>"; private static final String XSLT = "<?xml version=\"1.0\"?>" + "<xsl:stylesheet version=\"0\"" + " xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"" + " xmlns:ext=\"com.test.Test\">" + "<xsl:template match=\"/\">" + " <html>" + " <body>" + " <xsl:value-of select=\"ext:append('one','two')\"/>" + " </body>" + " </html>" + "</xsl:template>" + "</xsl:stylesheet>"; public static void main( String[] args ) { try { TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer( new StreamSource( new StringReader( XSLT ) ) ); Source xml_source = new StreamSource( new StringReader( XML ) ); StringWriter output = new StringWriter(); transformer.transform( xml_source, new StreamResult( output ) ); System.out.println( output.toString() ); } catch( Throwable t ) { t.printStackTrace( System.err ); } } public static String append( String one, String two ) { StringBuilder buffer = new StringBuilder( one.length() + two.length() + 1 ); buffer.append( one ); buffer.append( ' ' ); buffer.append( two ); return buffer.toString(); } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : Work around is to direct our customers to fall-back to Java 1.6.0_31 *** (#1 of 1): 2012-05-09 13:31:35 PDT webbug-group@sun.com
|