You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Henry Zongaro (JIRA)" <xa...@xml.apache.org> on 2010/01/13 15:31:54 UTC

[jira] Resolved: (XALANJ-2513) TransformerException: NullPointerException with Java 1.6 on AIX

     [ https://issues.apache.org/jira/browse/XALANJ-2513?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henry Zongaro resolved XALANJ-2513.
-----------------------------------

    Resolution: Invalid

Resolving as invalid, as it's caused by using a combination of classes from the Java run-time environment and the user's class path that is incompatible.

> TransformerException: NullPointerException with Java 1.6 on AIX
> ---------------------------------------------------------------
>
>                 Key: XALANJ-2513
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2513
>             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, Xalan
>    Affects Versions: 2.7.1
>         Environment: AIX 5.2, IBM SDK Version 6, Xalan-J 2.7.1
>            Reporter: Robert Quan
>
> Attempting to use trax to perform a transformation using IBM SDK Java 6 on AIX will result in a TransformerException: java.null.NullPointerException.  If one was to use IBM Java 5, the transformation will run without issue.
> The following details the data required to reproduce the issue:
> Stylesheet (sort.xsl) - Note that the stylesheet will be precompiled into a translet in a jar called ipteXslTranslets.jar
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE xsl:stylesheet [
>     <!ENTITY nbsp "&#x00A0;"> <!-- NO-BREAK SPACE -->
> ]>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>     <xsl:output method="html" indent="yes" />
>     <xsl:param name="rowstart">1</xsl:param>
>     <xsl:param name="rowlimit">20</xsl:param>
>     <xsl:param name="sortcolumn">5</xsl:param>
>     <xsl:param name="sorttype">number</xsl:param>
>     <xsl:param name="sortorder">descending</xsl:param>
>     <xsl:template match="/">
>         <xsl:apply-templates />
>     </xsl:template>
>     <xsl:template match="*/p">
>         <xsl:copy-of select="." />
>     </xsl:template>
>     <xsl:template match="*/pre">
>         <xsl:copy-of select="." />
>     </xsl:template>
>     <xsl:template match='*/table[@class="summary"]'>
>       <xsl:copy-of select="." />
>     </xsl:template>
>     <xsl:template name="getActualRowstart">
>       <xsl:param name="totalrows" />
>       <xsl:choose>
>         <xsl:when test="0 = $totalrows">
>           <xsl:text>0</xsl:text>
>         </xsl:when>
>         <xsl:when test="$rowstart &gt; $totalrows">
>           <xsl:value-of select="(floor(($totalrows - 1) div $rowlimit) * $rowlimit) + 1"/>
>         </xsl:when>
>         <xsl:otherwise>
>           <xsl:value-of select="$rowstart"/>
>         </xsl:otherwise>
>       </xsl:choose>
>     </xsl:template>
>     <xsl:template match='*/table[@class="formatted"]'>
>         <xsl:variable name="totalrows"><xsl:value-of select="count(tbody/tr)" /></xsl:variable>
>         <xsl:variable name="actualRowstart">
>           <xsl:call-template name="getActualRowstart">
>             <xsl:with-param name="totalrows" select="$totalrows"/>
>           </xsl:call-template>
>         </xsl:variable>
>         <xsl:copy>
>             <xsl:copy-of select="@*" />
>             <xsl:apply-templates />
>         </xsl:copy>
>         <div class="table-metadata" style="display: none;">
>             <span class="table-metadata-total-rows"><xsl:value-of select="$totalrows" /></span>
>         </div>
>         <div class="table-metadata" style="display: none;">
>             <span class="table-metadata-row-start"><xsl:value-of select="$actualRowstart" /></span>
>         </div>
>     </xsl:template>
>     <xsl:template match="thead|tfoot">
>         <xsl:copy-of select="." />
>     </xsl:template>
>     <xsl:template match="tbody">
>         <xsl:variable name="totalrows"><xsl:value-of select="count(tr)" /></xsl:variable>
>         <xsl:variable name="actualRowstart">
>           <xsl:call-template name="getActualRowstart">
>             <xsl:with-param name="totalrows" select="$totalrows"/>
>           </xsl:call-template>
>         </xsl:variable>
>         <tbody>
>             <xsl:for-each select="tr">
>                 <xsl:sort select="td[position() = $sortcolumn]" order="{$sortorder}" data-type="{$sorttype}" />
>                     <xsl:if test="position() &gt;= $actualRowstart and position() &lt; $actualRowstart + $rowlimit">
>                       <xsl:element name="tr">
>                         <xsl:choose>
>                           <xsl:when test="position() mod 2 = 1">
>                             <xsl:attribute name="class">shaded</xsl:attribute>
>                           </xsl:when>
>                         </xsl:choose>
>                         <xsl:copy-of select="*" />
>                       </xsl:element>
>                     </xsl:if>
>             </xsl:for-each>
>         </tbody>
>     </xsl:template>
> </xsl:stylesheet>
> Input XML data (0.xml)
> ------------------------------
> <div>
> <BR/><table xmlns:java="http://xml.apache.org/xslt/java" class="summary" cellSpacing="0" width="400" border="0">
> <tr>
> <td>Elapsed Time (hh:mm:ss): 00:01:20</td>
> </tr>
> <tr>
> <td>VLAN 530</td>
> </tr>
> </table><table xmlns:java="http://xml.apache.org/xslt/java" class="formatted" width="600">
> <thead>
> <th class="columnHeader sortAsText" width="16%">Address</th><th class="columnHeader sortAsNumbers" width="12%"><a href="" onclick="return(top.graphSingleTimestampResults('graphName=top-talk-grph|desc=SmartSight Top Talkers by MAC for VLAN 530|cir=10000|dir=|dataSetIndex=1|count=3|label1=0011.434E.8044|value1=0.0|label2=0012.F01A.ED76|value2=0.0|label3=0003.FEAB.6C23|value3=0.0|deviceId=2'));">Bit Rate
> (Mbps)</a></th><th class="columnHeader sortAsNumbers" width="12%">Utilization
> (% of CIR)</th><th class="columnHeader sortAsNumbers" width="12%">Pkt Rate (pkts/sec)</th><th class="columnHeader sortAsNumbers" width="12%">Total Bit Count (Mb)</th><th class="columnHeader sortAsNumbers" width="12%">Total Pkt Count</th>
> </thead>
> <tbody>
> <tr class="shaded">
> <td class="rowDataLeft">0011.434E.8044</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.433</td><td class="rowDataRight">0.026</td><td class="rowDataRight">32</td>
> </tr>
> <tr class="">
> <td class="rowDataLeft">0012.F01A.ED76</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.200</td><td class="rowDataRight">0.014</td><td class="rowDataRight">16</td>
> </tr>
> <tr class="shaded">
> <td class="rowDataLeft">0003.FEAB.6C23</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.000</td><td class="rowDataRight">0.500</td><td class="rowDataRight">0.023</td><td class="rowDataRight">40</td>
> </tr>
> </tbody>
> </table>
> </div>
> Source Code (XsltTest.java)
> --------------------------------------
> package test.xslt;
> import java.io.File;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
> import javax.xml.transform.Templates;
> /**
>  *
>  * @author dmalykhanov
>  */
> public class XsltTest {
>     private TransformerFactory tf;
>     //static {
>     //    System.setProperty(
>     //        "javax.xml.transform.TransformerFactory",
>     //        "org.apache.xalan.xsltc.trax.TransformerFactoryImpl"
>     //    );
>     //}
>     public static void main(String... args) throws Exception {
>         XsltTest app = new XsltTest();
>         System.exit(app.run(args));
>     }
>     private int run(String[] args) throws Exception {
>         tf = TransformerFactory.newInstance();
>         tf.setAttribute("use-classpath", Boolean.TRUE);
>         Transformer xslp = tf.newTransformer(new StreamSource(args[1]));
>         xslp.transform(new StreamSource(new File(args[0])), new StreamResult(System.out));
>         return 0;
>     }
> }
> Shell script used to run transformation
> ----------------------------------------------------
> #!/bin/sh
> CLASSPATH='.:/spirent/metro/5.000/IPTE/ipte/WEB-INF/lib/ipteXslTranslets.jar:/afs/hekimian.com/cm-cots/ALL-OS/xalan-j/2.7.1-CM1/xalan.jar:/afs/hekimian.com/cm-cots/ALL-OS/xalan-j/2.7.1-CM1/serializer.jar:/afs/hekimian.com/cm-cots/ALL-OS/xalan-j/2.7.1-CM1/xercesImpl.jar:/afs/hekimian.com/cm-cots/ALL-OS/xalan-j/2.7.1-CM1/xml-apis.jar:'
> export CLASSPATH
> exec /spirent/cots/java/1.6/jre/bin/java \
>     -Djaxp.debug=1 \
>     -Djavax.xml.transform.TransformerFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl \
>     -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl \
>     -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl \
>     test.xslt.XsltTest "$@"
> ** Note:  ipteXslTranslets.jar contains the precompiled stylesheet sort.xsl
> ** Note:  Commenting out the directive to reassign the TransformerFactory to trax.TransformerFactoryImpl will not generate the exception and the transformation will work
> Command line command to run the transformation
> ----------------------------------------------------------------------
> $ run.sh 0.xml sort
> ** Note: 0.xml contains the input xml as provided above
> ** Note: sort is the precompiled translet class for the stylesheet provided above

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