Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-469

ElementImpl.getMinOccurs() causes XmlValueNotSupportedException

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      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).

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            pfielding Peter Fielding
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment