[
https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531630
]
Frank Budinsky commented on TUSCANY-1812:
-----------------------------------------
Hi Ron,
I think that with Ed's suggestion we don't want to use the
extendedMetaDataHolderCache. That is, you should not include my earlier
suggested fix. Ed's approach is to force the objects themselves to compute and
cache their own extendedMetaData. Then it doesn't matter what ExtendedMetaData
instance is used to access it.
Frank.
> XMLHelper.load() IOException using schema that has both a substitution group
> and an extension
> ---------------------------------------------------------------------------------------------
>
> Key: TUSCANY-1812
> URL: https://issues.apache.org/jira/browse/TUSCANY-1812
> Project: Tuscany
> Issue Type: Bug
> Components: Java SDO Implementation
> Affects Versions: Java-SDO-Next
> Reporter: Ron Gavlin
> Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test
> resources. Also, please find the stacktrace from the failing Java test case.
> It is interesting to note that this test does not fail when using dynamic
> SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>
> public void test() throws IOException {
> HelperContext hc = HelperProvider.getDefaultContext();
> SEVFactory.INSTANCE.register(hc);
>
> XMLHelper xmlHelper = hc.getXMLHelper();
> DataObject loadedObject =
> xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
> }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.example.com/substitutionEV"
> xmlns:sv="http://www.example.com/substitutionEV">
> <!--
> Licensed to the Apache Software Foundation (ASF) under one
> or more contributor license agreements. See the NOTICE file
> distributed with this work for additional information
> regarding copyright ownership. The ASF licenses this file
> to you under the Apache License, Version 2.0 (the
> "License"); you may not use this file except in compliance
> with the License. You may obtain a copy of the License at
>
> http://www.apache.org/licenses/LICENSE-2.0
>
> Unless required by applicable law or agreed to in writing,
> software distributed under the License is distributed on an
> "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> KIND, either express or implied. See the License for the
> specific language governing permissions and limitations
> under the License.
> -->
> <element name="results" type="sv:ResultsType"/>
>
> <element name="result" type="sv:ResultType"/>
> <element name="myResult" type="sv:MyResultType"
> substitutionGroup="sv:result"/>
>
> <complexType name="ResultsType">
> <sequence>
> <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
> <element name="comment" type="string"/>
> </sequence>
> </complexType>
>
> <complexType name="ResultType">
> <sequence>
> <element name="name" type="string"/>
> <element name="value" type="string"/>
> </sequence>
> </complexType>
> <complexType name="MyResultType">
> <complexContent>
> <extension base="sv:ResultType"/>
> </complexContent>
> </complexType>
>
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
> <sev:result>
> <sev:name>name1</sev:name>
> <sev:value>value1</sev:value>
> </sev:result>
> <sev:myResult>
> <sev:name>myName1</sev:name>
> <sev:value>myValue1</sev:value>
> </sev:myResult>
> <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature
> 'myResult' not found. (http:///temp.xml, 7, 17)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> at
> org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> at
> org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> at
> org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> at
> org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> at
> org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> at
> org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 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:585)
> 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
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 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)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature
> 'myResult' not found. (http:///temp.xml, 7, 17)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> at
> org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> at
> org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> at
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> at
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> ... 24 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]