Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8162608

XSLT Extension Functions Don't Work in WebStart

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 7
    • deploy
    • x86
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.7.0_07"
      Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
      Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      C:\Users\Ryan\Documents\NetBeansProjects\TestJava23XsltBug\dist>ver

       customer Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      A DESCRIPTION OF THE PROBLEM :
      Java 1.7.0_7 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.7.0_7 via command line. Note that the error message is mistaken regarding whether the extension function is static vs. non-static.

      This is a regression as the application (executed via Java Web Start) behaves correctly in Java 1.7.0_5.

      This appears to be the same issue as bug id: 7167657. However, I cannot edit that bug to add the additional information that it is now present in the latest Java 7 release. This is why I am reporting a new bug.


      REGRESSION. Last worked in version 7

      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.7.0_7 and observe the correct execution under 1.7.0_5.

      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 10.7.2.10
      Using JRE version 1.7.0_07-b10 Java HotSpot(TM) 64-Bit Server 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 customer reference.'
      FATAL ERROR: 'Could not compile stylesheet'


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      ---------- 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 ----------

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Work around is to direct our customers to fall-back to Java 1.7.0_5; however customers are not happy with that solution due to the security concerns with that version.

            dbuck David Buck
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: