ElementImpl.getMinOccurs() causes XmlValueNotSupportedException
---------------------------------------------------------------

                 Key: XMLBEANS-469
                 URL: https://issues.apache.org/jira/browse/XMLBEANS-469
             Project: XMLBeans
          Issue Type: Bug
          Components: XmlObject
    Affects Versions: Version 2.4 
         Environment: Linux
            Reporter: Peter Fielding


This code:

if (elem.isSetMaxOccurs()) {
  Object o = elem.getMinOccurs();

  if (o instanceof Number) {
    myElem.setMinOccurs(((Number) o).intValue());
  }
}

causes this exception:

org.apache.xmlbeans.impl.values.XmlValueNotSupportedException: Could not get a 
Java numeric type from a Schema unknown type
        at 
org.apache.xmlbeans.impl.values.XmlObjectBase.getBigDecimalValue(XmlObjectBase.java:1392)
        at 
org.apache.xmlbeans.impl.values.XmlObjectBase.bigDecimalValue(XmlObjectBase.java:1545)
        at 
org.apache.xmlbeans.impl.values.XmlObjectBase.getBigIntegerValue(XmlObjectBase.java:1397)
        at 
org.apache.xmlbeans.impl.xb.xsdschema.impl.ElementImpl.getMinOccurs(ElementImpl.java:942)

in line 2, where elem.getMinOccurs() is called. A similar code for maxOccurs 
works just fine. Exception will be thrown as soon as minOccurs is set to a 
random positive integer value in the XSD file (e.g. 1, 5 and so on).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: dev-h...@xmlbeans.apache.org

Reply via email to