XSAttributeUseImpl.getConstraintValue() might cause NPE
-------------------------------------------------------
Key: XERCESJ-1080
URL: http://issues.apache.org/jira/browse/XERCESJ-1080
Project: Xerces2-J
Type: Bug
Versions: 2.6.2
Environment: Xerces2-J CVS HEAD (May 12, 2005)
Reporter: Kurt Riede
Priority: Minor
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())));
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]