[jaxp] TransformerTest fails due to InstructionComparator gap

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 27
    • Component/s: xml
    • None

      An experimental change to HashMap exposed a deficiency in the transform InstructionComparator .equals method.
      The change in HashMap was to remove the `==` test of a key with an entry, relying on the .equals method of InstructionComparator to return true when comparing an Instruction to itself.
      However, InstructionComparator.equals method does not satisfy the requirements of the contract for .equals.

      The BCEL-195 issue has some discussion of the rationale, however, they missed the important case needed by HashMap that an instance must be .equal to itself. To be used with HashMap all instructions must be equal to themselves.

      The test failure as seen is:

      11:20:15.784] test transform.TransformerTest$Test8169112.run(): failure [98ms]
      javax.xml.transform.TransformerConfigurationException: Not targeting 66542: nop[0](1), but null
      at java.xml/com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:1067)
      at java.xml/com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:824)
      at transform.util.TransformerTestTemplate.getTransformer(TransformerTestTemplate.java:135)
      at transform.util.TransformerTestTemplate.getTransformer(TransformerTestTemplate.java:121)
      at transform.TransformerTest$Test8169112.run(TransformerTest.java:584)
      at java.base/
      ...

      Caused by: com.sun.org.apache.bcel.internal.generic.ClassGenException: Not targeting 66542: nop[0](1), but null
      at java.xml/com.sun.org.apache.bcel.internal.generic.BranchInstruction.updateTarget(BranchInstruction.java:273)
      at java.xml/com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator.outline(MethodGenerator.java:1698)
      at java.xml/com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator.outlineChunks(MethodGenerator.java:1145)
      at java.xml/com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator.getGeneratedMethods(MethodGenerator.java:1859)
      at java.xml/com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator.addMethod(ClassGenerator.java:137)
      at java.xml/com.sun.org.apache.xalan.internal.xsltc.compiler.Mode.compileNamedTemplate(Mode.java:539)
      at java.xml/com.sun.org.apache.xalan.internal.xsltc.compiler.Mode.compileTemplates(Mode.java:548)
      at java.xml/com.sun.org.apache.xalan.internal.xsltc.compiler.Mode.compileApplyTemplates(Mode.java:807)
      at java.xml/com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.compileModes(Stylesheet.java:622)
      at java.xml/com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.translate(Stylesheet.java:735)
      at java.xml/com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.java:509)
      at java.xml/com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.java:579)
      at java.xml/com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:1026)

            Assignee:
            Unassigned
            Reporter:
            Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: