#808 Empty choice group causes array out of bounds exception


With this schema:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="boom"> <xs:complexType mixed="true"> <xs:choice minOccurs="0" maxOccurs="unbounded"/> </xs:complexType> </xs:element> </xs:schema>

I get this failure:

really-strategies-computer:~/java/saxonsa9-0-0-4j ekimber$ java com.saxonica.Validate -xsd:array-out-of-bounds.xsd -t
Saxon-SA from Saxonica
Java version 1.5.0_13
Saxon-SA evaluation license expires in 30 days
Loading schema document file:/Users/ekimber/java/saxonsa9-0-0-4j/array-out-of-bounds.xsd
Finished loading schema document file:/Users/ekimber/java/saxonsa9-0-0-4j/array-out-of-bounds.xsd
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:546)
at java.util.ArrayList.get(ArrayList.java:321)
at com.saxonica.schema.ModelGroupParticle.validate(ModelGroupParticle.java:246)
at com.saxonica.schema.UserComplexType.validate(UserComplexType.java:858)
at com.saxonica.schema.ElementDecl.validate(ElementDecl.java:808)
at com.saxonica.schema.PreparedSchema.validate(PreparedSchema.java:801)
at com.saxonica.schema.SchemaCompiler.validate(SchemaCompiler.java:379)
at com.saxonica.Validate.doValidate(Validate.java:223)
at com.saxonica.Validate.main(Validate.java:55)
Fatal error during validation: Index: 0, Size: 0
really-strategies-computer:~/java/saxonsa9-0-0-4j ekimber$

The offending construct appears to be the choice group with no members. If I comment it out then Saxon is happy.

Xerces (via OxygenXML) reports both versions as valid.




  • Michael Kay

    Michael Kay - 2008-04-21

    Logged In: YES
    Originator: NO

    Thanks, now fixed. Surprising that this apparently doesn't appear anywhere in the W3C test suite!

    Please note, I only spotted your bug entry here by chance. As indicated on the "submit new" page, I generally try to discourage people from entering suspected bugs directly into the tracker, because it can mean that a lot of noise appears in this area: I prefer to keep this for confirmed bugs with accurate bug descriptions. The preferred way to notify suspected bugs is the saxon-help mailing list or forum. - Michael Kay

  • Michael Kay

    Michael Kay - 2008-05-12

    Logged In: YES
    Originator: NO

    Fixed in