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 "Guangtai Liang (Updated) (JIRA)" <xe...@xml.apache.org> on 2012/02/13 07:34:59 UTC

[jira] [Updated] (XERCESJ-1548) An incomplete fix for the NPE bugs in AbstractDOMParser.java

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

Guangtai Liang updated XERCESJ-1548:
------------------------------------

    Description: 
The fix revision 318567 was aimed to remove an NPE bug on the "locator" in the method "startDTD" of the file "/xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java" , but it is incomplete. 
Since the "locator" could be null during the run-time execution, it should also be null-checked before being dereferenced at Line 1683 and Line 1684. 

The buggy code the proposed missing fixes should be made in is as bellowing: 

 public void startDTD(XMLLocator locator, Augmentations augs) throws XNIException {
        if (DEBUG_EVENTS) {
            System.out.println("==>startDTD");
            if (DEBUG_BASEURI) {            
                System.out.println("   expandedSystemId: "+locator.getExpandedSystemId());  [Line 1683]
                System.out.println("   baseURI:"+ locator.getBaseSystemId());                        [Line 1684]
            }
        }

        fInDTD = true;
        if (locator != null) {
            fBaseURIStack.push(locator.getBaseSystemId());
        }
        if (fDeferNodeExpansion || fDocumentImpl != null) {
            fInternalSubset = new StringBuffer(1024);
        }
    } // startDTD(XMLLocator)



  was:
The fix revision 318567 was aimed to remove an NPE bug on "locator" in the method "startDTD" of the file "/xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java" , but it is incomplete. 
Since the "locator" could be null during the run-time execution, it should also be null-checked before being dereferenced at Line 1683 and Line 1684. 

The buggy code the proposed missing fixes should also be made in is copied as bellowing: 

 public void startDTD(XMLLocator locator, Augmentations augs) throws XNIException {
        if (DEBUG_EVENTS) {
            System.out.println("==>startDTD");
            if (DEBUG_BASEURI) {            
                System.out.println("   expandedSystemId: "+locator.getExpandedSystemId());  [Line 1683]
                System.out.println("   baseURI:"+ locator.getBaseSystemId());                        [Line 1684]
            }
        }

        fInDTD = true;
        if (locator != null) {
            fBaseURIStack.push(locator.getBaseSystemId());
        }
        if (fDeferNodeExpansion || fDocumentImpl != null) {
            fInternalSubset = new StringBuffer(1024);
        }
    } // startDTD(XMLLocator)



        Summary: An incomplete fix for the NPE bugs in AbstractDOMParser.java  (was: Missing Fixes for the NPE bugs in AbstractDOMParser.java)
    
> An incomplete fix for the NPE bugs in AbstractDOMParser.java
> ------------------------------------------------------------
>
>                 Key: XERCESJ-1548
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1548
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: Other
>            Reporter: Guangtai Liang
>            Priority: Critical
>              Labels: incomplete_fix, missing_fixes
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> The fix revision 318567 was aimed to remove an NPE bug on the "locator" in the method "startDTD" of the file "/xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java" , but it is incomplete. 
> Since the "locator" could be null during the run-time execution, it should also be null-checked before being dereferenced at Line 1683 and Line 1684. 
> The buggy code the proposed missing fixes should be made in is as bellowing: 
>  public void startDTD(XMLLocator locator, Augmentations augs) throws XNIException {
>         if (DEBUG_EVENTS) {
>             System.out.println("==>startDTD");
>             if (DEBUG_BASEURI) {            
>                 System.out.println("   expandedSystemId: "+locator.getExpandedSystemId());  [Line 1683]
>                 System.out.println("   baseURI:"+ locator.getBaseSystemId());                        [Line 1684]
>             }
>         }
>         fInDTD = true;
>         if (locator != null) {
>             fBaseURIStack.push(locator.getBaseSystemId());
>         }
>         if (fDeferNodeExpansion || fDocumentImpl != null) {
>             fInternalSubset = new StringBuffer(1024);
>         }
>     } // startDTD(XMLLocator)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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