You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Andreas Veithen (JIRA)" <xe...@xml.apache.org> on 2012/09/01 12:33:07 UTC

[jira] [Created] (XERCESJ-1582) Node#lookupNamespaceURI throws NullPointerException on document without document element

Andreas Veithen created XERCESJ-1582:
----------------------------------------

             Summary: Node#lookupNamespaceURI throws NullPointerException on document without document element
                 Key: XERCESJ-1582
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1582
             Project: Xerces2-J
          Issue Type: Bug
          Components: DOM (Level 3 Core)
    Affects Versions: 2.9.1
            Reporter: Andreas Veithen
            Priority: Minor


According to appendix B.4 of the DOM Level 3 Core specification, calling Node#lookupNamespaceURI on a Document node actually performs the lookup on the document element. This is implemented by Xerces, but the code doesn't take into account that the Document may be empty (or not have a document element). On such Document instances, the lookupNamespaceURI throws a NullPointerException.

The issue can be demonstrated using the following code:

        Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
        System.out.println(document.lookupNamespaceURI("p"));

It is caused by the following piece of code in NodeImpl:

        case Node.DOCUMENT_NODE : {   
                return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix);
            }

The issue has been observed with Xerces 2.9.1, but the code in the trunk is unchanged.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Assigned] (XERCESJ-1582) Node#lookupNamespaceURI throws NullPointerException on document without document element

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1582?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Glavassevich reassigned XERCESJ-1582:
---------------------------------------------

    Assignee: Michael Glavassevich
    
> Node#lookupNamespaceURI throws NullPointerException on document without document element
> ----------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1582
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1582
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: DOM (Level 3 Core)
>    Affects Versions: 2.9.1
>            Reporter: Andreas Veithen
>            Assignee: Michael Glavassevich
>            Priority: Minor
>
> According to appendix B.4 of the DOM Level 3 Core specification, calling Node#lookupNamespaceURI on a Document node actually performs the lookup on the document element. This is implemented by Xerces, but the code doesn't take into account that the Document may be empty (or not have a document element). On such Document instances, the lookupNamespaceURI throws a NullPointerException.
> The issue can be demonstrated using the following code:
>         Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
>         System.out.println(document.lookupNamespaceURI("p"));
> It is caused by the following piece of code in NodeImpl:
>         case Node.DOCUMENT_NODE : {   
>                 return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix);
>             }
> The issue has been observed with Xerces 2.9.1, but the code in the trunk is unchanged.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Resolved] (XERCESJ-1582) Node prefix/namespace query methods throw an NPE on a document without a document element

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1582?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Glavassevich resolved XERCESJ-1582.
-------------------------------------------

    Resolution: Fixed

Fixed in SVN rev 1380453 and 1380454.
                
> Node prefix/namespace query methods throw an NPE on a document without a document element
> -----------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1582
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1582
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: DOM (Level 3 Core)
>    Affects Versions: 2.9.1
>            Reporter: Andreas Veithen
>            Assignee: Michael Glavassevich
>            Priority: Minor
>
> According to appendix B.4 of the DOM Level 3 Core specification, calling Node#lookupNamespaceURI on a Document node actually performs the lookup on the document element. This is implemented by Xerces, but the code doesn't take into account that the Document may be empty (or not have a document element). On such Document instances, the lookupNamespaceURI throws a NullPointerException.
> The issue can be demonstrated using the following code:
>         Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
>         System.out.println(document.lookupNamespaceURI("p"));
> It is caused by the following piece of code in NodeImpl:
>         case Node.DOCUMENT_NODE : {   
>                 return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix);
>             }
> The issue has been observed with Xerces 2.9.1, but the code in the trunk is unchanged.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Commented] (XERCESJ-1582) Node#lookupNamespaceURI throws NullPointerException on document without document element

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13447489#comment-13447489 ] 

Michael Glavassevich commented on XERCESJ-1582:
-----------------------------------------------

The implementation of Node.lookupPrefix() has the same problem.
                
> Node#lookupNamespaceURI throws NullPointerException on document without document element
> ----------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1582
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1582
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: DOM (Level 3 Core)
>    Affects Versions: 2.9.1
>            Reporter: Andreas Veithen
>            Assignee: Michael Glavassevich
>            Priority: Minor
>
> According to appendix B.4 of the DOM Level 3 Core specification, calling Node#lookupNamespaceURI on a Document node actually performs the lookup on the document element. This is implemented by Xerces, but the code doesn't take into account that the Document may be empty (or not have a document element). On such Document instances, the lookupNamespaceURI throws a NullPointerException.
> The issue can be demonstrated using the following code:
>         Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
>         System.out.println(document.lookupNamespaceURI("p"));
> It is caused by the following piece of code in NodeImpl:
>         case Node.DOCUMENT_NODE : {   
>                 return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix);
>             }
> The issue has been observed with Xerces 2.9.1, but the code in the trunk is unchanged.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Updated] (XERCESJ-1582) Node prefix/namespace query methods throws an NPE on a document without a document element

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1582?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Glavassevich updated XERCESJ-1582:
------------------------------------------

    Summary: Node prefix/namespace query methods throws an NPE on a document without a document element  (was: Node.lookupNamespaceURI() and Node.lookupPrefix() throws an NPE on a document without a document element)
    
> Node prefix/namespace query methods throws an NPE on a document without a document element
> ------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1582
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1582
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: DOM (Level 3 Core)
>    Affects Versions: 2.9.1
>            Reporter: Andreas Veithen
>            Assignee: Michael Glavassevich
>            Priority: Minor
>
> According to appendix B.4 of the DOM Level 3 Core specification, calling Node#lookupNamespaceURI on a Document node actually performs the lookup on the document element. This is implemented by Xerces, but the code doesn't take into account that the Document may be empty (or not have a document element). On such Document instances, the lookupNamespaceURI throws a NullPointerException.
> The issue can be demonstrated using the following code:
>         Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
>         System.out.println(document.lookupNamespaceURI("p"));
> It is caused by the following piece of code in NodeImpl:
>         case Node.DOCUMENT_NODE : {   
>                 return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix);
>             }
> The issue has been observed with Xerces 2.9.1, but the code in the trunk is unchanged.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Updated] (XERCESJ-1582) Node prefix/namespace query methods throw an NPE on a document without a document element

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1582?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Glavassevich updated XERCESJ-1582:
------------------------------------------

    Summary: Node prefix/namespace query methods throw an NPE on a document without a document element  (was: Node prefix/namespace query methods throws an NPE on a document without a document element)
    
> Node prefix/namespace query methods throw an NPE on a document without a document element
> -----------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1582
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1582
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: DOM (Level 3 Core)
>    Affects Versions: 2.9.1
>            Reporter: Andreas Veithen
>            Assignee: Michael Glavassevich
>            Priority: Minor
>
> According to appendix B.4 of the DOM Level 3 Core specification, calling Node#lookupNamespaceURI on a Document node actually performs the lookup on the document element. This is implemented by Xerces, but the code doesn't take into account that the Document may be empty (or not have a document element). On such Document instances, the lookupNamespaceURI throws a NullPointerException.
> The issue can be demonstrated using the following code:
>         Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
>         System.out.println(document.lookupNamespaceURI("p"));
> It is caused by the following piece of code in NodeImpl:
>         case Node.DOCUMENT_NODE : {   
>                 return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix);
>             }
> The issue has been observed with Xerces 2.9.1, but the code in the trunk is unchanged.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Updated] (XERCESJ-1582) Node.lookupNamespaceURI() and Node.lookupPrefix() throws an NPE on a document without a document element

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1582?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Glavassevich updated XERCESJ-1582:
------------------------------------------

    Summary: Node.lookupNamespaceURI() and Node.lookupPrefix() throws an NPE on a document without a document element  (was: Node#lookupNamespaceURI throws NullPointerException on document without document element)
    
> Node.lookupNamespaceURI() and Node.lookupPrefix() throws an NPE on a document without a document element
> --------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1582
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1582
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: DOM (Level 3 Core)
>    Affects Versions: 2.9.1
>            Reporter: Andreas Veithen
>            Assignee: Michael Glavassevich
>            Priority: Minor
>
> According to appendix B.4 of the DOM Level 3 Core specification, calling Node#lookupNamespaceURI on a Document node actually performs the lookup on the document element. This is implemented by Xerces, but the code doesn't take into account that the Document may be empty (or not have a document element). On such Document instances, the lookupNamespaceURI throws a NullPointerException.
> The issue can be demonstrated using the following code:
>         Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
>         System.out.println(document.lookupNamespaceURI("p"));
> It is caused by the following piece of code in NodeImpl:
>         case Node.DOCUMENT_NODE : {   
>                 return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix);
>             }
> The issue has been observed with Xerces 2.9.1, but the code in the trunk is unchanged.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Commented] (XERCESJ-1582) Node.lookupNamespaceURI() and Node.lookupPrefix() throws an NPE on a document without a document element

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13447490#comment-13447490 ] 

Michael Glavassevich commented on XERCESJ-1582:
-----------------------------------------------

Node.isDefaultNamespace(String) is also broken in the same way.
                
> Node.lookupNamespaceURI() and Node.lookupPrefix() throws an NPE on a document without a document element
> --------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1582
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1582
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: DOM (Level 3 Core)
>    Affects Versions: 2.9.1
>            Reporter: Andreas Veithen
>            Assignee: Michael Glavassevich
>            Priority: Minor
>
> According to appendix B.4 of the DOM Level 3 Core specification, calling Node#lookupNamespaceURI on a Document node actually performs the lookup on the document element. This is implemented by Xerces, but the code doesn't take into account that the Document may be empty (or not have a document element). On such Document instances, the lookupNamespaceURI throws a NullPointerException.
> The issue can be demonstrated using the following code:
>         Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
>         System.out.println(document.lookupNamespaceURI("p"));
> It is caused by the following piece of code in NodeImpl:
>         case Node.DOCUMENT_NODE : {   
>                 return((NodeImpl)((Document)this).getDocumentElement()).lookupNamespaceURI(specifiedPrefix);
>             }
> The issue has been observed with Xerces 2.9.1, but the code in the trunk is unchanged.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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