Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-2154

[XSLTC] Parser: NullPointerException when _locator is null

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.7
    • XSLTC
    • None
    • PatchAvailable
    • fp2

    Description

      The exception is caused by the following change (it works with Xalan 2.6.0):

      http://cvs.apache.org/viewcvs.cgi/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Parser.java?r1=1.64&r2=1.65&diff_format=h

      ===================================================================
      RCS file: /home/cvspublic/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Parser.java,v
      retrieving revision 1.64
      retrieving revision 1.65
      diff -u -r1.64 -r1.65
      — Parser.java 2004/02/23 10:29:35 1.64
      +++ Parser.java 2004/05/21 20:29:28 1.65
      @@ -14,7 +14,7 @@

      • limitations under the License.
        */
        /*
      • * $Id: Parser.java,v 1.64 2004/02/23 10:29:35 aruny Exp $
        + * $Id: Parser.java,v 1.65 2004/05/21 20:29:28 santiagopg Exp $
        */

      package org.apache.xalan.xsltc.compiler;
      @@ -965,7 +965,10 @@
      }
      }
      }

      • if (node == null) node = new LiteralElement();
        + if (node == null) { + node = new LiteralElement(); + node.setLineNumber(_locator.getLineNumber()); + }

        }
        if ((node != null) && (node instanceof LiteralElement)) {
        ((LiteralElement)node).setQName(qname);

      +++++++++++++++++++++++++

      Unfortunately I'm not familiar enough with the code to know if a "_locator != null" check would be sufficient.

      Stack trace:

      org.apache.xalan.xsltc.TransletException: java.lang.NullPointerException
      at org.apache.xalan.xsltc.dom.SAXImpl.shallowCopy(SAXImpl.java:1735)
      at org.apache.xalan.xsltc.dom.DOMAdapter.shallowCopy(DOMAdapter.java:314)
      at page2xslt.applyTemplates()
      at page2xslt.applyTemplates()
      at page2xslt.applyTemplates()
      at page2xslt.applyTemplates()
      at page2xslt.applyTemplates()
      at page2xslt.transform()
      at org.apache.xalan.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:592)

      Attachments

        1. 2154.Parser.patch.txt
          3 kB
          Brian Minchau

        Activity

          People

            Unassigned Unassigned
            andreas@apache.org Andreas Hartmann
            Santiago Pericas-Geertsen Santiago Pericas-Geertsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: