aizu-m opened a new pull request, #134:
URL: https://github.com/apache/poi-xmlbeans/pull/134

       java.lang.NullPointerException: Cannot invoke 
"org.apache.xmlbeans.SchemaType.equals(Object)" because "t" is null
           at 
org.apache.xmlbeans.impl.validator.Validator.beginEvent(Validator.java:409)
           at 
org.apache.xmlbeans.impl.validator.Validator.nextEvent(Validator.java:160)
           at 
org.apache.xmlbeans.impl.store.Validate.emitEvent(Validate.java:172)
   
   Hit this validating a document whose element is typed by a union and carries 
an xsi:type naming one of the union members, against a schema with 
`block='extension'` on that element.
   
   1. the three block / blockDefault checks in beginEvent walk the substituted 
type's base chain with `for (SchemaType t = xsiType; !t.equals(elementType); t 
= t.getBaseType())`. Each one assumes the declared element type sits somewhere 
on that chain.
   2. `isAssignableFrom`, which gates all three, does not promise that. Its 
union branch accepts a type derived from a member type, which is clause 2.2.4 
of Type Derivation OK (Simple), and a union is not on its own members' base 
chain.
   3. so the walk runs past xs:anySimpleType to xs:anyType. `fillInType` sets 
`base = null` for BTC_ANY_TYPE, the next step is null, and `equals` throws.
   4. with `block='restriction'` or `'#all'` the loop body reports cvc-elt.4.3d 
on the first iteration. That is why only the extension-only case falls off the 
end.
   
   Bounded all three walks with `t != null`, so an exhausted chain ends the 
loop the way it already does when no blocking derivation step is found. Chains 
that do contain the declared type, the blocked complex extension among them, 
behave as before.
   
   Test covers the element-level block, the same substitution under a complex 
type with union simple content (that one dereferences null in the first loop 
instead of the third), and a blocked complex extension that must still be 
reported.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to