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

setXXX(null) on a nil element leaves bean in invalid state

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Version 2.2
    • None
    • XmlObject
    • None
    • Java_1.5.0_10 on Windows2000

    Description

      Given the following schema

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
      elementFormDefault="unqualified" attributeFormDefault="unqualified">

      <xs:element name="TestSet">
      <xs:complexType>
      <xs:sequence>
      <xs:element name="Name" type="xs:string"/>
      <xs:element name="More">
      <xs:complexType>
      <xs:sequence>
      <xs:element name="MoreName" type="xs:string"/>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:schema>

      the following code will fail if assertions are enabled:

      TestSetDocument doc = TestSetDocument.Factory.newInstance();
      TestSet testSet = doc.addNewTestSet();

      testSet.setMore(null);
      testSet.setMore(null);
      testSet.validate();

      while it will succeed if assertions are disabled.

      The exception is

      at org.apache.xmlbeans.impl.values.XmlObjectBase.build_text(XmlObjectBase.java:837)
      at org.apache.xmlbeans.impl.store.Xobj.ensureOccupancy(Xobj.java:1694)
      at org.apache.xmlbeans.impl.store.Cur.next(Cur.java:1444)
      at org.apache.xmlbeans.impl.store.Validate.process(Validate.java:74)
      at org.apache.xmlbeans.impl.store.Validate.<init>(Validate.java:39)
      at org.apache.xmlbeans.impl.store.Xobj.validate(Xobj.java:1860)
      at org.apache.xmlbeans.impl.values.XmlObjectBase.validate(XmlObjectBase.java:343)

      I will attach a test case.

      Attachments

        Activity

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

          People

            Unassigned Unassigned
            jvc2010 Joseph Campolongo

            Dates

              Created:
              Updated:

              Slack

                Issue deployment