castor
  1. castor
  2. CASTOR-1150

castor fails to unmarshall valid instance of sequence-of-choice schema

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.6
    • Fix Version/s: 1.2
    • Component/s: XML
    • Labels:
      None
    • Environment:
      Windows XP, Java 1.4.1
    • Testcase included:
      yes
    • Number of attachments :
      5

      Description

      The build.xml ant script in the attached zip file:

      1. generates a java object model from the following schema:

      <?xml version="1.0" encoding="UTF-8"?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
      <xs:element name="SequenceOfChoice" type="SequenceOfChoice" abstract="false" nillable="false"/>
      <xs:complexType name="SequenceOfChoice" abstract="false" mixed="false">
      <xs:sequence maxOccurs="unbounded">
      <xs:choice>
      <xs:element name="ChoiceOne" type="xs:string" nillable="false"/>
      <xs:element name="ChoiceTwo" type="xs:string" nillable="false"/>
      </xs:choice>
      </xs:sequence>
      </xs:complexType>
      </xs:schema>

      2. and then runs a JUnit test that asserts that the following valid instance of the schema given above can be unmarshalled:

      <?xml version="1.0" encoding="UTF-8"?>
      <SequenceOfChoice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="..\..\model-schema.xsd">
      <ChoiceTwo>String</ChoiceTwo>
      <ChoiceOne>String</ChoiceOne>
      </SequenceOfChoice>

      Unmarshalling fails and throws the following exception:

      The container object (model.SequenceOfChoiceChoice) cannot accept the child object associated with the element 'ChoiceOne' because the container is already full!

      {file: [not available]; line: 4; column: 16}

      at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:671)
      at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:565)
      at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:748)
      at model.SequenceOfChoiceTest.testUnmarshalSequenceOfChoice(SequenceOfChoiceTest.java:48)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)
      Caused by: ValidationException: The container object (model.SequenceOfChoiceChoice) cannot accept the child object associated with the element 'ChoiceOne' because the container is already full!
      at org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1667)
      at org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1338)
      at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:657)
      ... 18 more
      Caused by: ValidationException: The container object (model.SequenceOfChoiceChoice) cannot accept the child object associated with the element 'ChoiceOne' because the container is already full!
      at org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1667)
      at org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1338)
      at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:657)
      at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:565)
      at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:748)
      at model.SequenceOfChoiceTest.testUnmarshalSequenceOfChoice(SequenceOfChoiceTest.java:48)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)
      Caused by: ValidationException: The container object (model.SequenceOfChoiceChoice) cannot accept the child object associated with the element 'ChoiceOne' because the container is already full!
      at org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1667)
      at org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1338)
      at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:657)
      at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:565)
      at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:748)
      at model.SequenceOfChoiceTest.testUnmarshalSequenceOfChoice(SequenceOfChoiceTest.java:48)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)

      1. broken.xsd
        0.7 kB
        Michael Thome
      2. C1150_20071030.txt
        6 kB
        Steven Dolg
      3. patch.c1150.20060728.txt
        1 kB
        Werner Guttmann
      4. patch.c1150.20061002.txt
        43 kB
        Werner Guttmann

        Issue Links

          Activity

          Hide
          Werner Guttmann added a comment -

          Updated patch, with all files deleted that are not relevant for this problem.

          Show
          Werner Guttmann added a comment - Updated patch, with all files deleted that are not relevant for this problem.
          Hide
          Edwin Platteel added a comment -

          Any update on this bug, as we are trying to update to the new Castor version, which we cannot do since this bug is still unresolved?

          Show
          Edwin Platteel added a comment - Any update on this bug, as we are trying to update to the new Castor version, which we cannot do since this bug is still unresolved?
          Hide
          Steven Dolg added a comment -

          Here's a patch that fixes the problems with the testcase provided.
          The XML master and regression test suite both work as before with the changes introduced.

          This is only a minimal change to solve this issue.
          Some additional work for cleanup and/or design improvement is still necessary...

          Show
          Steven Dolg added a comment - Here's a patch that fixes the problems with the testcase provided. The XML master and regression test suite both work as before with the changes introduced. This is only a minimal change to solve this issue. Some additional work for cleanup and/or design improvement is still necessary...
          Hide
          Werner Guttmann added a comment -

          Thanks, Steven. Question to the reporter of this issue and/or the folks watching this issue. Given that more than 1 man day went into the resolution of this bug, I wonder whether anybody would be willing to show her appreciation by donating some cash ?

          Show
          Werner Guttmann added a comment - Thanks, Steven. Question to the reporter of this issue and/or the folks watching this issue. Given that more than 1 man day went into the resolution of this bug, I wonder whether anybody would be willing to show her appreciation by donating some cash ?
          Hide
          Werner Guttmann added a comment -

          Well, well ... no answer is an answer as well .. .

          Show
          Werner Guttmann added a comment - Well, well ... no answer is an answer as well .. .

            People

            • Assignee:
              Steven Dolg
              Reporter:
              Leif Oines
            • Votes:
              10 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 hour, 50 minutes
                1h 50m
                Remaining:
                Remaining Estimate - 1 hour, 50 minutes
                1h 50m
                Logged:
                Time Spent - Not Specified
                Not Specified