Author: mukulg
Date: Sat Mar 31 12:19:36 2012
New Revision: 1307787
URL: http://svn.apache.org/viewvc?rev=1307787&view=rev
Log:
fixing a NPE error (on schema 1.1 branch) reported by "Jorge Williams" on
xerces list (problem ref, http://markmail.org/thread/ei2isj425fz2335a).
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java?rev=1307787&r1=1307786&r2=1307787&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java
Sat Mar 31 12:19:36 2012
@@ -191,20 +191,22 @@ public class XMLAssertPsychopathXPath2Im
Augmentations attrAugs = attributes.getAugmentations(attrIdx);
AttributePSVImpl attrPsvi =
(AttributePSVImpl)attrAugs.getItem(Constants.ATTRIBUTE_PSVI);
XSSimpleTypeDefinition attrSimpleType = (XSSimpleTypeDefinition)
attrPsvi.getTypeDefinition();
- List attrAssertList =
fXmlSchemaValidator.getAssertionValidator().getAssertsFromSimpleType(attrSimpleType);
- if (attrAssertList != null) {
- boolean isTypeDerivedFromList = ((XSSimpleType)
attrSimpleType.getBaseType()).getVariety() == XSSimpleType.VARIETY_LIST;
- boolean isTypeDerivedFromUnion = ((XSSimpleType)
attrSimpleType.getBaseType()).getVariety() == XSSimpleType.VARIETY_UNION;
- for (int assertIdx = 0; assertIdx < attrAssertList.size();
assertIdx++) {
- XSAssertImpl assertImpl =
(XSAssertImpl)attrAssertList.get(assertIdx);
- assertImpl.setAttrName(attrQname.localpart);
- evaluateOneAssertionFromSimpleType(element, attrValue,
attrAugs, attrSimpleType, isTypeDerivedFromList, isTypeDerivedFromUnion,
assertImpl, true, attrQname);
- // evaluate assertions on itemType of xs:list
- XSSimpleTypeDefinition attrItemType =
attrSimpleType.getItemType();
- if (isTypeDerivedFromList && attrItemType != null) {
- evaluateAssertsFromItemTypeOfSTList(element,
attrItemType, attrValue);
- }
- }
+ if (attrSimpleType != null) {
+ List attrAssertList =
fXmlSchemaValidator.getAssertionValidator().getAssertsFromSimpleType(attrSimpleType);
+ if (attrAssertList != null) {
+ boolean isTypeDerivedFromList = ((XSSimpleType)
attrSimpleType.getBaseType()).getVariety() == XSSimpleType.VARIETY_LIST;
+ boolean isTypeDerivedFromUnion = ((XSSimpleType)
attrSimpleType.getBaseType()).getVariety() == XSSimpleType.VARIETY_UNION;
+ for (int assertIdx = 0; assertIdx < attrAssertList.size();
assertIdx++) {
+ XSAssertImpl assertImpl =
(XSAssertImpl)attrAssertList.get(assertIdx);
+ assertImpl.setAttrName(attrQname.localpart);
+ evaluateOneAssertionFromSimpleType(element, attrValue,
attrAugs, attrSimpleType, isTypeDerivedFromList, isTypeDerivedFromUnion,
assertImpl, true, attrQname);
+ // evaluate assertions on itemType of xs:list
+ XSSimpleTypeDefinition attrItemType =
attrSimpleType.getItemType();
+ if (isTypeDerivedFromList && attrItemType != null) {
+ evaluateAssertsFromItemTypeOfSTList(element,
attrItemType, attrValue);
+ }
+ }
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]