Uploaded image for project: 'Tuscany'
  1. Tuscany
  2. TUSCANY-1131

XMLHelper.save() throws exception when the serialized dataobject is not the root object and its container is of AnyTypeDataObject

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • Java-SDO-beta1
    • Java-SDO-beta1
    • None
    • None

    Description

      To reproduce this problem, I modified the existing quote.xml content to be contained by SOAP elements that don't have XSD registered with SDO runtime so the container of stockQuote will be of AnyTypeDataObject. Below is the XML content. When I invoked XMLHelper.save() on stockQuote data object, I got the following exception. I assume this scenario should be supported.

      java.lang.ClassCastException: org.apache.tuscany.sdo.impl.DynamicDataObjectImpl incompatible with java.util.Collection
      at org.eclipse.emf.ecore.util.BasicFeatureMap.set(BasicFeatureMap.java:1026)
      at org.eclipse.emf.ecore.util.FeatureMapUtil$FeatureFeatureMap.set(FeatureMapUtil.java:1093)
      at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eOpenSet(BasicEObjectImpl.java:723)
      at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:658)
      at org.apache.tuscany.sdo.helper.XMLDocumentImpl.save(XMLDocumentImpl.java:205)
      at org.apache.tuscany.sdo.helper.XMLHelperImpl.save(XMLHelperImpl.java:115)
      at org.apache.tuscany.sdo.helper.XMLHelperImpl.save(XMLHelperImpl.java:110)
      at org.apache.tuscany.sdo.test.XMLHelperTestCase.testAnyTypeContainer(XMLHelperTestCase.java:175)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:615)
      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.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

      <?xml version="1.0" encoding="ASCII"?>
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:simple="http://www.example.com/simple">
      <soapenv:Header/>
      <soapenv:Body>
      <simple:stockQuote>
      <symbol>fbnt</symbol>
      <companyName>FlyByNightTechnology</companyName>
      <price>1000.0</price>
      <open1>1000.0</open1>
      <high>1000.0</high>
      <low>1000.0</low>
      <volume>1000.0</volume>
      <change1>1000.0</change1>
      <quotes>
      <price>2000.0</price>
      </quotes>
      </simple:stockQuote>
      </soapenv:Body>
      </soapenv:Envelope>

      Attachments

        1. quoteInSOAP.xml
          0.7 kB
          Fuhwei Lwo
        2. tuscany-1131.patch
          2 kB
          Fuhwei Lwo
        3. tuscany-1131-testcase.patch
          2 kB
          Fuhwei Lwo

        Activity

          People

            Unassigned Unassigned
            fuhwei Fuhwei Lwo
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: