I'm running into the strangest issues with XMLBeans 1.0.4 when binding
against XML Schema simple types which I have defined. For example,
I've defined the following type:
<xs:simpleType name="PhoneNumberType">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{7,10}" />
</xs:restriction>
</xs:simpleType>
Sometimes -- and yes, there's the rub, sometimes -- my JUnit tests
that hit the class bound to my PhoneNumberType generate the following
NullPointerException:
java.lang.NullPointerException at
org.apache.xmlbeans.impl.schema.SchemaPropertyImpl.getType(SchemaPropertyImpl.java:92)
at
org.apache.xmlbeans.impl.schema.SchemaTypeImpl.createElementType(SchemaTypeImpl.java:879)
at
org.apache.xmlbeans.impl.values.XmlObjectBase.create_element_user(XmlObjectBase.java:842)
at
org.apache.xmlbeans.impl.store.Type.create_element_user(Type.java:112)
at org.apache.xmlbeans.impl.store.Splay.getType(Splay.java:3383) at
org.apache.xmlbeans.impl.store.Type.insertElement(Type.java:849) at
org.apache.xmlbeans.impl.store.Type.add_element_user(Type.java:837) at
com.foo.
xmlbeans.impl.SearchCriteriaImpl.setPhoneNumber(SearchCriteriaImpl.java:336)
at
…
It looks like the NullPointerException is arising here in SchemaPropertyImpl:
public SchemaType getType() {
return _typeref.get();
}
Any thoughts why this is happening, and why it is happening only intermittently?