Hi.
I'm experiencing strange behaviour while marshalling list-typed
attributes: the generated code performs invalid list element access.
Currently I'm playing with XML Schema which has the following definition
of the finalDefault attribute:
<xs:attribute name="finalDefault"
type="xs:fullDerivationSet" use="optional"/>
The type is as follows:
<xs:simpleType name="fullDerivationSet">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="#all"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:list itemType="xs:typeDerivationControl"/>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:simpleType name="typeDerivationControl">
<xs:restriction base="xs:derivationControl">
<xs:enumeration value="extension"/>
<xs:enumeration value="restriction"/>
<xs:enumeration value="list"/>
<xs:enumeration value="union"/>
</xs:restriction>
</xs:simpleType>
In the serializeURIs method I get the following code:
...
int idx2 = 0;
final int len2 = ((_FinalDefault == null)? 0
:_FinalDefault.size());
...
if (true) {
if (_FinalDefault.get(idx2) instanceof java.lang.String) {
try {
idx2 += 1;
} catch (java.lang.Exception e) {
org.w3.xmlschema.impl.runtime.Util.handlePrintConversionException(this,
e, context);
}
} // ...
}
If you examine this method, you'll see that _FinalDefault.get(0) is
called in any case. This results in IndexOutOfBoundsException if
finalDefault attribute is empty.
I've attached schema and binding files.
Bye.
/lexi
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net