You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Thorsten Scherler (JIRA)" <xa...@xml.apache.org> on 2008/10/17 14:27:44 UTC

[jira] Created: (XALANJ-2460) NPE when using xsl:sort that contains xmlns:xsl

NPE when using xsl:sort that contains xmlns:xsl
-----------------------------------------------

                 Key: XALANJ-2460
                 URL: https://issues.apache.org/jira/browse/XALANJ-2460
             Project: XalanJ2
          Issue Type: Bug
      Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects.  Anybody can view the issue.)
          Components: transformation
    Affects Versions: 2.7.1
            Reporter: Thorsten Scherler


I have a weird problem with xsl:sort, as soon as I use it within an 
apply-templates tag xalan will throw a npe if the xsl:sort element contains xmlns:xsl. 

Input:

sort.xml
*********
<root>
  <child prioridad="2">
    2
  </child>
  <child prioridad="3">
    3
  </child>
  <child prioridad="1">
    1
  </child>
  <child prioridad="5">
    5
  </child>
  <child prioridad="4">
    4
  </child>
</root>

-----------------

XSL that will show the bug:
1) sort.xsl
*********
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
      <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
match="/">
        <forrest:content
xmlns:forrest="http://apache.org/forrest/templates/1.0">
          <forrest:part
xmlns:forrest="http://apache.org/forrest/templates/1.0">
            <xsl:apply-templates
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />
          </forrest:part>
        </forrest:content>
      </xsl:template>
      <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
match="root">
         <xsl:apply-templates
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" select="child">
           <xsl:sort xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
select="@prioridad" data-type="number" />
         </xsl:apply-templates>
      </xsl:template>
    </xsl:stylesheet>

-----------------

Same xsl but removed the superfluous ns declaration:
2) sort.xsl
**********************************************************
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
      <xsl:template match="/">
        <forrest:content
xmlns:forrest="http://apache.org/forrest/templates/1.0">
          <forrest:part>
            <xsl:apply-templates />
          </forrest:part>
        </forrest:content>
      </xsl:template>
      <xsl:template match="root">
         <xsl:apply-templates select="child">
           <xsl:sort select="@prioridad" data-type="number" />
         </xsl:apply-templates>
      </xsl:template>
    </xsl:stylesheet>

-----------------

The 1) one will throw an error (will attach it in a separate comment) the 2) is working just fine.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Resolved: (XALANJ-2460) NPE when using xsl:sort that contains xmlns:xsl

Posted by "Henry Zongaro (JIRA)" <xa...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XALANJ-2460?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henry Zongaro resolved XALANJ-2460.
-----------------------------------

    Resolution: Duplicate

This appears to be a duplicate of XALANJ-2301.  That bug report contains a one-line patch (supplied inline in the text of the bug report).

> NPE when using xsl:sort that contains xmlns:xsl
> -----------------------------------------------
>
>                 Key: XALANJ-2460
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2460
>             Project: XalanJ2
>          Issue Type: Bug
>      Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects.  Anybody can view the issue.) 
>          Components: transformation
>    Affects Versions: 2.7.1
>            Reporter: Thorsten Scherler
>
> I have a weird problem with xsl:sort, as soon as I use it within an 
> apply-templates tag xalan will throw a npe if the xsl:sort element contains xmlns:xsl. 
> Input:
> sort.xml
> *********
> <root>
>   <child prioridad="2">
>     2
>   </child>
>   <child prioridad="3">
>     3
>   </child>
>   <child prioridad="1">
>     1
>   </child>
>   <child prioridad="5">
>     5
>   </child>
>   <child prioridad="4">
>     4
>   </child>
> </root>
> -----------------
> XSL that will show the bug:
> 1) sort.xsl
> *********
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>       <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> match="/">
>         <forrest:content
> xmlns:forrest="http://apache.org/forrest/templates/1.0">
>           <forrest:part
> xmlns:forrest="http://apache.org/forrest/templates/1.0">
>             <xsl:apply-templates
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />
>           </forrest:part>
>         </forrest:content>
>       </xsl:template>
>       <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> match="root">
>          <xsl:apply-templates
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" select="child">
>            <xsl:sort xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> select="@prioridad" data-type="number" />
>          </xsl:apply-templates>
>       </xsl:template>
>     </xsl:stylesheet>
> -----------------
> Same xsl but removed the superfluous ns declaration:
> 2) sort.xsl
> **********************************************************
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>       <xsl:template match="/">
>         <forrest:content
> xmlns:forrest="http://apache.org/forrest/templates/1.0">
>           <forrest:part>
>             <xsl:apply-templates />
>           </forrest:part>
>         </forrest:content>
>       </xsl:template>
>       <xsl:template match="root">
>          <xsl:apply-templates select="child">
>            <xsl:sort select="@prioridad" data-type="number" />
>          </xsl:apply-templates>
>       </xsl:template>
>     </xsl:stylesheet>
> -----------------
> The 1) one will throw an error (will attach it in a separate comment) the 2) is working just fine.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2460) NPE when using xsl:sort that contains xmlns:xsl

Posted by "Thorsten Scherler (JIRA)" <xa...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XALANJ-2460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12640509#action_12640509 ] 

Thorsten Scherler commented on XALANJ-2460:
-------------------------------------------

Stack:

8790 [main] FATAL org.apache.forrest.dispatcher.TestStructurer
(LoggingErrorListener.java:57)  - java.lang.NullPointerException
javax.xml.transform.TransformerException: java.lang.NullPointerException
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:952)
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:776)
        at
org.apache.forrest.dispatcher.impl.helper.XSLContractHelper.prepareTransformation(XSLContractHelper.java:75)
        at
org.apache.forrest.dispatcher.impl.XSLContract.execute(XSLContract.java:67)
        at
org.apache.forrest.dispatcher.impl.XSLContract.execute(XSLContract.java:1)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.processContract(XMLStructurer.java:242)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.processStructure(XMLStructurer.java:139)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.execute(XMLStructurer.java:90)
        at
org.apache.forrest.dispatcher.TestStructurer.testStructurer(TestStructurer.java:15)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:168)
        at junit.framework.TestCase.runBare(TestCase.java:134)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:124)
        at junit.framework.TestSuite.runTest(TestSuite.java:232)
        at junit.framework.TestSuite.run(TestSuite.java:227)
        at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
        at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
        at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.NullPointerException
        at
org.apache.xalan.templates.ElemTemplateElement.getStylesheetRoot(ElemTemplateElement.java:174)
        at
org.apache.xalan.templates.ElemTemplateElement.resolvePrefixTables(ElemTemplateElement.java:1040)
        at
org.apache.xalan.templates.ElemTemplateElement.compose(ElemTemplateElement.java:193)
        at org.apache.xalan.templates.ElemSort.compose(ElemSort.java:335)
        at org.apache.xalan.templates.ElemForEach.compose(ElemForEach.java:138)
        at
org.apache.xalan.templates.ElemCallTemplate.compose(ElemCallTemplate.java:115)
        at
org.apache.xalan.templates.ElemApplyTemplates.compose(ElemApplyTemplates.java:129)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:361)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:366)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:366)
        at
org.apache.xalan.templates.StylesheetRoot.recompose(StylesheetRoot.java:341)
        at
org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:471)
        at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown
Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown
Source)
        at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl
$TrailingMiscDispatcher.dispatch(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:922)
        ... 27 more
---------
java.lang.NullPointerException
        at
org.apache.xalan.templates.ElemTemplateElement.getStylesheetRoot(ElemTemplateElement.java:174)
        at
org.apache.xalan.templates.ElemTemplateElement.resolvePrefixTables(ElemTemplateElement.java:1040)
        at
org.apache.xalan.templates.ElemTemplateElement.compose(ElemTemplateElement.java:193)
        at org.apache.xalan.templates.ElemSort.compose(ElemSort.java:335)
        at org.apache.xalan.templates.ElemForEach.compose(ElemForEach.java:138)
        at
org.apache.xalan.templates.ElemCallTemplate.compose(ElemCallTemplate.java:115)
        at
org.apache.xalan.templates.ElemApplyTemplates.compose(ElemApplyTemplates.java:129)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:361)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:366)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:366)
        at
org.apache.xalan.templates.StylesheetRoot.recompose(StylesheetRoot.java:341)
        at
org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:471)
        at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown
Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown
Source)
        at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl
$TrailingMiscDispatcher.dispatch(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:922)
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:776)
        at
org.apache.forrest.dispatcher.impl.helper.XSLContractHelper.prepareTransformation(XSLContractHelper.java:75)
        at
org.apache.forrest.dispatcher.impl.XSLContract.execute(XSLContract.java:67)
        at
org.apache.forrest.dispatcher.impl.XSLContract.execute(XSLContract.java:1)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.processContract(XMLStructurer.java:242)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.processStructure(XMLStructurer.java:139)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.execute(XMLStructurer.java:90)
        at
org.apache.forrest.dispatcher.TestStructurer.testStructurer(TestStructurer.java:15)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:168)
        at junit.framework.TestCase.runBare(TestCase.java:134)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:124)
        at junit.framework.TestSuite.runTest(TestSuite.java:232)
        at junit.framework.TestSuite.run(TestSuite.java:227)
        at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
        at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
        at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
8810 [main] FATAL org.apache.forrest.dispatcher.TestStructurer
(LoggingErrorListener.java:57)  -
javax.xml.transform.TransformerException: java.lang.NullPointerException
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException: java.lang.NullPointerException
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:961)
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:776)
        at
org.apache.forrest.dispatcher.impl.helper.XSLContractHelper.prepareTransformation(XSLContractHelper.java:75)
        at
org.apache.forrest.dispatcher.impl.XSLContract.execute(XSLContract.java:67)
        at
org.apache.forrest.dispatcher.impl.XSLContract.execute(XSLContract.java:1)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.processContract(XMLStructurer.java:242)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.processStructure(XMLStructurer.java:139)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.execute(XMLStructurer.java:90)
        at
org.apache.forrest.dispatcher.TestStructurer.testStructurer(TestStructurer.java:15)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:168)
        at junit.framework.TestCase.runBare(TestCase.java:134)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:124)
        at junit.framework.TestSuite.runTest(TestSuite.java:232)
        at junit.framework.TestSuite.run(TestSuite.java:227)
        at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
        at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
        at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: javax.xml.transform.TransformerException:
java.lang.NullPointerException
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:952)
        ... 27 more
Caused by: java.lang.NullPointerException
        at
org.apache.xalan.templates.ElemTemplateElement.getStylesheetRoot(ElemTemplateElement.java:174)
        at
org.apache.xalan.templates.ElemTemplateElement.resolvePrefixTables(ElemTemplateElement.java:1040)
        at
org.apache.xalan.templates.ElemTemplateElement.compose(ElemTemplateElement.java:193)
        at org.apache.xalan.templates.ElemSort.compose(ElemSort.java:335)
        at org.apache.xalan.templates.ElemForEach.compose(ElemForEach.java:138)
        at
org.apache.xalan.templates.ElemCallTemplate.compose(ElemCallTemplate.java:115)
        at
org.apache.xalan.templates.ElemApplyTemplates.compose(ElemApplyTemplates.java:129)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:361)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:366)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:366)
        at
org.apache.xalan.templates.StylesheetRoot.recompose(StylesheetRoot.java:341)
        at
org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:471)
        at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown
Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown
Source)
        at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl
$TrailingMiscDispatcher.dispatch(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:922)
        ... 27 more
---------
javax.xml.transform.TransformerException: java.lang.NullPointerException
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:952)
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:776)
        at
org.apache.forrest.dispatcher.impl.helper.XSLContractHelper.prepareTransformation(XSLContractHelper.java:75)
        at
org.apache.forrest.dispatcher.impl.XSLContract.execute(XSLContract.java:67)
        at
org.apache.forrest.dispatcher.impl.XSLContract.execute(XSLContract.java:1)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.processContract(XMLStructurer.java:242)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.processStructure(XMLStructurer.java:139)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.execute(XMLStructurer.java:90)
        at
org.apache.forrest.dispatcher.TestStructurer.testStructurer(TestStructurer.java:15)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:168)
        at junit.framework.TestCase.runBare(TestCase.java:134)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:124)
        at junit.framework.TestSuite.runTest(TestSuite.java:232)
        at junit.framework.TestSuite.run(TestSuite.java:227)
        at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
        at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
        at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.NullPointerException
        at
org.apache.xalan.templates.ElemTemplateElement.getStylesheetRoot(ElemTemplateElement.java:174)
        at
org.apache.xalan.templates.ElemTemplateElement.resolvePrefixTables(ElemTemplateElement.java:1040)
        at
org.apache.xalan.templates.ElemTemplateElement.compose(ElemTemplateElement.java:193)
        at org.apache.xalan.templates.ElemSort.compose(ElemSort.java:335)
        at org.apache.xalan.templates.ElemForEach.compose(ElemForEach.java:138)
        at
org.apache.xalan.templates.ElemCallTemplate.compose(ElemCallTemplate.java:115)
        at
org.apache.xalan.templates.ElemApplyTemplates.compose(ElemApplyTemplates.java:129)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:361)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:366)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:366)
        at
org.apache.xalan.templates.StylesheetRoot.recompose(StylesheetRoot.java:341)
        at
org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:471)
        at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown
Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown
Source)
        at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl
$TrailingMiscDispatcher.dispatch(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:922)
        ... 27 more
---------
java.lang.NullPointerException
        at
org.apache.xalan.templates.ElemTemplateElement.getStylesheetRoot(ElemTemplateElement.java:174)
        at
org.apache.xalan.templates.ElemTemplateElement.resolvePrefixTables(ElemTemplateElement.java:1040)
        at
org.apache.xalan.templates.ElemTemplateElement.compose(ElemTemplateElement.java:193)
        at org.apache.xalan.templates.ElemSort.compose(ElemSort.java:335)
        at org.apache.xalan.templates.ElemForEach.compose(ElemForEach.java:138)
        at
org.apache.xalan.templates.ElemCallTemplate.compose(ElemCallTemplate.java:115)
        at
org.apache.xalan.templates.ElemApplyTemplates.compose(ElemApplyTemplates.java:129)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:361)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:366)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:366)
        at
org.apache.xalan.templates.StylesheetRoot.recompose(StylesheetRoot.java:341)
        at
org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:471)
        at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown
Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown
Source)
        at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl
$TrailingMiscDispatcher.dispatch(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:922)
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:776)
        at
org.apache.forrest.dispatcher.impl.helper.XSLContractHelper.prepareTransformation(XSLContractHelper.java:75)
        at
org.apache.forrest.dispatcher.impl.XSLContract.execute(XSLContract.java:67)
        at
org.apache.forrest.dispatcher.impl.XSLContract.execute(XSLContract.java:1)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.processContract(XMLStructurer.java:242)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.processStructure(XMLStructurer.java:139)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.execute(XMLStructurer.java:90)
        at
org.apache.forrest.dispatcher.TestStructurer.testStructurer(TestStructurer.java:15)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:168)
        at junit.framework.TestCase.runBare(TestCase.java:134)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:124)
        at junit.framework.TestSuite.runTest(TestSuite.java:232)
        at junit.framework.TestSuite.run(TestSuite.java:227)
        at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
        at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
        at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
---------
java.lang.NullPointerException
        at
org.apache.xalan.templates.ElemTemplateElement.getStylesheetRoot(ElemTemplateElement.java:174)
        at
org.apache.xalan.templates.ElemTemplateElement.resolvePrefixTables(ElemTemplateElement.java:1040)
        at
org.apache.xalan.templates.ElemTemplateElement.compose(ElemTemplateElement.java:193)
        at org.apache.xalan.templates.ElemSort.compose(ElemSort.java:335)
        at org.apache.xalan.templates.ElemForEach.compose(ElemForEach.java:138)
        at
org.apache.xalan.templates.ElemCallTemplate.compose(ElemCallTemplate.java:115)
        at
org.apache.xalan.templates.ElemApplyTemplates.compose(ElemApplyTemplates.java:129)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:361)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:366)
        at
org.apache.xalan.templates.StylesheetRoot.composeTemplates(StylesheetRoot.java:366)
        at
org.apache.xalan.templates.StylesheetRoot.recompose(StylesheetRoot.java:341)
        at
org.apache.xalan.processor.StylesheetHandler.endDocument(StylesheetHandler.java:471)
        at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown
Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown
Source)
        at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl
$TrailingMiscDispatcher.dispatch(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:922)
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:776)
        at
org.apache.forrest.dispatcher.impl.helper.XSLContractHelper.prepareTransformation(XSLContractHelper.java:75)
        at
org.apache.forrest.dispatcher.impl.XSLContract.execute(XSLContract.java:67)
        at
org.apache.forrest.dispatcher.impl.XSLContract.execute(XSLContract.java:1)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.processContract(XMLStructurer.java:242)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.processStructure(XMLStructurer.java:139)
        at
org.apache.forrest.dispatcher.impl.XMLStructurer.execute(XMLStructurer.java:90)
        at
org.apache.forrest.dispatcher.TestStructurer.testStructurer(TestStructurer.java:15)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:168)
        at junit.framework.TestCase.runBare(TestCase.java:134)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:124)
        at junit.framework.TestSuite.runTest(TestSuite.java:232)
        at junit.framework.TestSuite.run(TestSuite.java:227)
        at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
        at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
        at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

> NPE when using xsl:sort that contains xmlns:xsl
> -----------------------------------------------
>
>                 Key: XALANJ-2460
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2460
>             Project: XalanJ2
>          Issue Type: Bug
>      Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects.  Anybody can view the issue.) 
>          Components: transformation
>    Affects Versions: 2.7.1
>            Reporter: Thorsten Scherler
>
> I have a weird problem with xsl:sort, as soon as I use it within an 
> apply-templates tag xalan will throw a npe if the xsl:sort element contains xmlns:xsl. 
> Input:
> sort.xml
> *********
> <root>
>   <child prioridad="2">
>     2
>   </child>
>   <child prioridad="3">
>     3
>   </child>
>   <child prioridad="1">
>     1
>   </child>
>   <child prioridad="5">
>     5
>   </child>
>   <child prioridad="4">
>     4
>   </child>
> </root>
> -----------------
> XSL that will show the bug:
> 1) sort.xsl
> *********
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>       <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> match="/">
>         <forrest:content
> xmlns:forrest="http://apache.org/forrest/templates/1.0">
>           <forrest:part
> xmlns:forrest="http://apache.org/forrest/templates/1.0">
>             <xsl:apply-templates
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />
>           </forrest:part>
>         </forrest:content>
>       </xsl:template>
>       <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> match="root">
>          <xsl:apply-templates
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" select="child">
>            <xsl:sort xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> select="@prioridad" data-type="number" />
>          </xsl:apply-templates>
>       </xsl:template>
>     </xsl:stylesheet>
> -----------------
> Same xsl but removed the superfluous ns declaration:
> 2) sort.xsl
> **********************************************************
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>       <xsl:template match="/">
>         <forrest:content
> xmlns:forrest="http://apache.org/forrest/templates/1.0">
>           <forrest:part>
>             <xsl:apply-templates />
>           </forrest:part>
>         </forrest:content>
>       </xsl:template>
>       <xsl:template match="root">
>          <xsl:apply-templates select="child">
>            <xsl:sort select="@prioridad" data-type="number" />
>          </xsl:apply-templates>
>       </xsl:template>
>     </xsl:stylesheet>
> -----------------
> The 1) one will throw an error (will attach it in a separate comment) the 2) is working just fine.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2460) NPE when using xsl:sort that contains xmlns:xsl

Posted by "Thorsten Scherler (JIRA)" <xa...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XALANJ-2460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12640508#action_12640508 ] 

Thorsten Scherler commented on XALANJ-2460:
-------------------------------------------

java code:
TransformerFactory transFact = TransformerFactory.newInstance();
transformer = transFact.newTransformer(xslSource);

> NPE when using xsl:sort that contains xmlns:xsl
> -----------------------------------------------
>
>                 Key: XALANJ-2460
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2460
>             Project: XalanJ2
>          Issue Type: Bug
>      Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects.  Anybody can view the issue.) 
>          Components: transformation
>    Affects Versions: 2.7.1
>            Reporter: Thorsten Scherler
>
> I have a weird problem with xsl:sort, as soon as I use it within an 
> apply-templates tag xalan will throw a npe if the xsl:sort element contains xmlns:xsl. 
> Input:
> sort.xml
> *********
> <root>
>   <child prioridad="2">
>     2
>   </child>
>   <child prioridad="3">
>     3
>   </child>
>   <child prioridad="1">
>     1
>   </child>
>   <child prioridad="5">
>     5
>   </child>
>   <child prioridad="4">
>     4
>   </child>
> </root>
> -----------------
> XSL that will show the bug:
> 1) sort.xsl
> *********
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>       <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> match="/">
>         <forrest:content
> xmlns:forrest="http://apache.org/forrest/templates/1.0">
>           <forrest:part
> xmlns:forrest="http://apache.org/forrest/templates/1.0">
>             <xsl:apply-templates
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />
>           </forrest:part>
>         </forrest:content>
>       </xsl:template>
>       <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> match="root">
>          <xsl:apply-templates
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" select="child">
>            <xsl:sort xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> select="@prioridad" data-type="number" />
>          </xsl:apply-templates>
>       </xsl:template>
>     </xsl:stylesheet>
> -----------------
> Same xsl but removed the superfluous ns declaration:
> 2) sort.xsl
> **********************************************************
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>       <xsl:template match="/">
>         <forrest:content
> xmlns:forrest="http://apache.org/forrest/templates/1.0">
>           <forrest:part>
>             <xsl:apply-templates />
>           </forrest:part>
>         </forrest:content>
>       </xsl:template>
>       <xsl:template match="root">
>          <xsl:apply-templates select="child">
>            <xsl:sort select="@prioridad" data-type="number" />
>          </xsl:apply-templates>
>       </xsl:template>
>     </xsl:stylesheet>
> -----------------
> The 1) one will throw an error (will attach it in a separate comment) the 2) is working just fine.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org