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

XSLT transforms broken in Turkish locale in JDK 1.5.0+

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 1.4.0
    • Component/s: xml
    • Labels:

      Description

      Compile and run the following program, a bare-bones usage of XSLT transforms:

      ---%<---
      import java.io.StringReader;
      import java.util.Locale;
      import javax.xml.parsers.DocumentBuilderFactory;
      import javax.xml.transform.Source;
      import javax.xml.transform.Transformer;
      import javax.xml.transform.TransformerFactory;
      import javax.xml.transform.dom.DOMSource;
      import javax.xml.transform.stream.StreamResult;
      import javax.xml.transform.stream.StreamSource;
      import org.w3c.dom.Document;
      public class TestTurkishXSLT {
          public static void main(String[] args) throws Exception {
              Locale.setDefault(new Locale("tr", "TR"));
              String xslt =
                  "<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform&#39;>\n" +
                  " <xsl:output method='xml' indent='yes' omit-xml-declaration='yes'/>\n" +
                  " <xsl:template match='/'>\n" +
                  " <hello/>\n" +
                  " </xsl:template>\n" +
                  "</xsl:stylesheet>";
              Source source = new StreamSource(new StringReader(xslt));
              Transformer t = TransformerFactory.newInstance().newTransformer(source);
              Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation().createDocument(null, "x", null);
              t.transform(new DOMSource(doc), new StreamResult(System.out));
          }
      }
      ---%<---

      Results under JDK 1.4.2 are as expected:

      ---%<---
      $ /space/jdk1.4/bin/java -showversion -cp /tmp/test-turkish-xslt/build/classes TestTurkishXSLT
      java version "1.4.2_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
      Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)

      <hello/>
      ---%<---

      However under JDK 1.5 (or later), it is broken:

      ---%<---
      $ /space/jdk1.5/bin/java -showversion -cp /tmp/test-turkish-xslt/build/classes TestTurkishXSLT
      java version "1.5.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
      Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode)

      java.lang.RuntimeException: Instruction unknown: load<<<DOTLESS-i>>>nstruction
      at com.sun.org.apache.bcel.internal.util.InstructionFinder.mapName(InstructionFinder.java:138)
      at com.sun.org.apache.bcel.internal.util.InstructionFinder.compilePattern(InstructionFinder.java:170)
      at com.sun.org.apache.bcel.internal.util.InstructionFinder.search(InstructionFinder.java:218)
      at com.sun.org.apache.bcel.internal.util.InstructionFinder.search(InstructionFinder.java:264)
      at com.sun.org.apache.xalan.internal.xsltc.compiler.Mode.peepHoleOptimization(Mode.java:1444)
      at com.sun.org.apache.xalan.internal.xsltc.compiler.Mode.compileApplyTemplates(Mode.java:1058)
      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 TestTurkishXSLT.main(TestTurkishXSLT.java:22)
      ERROR: 'Instruction unknown: load<<<DOTLESS-i>>>nstruction
      FATAL ERROR: 'Could not compile stylesheet'
      Exception in thread "main" 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)
      at TestTurkishXSLT.main(TestTurkishXSLT.java:22)
      ---%<---

      Here <<<DOTLESS-i>>> is the Turkish lowercase dotless 'i'.

      Removing the call to Locale.setDefault, or using e.g. fr_FR, does not exhibit any bug; only Turkish locale.
      ###@###.### 2005-03-15 18:46:27 GMT

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                duke J. Duke (Inactive)
                Reporter:
                jglick Jesse Glick (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: