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 (Created) (JIRA)" <xe...@xml.apache.org> on 2012/02/13 08:47:05 UTC

[jira] [Created] (XERCESJ-1553) An incomplete fix for the NPE bugs in XSAttributeUseImpl.java

An incomplete fix for the NPE bugs in XSAttributeUseImpl.java
-------------------------------------------------------------

                 Key: XERCESJ-1553
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1553
             Project: Xerces2-J
          Issue Type: Bug
          Components: Other
            Reporter: Guangtai Liang
            Priority: Critical


The fix revision 320528 was aimed to remove an NPE bug on the "this.fDefault" and "this.fDefault.actualValue" in the method "getConstraintValue" of the file "/xerces/java/trunk/src/org/apache/xerces/impl/xs/XSAttributeUseImpl.java" , but it is incomplete. 
Since the "this.fDefault" is a class field and also could be null during the run-time execution, it should also be null-checked before being dereferenced in other methods. 

The buggy code locations the same fix needs to be applied at are as bellows: 


Line 123 of the method "getActualVC";
  public Object getActualVC() {
        return getConstraintType() == XSConstants.VC_NONE ?
               null :
               fDefault.actualValue;
    }


Line 129 of the method "getActualVCType": 

       public short getActualVCType() {
        return getConstraintType() == XSConstants.VC_NONE ?
               XSConstants.UNAVAILABLE_DT :
               fDefault.actualValueType;
    }

Line 135 of the method "getItemValueTypes" : 

  public ShortList getItemValueTypes() {
        return getConstraintType() == XSConstants.VC_NONE ?
               null :
               fDefault.itemValueTypes;
    }



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


[jira] [Resolved] (XERCESJ-1553) An incomplete fix for the NPE bugs in XSAttributeUseImpl.java

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

Michael Glavassevich resolved XERCESJ-1553.
-------------------------------------------

    Resolution: Incomplete

Please provide test cases which demonstrate that there are actual problems with these methods.
                
> An incomplete fix for the NPE bugs in XSAttributeUseImpl.java
> -------------------------------------------------------------
>
>                 Key: XERCESJ-1553
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1553
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: Other
>            Reporter: Guangtai Liang
>            Priority: Critical
>              Labels: incomplete_fix, missing_fixes
>
> The fix revision 320528 was aimed to remove an NPE bug on the "this.fDefault" and "this.fDefault.actualValue" in the method "getConstraintValue" of the file "/xerces/java/trunk/src/org/apache/xerces/impl/xs/XSAttributeUseImpl.java" , but it is incomplete. 
> Since the "this.fDefault" is a class field and also could be null during the run-time execution, it should also be null-checked before being dereferenced in other methods. 
> The buggy code locations the same fix needs to be applied at are as bellows: 
> Line 123 of the method "getActualVC";
>   public Object getActualVC() {
>         return getConstraintType() == XSConstants.VC_NONE ?
>                null :
>                fDefault.actualValue;
>     }
> Line 129 of the method "getActualVCType": 
>        public short getActualVCType() {
>         return getConstraintType() == XSConstants.VC_NONE ?
>                XSConstants.UNAVAILABLE_DT :
>                fDefault.actualValueType;
>     }
> Line 135 of the method "getItemValueTypes" : 
>   public ShortList getItemValueTypes() {
>         return getConstraintType() == XSConstants.VC_NONE ?
>                null :
>                fDefault.itemValueTypes;
>     }

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


[jira] [Closed] (XERCESJ-1553) An incomplete fix for the NPE bugs in XSAttributeUseImpl.java

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

Guangtai Liang closed XERCESJ-1553.
-----------------------------------

    
> An incomplete fix for the NPE bugs in XSAttributeUseImpl.java
> -------------------------------------------------------------
>
>                 Key: XERCESJ-1553
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1553
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: Other
>            Reporter: Guangtai Liang
>            Priority: Critical
>              Labels: incomplete_fix, missing_fixes
>
> The fix revision 320528 was aimed to remove an NPE bug on the "this.fDefault" and "this.fDefault.actualValue" in the method "getConstraintValue" of the file "/xerces/java/trunk/src/org/apache/xerces/impl/xs/XSAttributeUseImpl.java" , but it is incomplete. 
> Since the "this.fDefault" is a class field and also could be null during the run-time execution, it should also be null-checked before being dereferenced in other methods. 
> The buggy code locations the same fix needs to be applied at are as bellows: 
> Line 123 of the method "getActualVC";
>   public Object getActualVC() {
>         return getConstraintType() == XSConstants.VC_NONE ?
>                null :
>                fDefault.actualValue;
>     }
> Line 129 of the method "getActualVCType": 
>        public short getActualVCType() {
>         return getConstraintType() == XSConstants.VC_NONE ?
>                XSConstants.UNAVAILABLE_DT :
>                fDefault.actualValueType;
>     }
> Line 135 of the method "getItemValueTypes" : 
>   public ShortList getItemValueTypes() {
>         return getConstraintType() == XSConstants.VC_NONE ?
>                null :
>                fDefault.itemValueTypes;
>     }

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


[jira] [Resolved] (XERCESJ-1553) An incomplete fix for the NPE bugs in XSAttributeUseImpl.java

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

Michael Glavassevich resolved XERCESJ-1553.
-------------------------------------------

    Resolution: Incomplete

Pointing to a commit made years ago doesn't imply that there's an issue today, nor does it imply that other codepaths have an issue. Please provide an actual test case which demonstrates a problem with the current code base.
                
> An incomplete fix for the NPE bugs in XSAttributeUseImpl.java
> -------------------------------------------------------------
>
>                 Key: XERCESJ-1553
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1553
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: Other
>            Reporter: Guangtai Liang
>            Priority: Critical
>              Labels: incomplete_fix, missing_fixes
>
> The fix revision 320528 was aimed to remove an NPE bug on the "this.fDefault" and "this.fDefault.actualValue" in the method "getConstraintValue" of the file "/xerces/java/trunk/src/org/apache/xerces/impl/xs/XSAttributeUseImpl.java" , but it is incomplete. 
> Since the "this.fDefault" is a class field and also could be null during the run-time execution, it should also be null-checked before being dereferenced in other methods. 
> The buggy code locations the same fix needs to be applied at are as bellows: 
> Line 123 of the method "getActualVC";
>   public Object getActualVC() {
>         return getConstraintType() == XSConstants.VC_NONE ?
>                null :
>                fDefault.actualValue;
>     }
> Line 129 of the method "getActualVCType": 
>        public short getActualVCType() {
>         return getConstraintType() == XSConstants.VC_NONE ?
>                XSConstants.UNAVAILABLE_DT :
>                fDefault.actualValueType;
>     }
> Line 135 of the method "getItemValueTypes" : 
>   public ShortList getItemValueTypes() {
>         return getConstraintType() == XSConstants.VC_NONE ?
>                null :
>                fDefault.itemValueTypes;
>     }

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


[jira] [Reopened] (XERCESJ-1553) An incomplete fix for the NPE bugs in XSAttributeUseImpl.java

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

Guangtai Liang reopened XERCESJ-1553:
-------------------------------------


Please refer to the test case provided for reproducing the NPE issue (https://issues.apache.org/jira/browse/XERCESJ-1553) which showed that this.fDefault can be null, you need to null-check it before dereference it. 

The detailed description info is copied here: 
"
In case of error "a-props-correct.2" (Invalid value constraint value '%1' in attribute '%2'.), attribute fDefault or fDefault.actualValue might be null and the code might result in a NPE.

How to reproduce: Example from xml schema test suite:
msxsdtest\attribute\attP006.xsd 

In my case, when anlysing invalid schema files (as good as possible), it is important not to have this exception, so I'm working with my own patched version of Xerces2-J. It would be nice if you would fix this somewhen. 

My fix is quite simple: just check on null: 

Old: 
        return getConstraintType() == XSConstants.VC_NONE ?
               null :
               fDefault.actualValue.toString();

New: 
        return getConstraintType() == XSConstants.VC_NONE ? null :
            (fDefault == null ? null :
            (fDefault.actualValue == null ? null :
            (fDefault.actualValue.toString())));
"
                
> An incomplete fix for the NPE bugs in XSAttributeUseImpl.java
> -------------------------------------------------------------
>
>                 Key: XERCESJ-1553
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1553
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: Other
>            Reporter: Guangtai Liang
>            Priority: Critical
>              Labels: incomplete_fix, missing_fixes
>
> The fix revision 320528 was aimed to remove an NPE bug on the "this.fDefault" and "this.fDefault.actualValue" in the method "getConstraintValue" of the file "/xerces/java/trunk/src/org/apache/xerces/impl/xs/XSAttributeUseImpl.java" , but it is incomplete. 
> Since the "this.fDefault" is a class field and also could be null during the run-time execution, it should also be null-checked before being dereferenced in other methods. 
> The buggy code locations the same fix needs to be applied at are as bellows: 
> Line 123 of the method "getActualVC";
>   public Object getActualVC() {
>         return getConstraintType() == XSConstants.VC_NONE ?
>                null :
>                fDefault.actualValue;
>     }
> Line 129 of the method "getActualVCType": 
>        public short getActualVCType() {
>         return getConstraintType() == XSConstants.VC_NONE ?
>                XSConstants.UNAVAILABLE_DT :
>                fDefault.actualValueType;
>     }
> Line 135 of the method "getItemValueTypes" : 
>   public ShortList getItemValueTypes() {
>         return getConstraintType() == XSConstants.VC_NONE ?
>                null :
>                fDefault.itemValueTypes;
>     }

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