Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002286 [Resin] major always 01-03-08 13:36 01-03-08 13:40
Reporter atifmk View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 3.1.3
Summary 0002286: NullPointerException in DomBuilder class
Description There is bug in com.caucho.xml.DomBuilder class that result in NPE at runtime while parsing the XML/XSL documents with namespaces. The bug is in the startPrefixMapping(String prefix, String url) method at line 178. If does a check for the empty prefix without considering that the prefix can be null. An example of this from the com.caucho.xsl.XslWriter class at line 1168:

_xmlWriter.startPrefixMapping(null, topUrl);

It's calling the startPrefixMapping(...) method with null prefix and results in NPE.

The bug in DomBuilder class can very easily be fixed by following implemention of the method:

  public void startPrefixMapping(String prefix, String url)
  {
    if (_node == null || _node == _top)
      _doc.addNamespace(prefix, url);

    if (prefix == null || prefix.equals("")) {
      _prefixNames.add(new QName(null, "xmlns", XmlParser.XMLNS));
      _prefixValues.add(url);
    }
    else {
      _prefixNames.add(new QName("xmlns", prefix, XmlParser.XMLNS));
      _prefixValues.add(url);
    }
  }

It does a check for null before doing a check for empty string. I am also attaching the DomBuilder.java with above changes in it.
Additional Information
Attached Files  DOMBuilder.java [^] (14,414 bytes) 01-03-08 13:36

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
01-03-08 13:36 atifmk New Issue
01-03-08 13:36 atifmk File Added: DOMBuilder.java
01-03-08 13:36 atifmk Issue Monitored: atifmk
01-03-08 13:40 ferg Assigned To  => ferg
01-03-08 13:40 ferg Status new => closed
01-03-08 13:40 ferg Resolution open => fixed
01-03-08 13:40 ferg Fixed in Version  => 3.1.5


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker