[ 
https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530763
 ] 

Ron Gavlin commented on TUSCANY-1812:
-------------------------------------

Here's more info.

The problem indeed occurs during the invocation of 
BasicExtendedMetaData.createEStructuralFeatureExtendedMetaData() which 
instantiates the inner class 
BasicExtendedMetaData.EStructuralFeatureExtendedMetaDataImpl. This inner class 
relies on its outer class to access the registry. In the dynamic SDO case, the 
outer class is SDOExtendedMetaDataImpl which contains the correct registry. In 
the static SDO case, the outer class is EMF's BasicExtendedMetaData which 
contains the incorrect registry. I have pasted the two stack traces below for 
comparison. Later on, the getAffiliation() method is invoked which triggers the 
problem registry access in the outer class.

In order to fix the static SDO case, should "DocumentRoot" be handled as a 
special case? This would avoid going down the EMF-centric DynamicDataObjectImpl 
path evident in the stack trace. Or, is another more generic fix appropriate? 

Obviously, this is a pressing issue for us. If this is a problem you have time 
to address and think you can fix in a timely fashion, then I'll let you take it 
from here. Otherwise, if you or one of the other committers could provide me 
some direction for fixing the problem, I would appreciate it.

Thanks,

- Ron

STATIC SDO

Thread [main] (Suspended (breakpoint at line 2904 in BasicExtendedMetaData))    
        
BasicExtendedMetaData.createEStructuralFeatureExtendedMetaData(EStructuralFeature)
 line: 2904   
        BasicExtendedMetaData.getExtendedMetaData(EStructuralFeature) line: 
2896        
        BasicExtendedMetaData.getFeatureKind(EStructuralFeature) line: 407      
        BasicExtendedMetaData.getElements(EClass) line: 922     
        BasicExtendedMetaData.getAllElements(EClass) line: 869  
        FeatureMapUtil$BasicValidator.<init>(EClass, EStructuralFeature) line: 
1394     
        FeatureMapUtil.getValidator(EClass, EStructuralFeature) line: 1533      
        BasicFeatureMap.<init>(InternalEObject, int) line: 47   
        
AttributeImpl$InternalSettingDelegateSequence(EStructuralFeatureImpl$InternalSettingDelegateMany).createDynamicSetting(InternalEObject)
 line: 1602      
        
AttributeImpl$InternalSettingDelegateSequence.createDynamicSetting(InternalEObject)
 line: 188   
        <unknown receiving 
type>(EStructuralFeatureImpl$InternalSettingDelegateMany).dynamicGet(InternalEObject,
 EStructuralFeature$Internal$DynamicValueHolder, int, boolean, boolean) line: 
1627      
        DynamicDataObjectImpl.eDynamicGet(int, boolean, boolean) line: 146      
        DynamicDataObjectImpl(DataObjectImpl).eGet(int, boolean, boolean) line: 
1463    
        DynamicDataObjectImpl(BasicEObjectImpl).eGet(EStructuralFeature, 
boolean, boolean) line: 595    
        DynamicDataObjectImpl(BasicEObjectImpl).eGet(EStructuralFeature, 
boolean) line: 587     
        DynamicDataObjectImpl(BasicEObjectImpl).eGet(EStructuralFeature) line: 
582      
        
SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).processTopObject(EObject)
 line: 1272   
        
SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).createDocumentRoot(String,
 String, String, EFactory, boolean) line: 1236       
        
SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).createObjectByType(String,
 String, boolean) line: 1165 
        
SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).createTopObject(String,
 String) line: 1247     
        
SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).processElement(String, 
String, String) line: 883       
        
SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).startElement(String, 
String, String) line: 866 
        
SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).startElement(String, 
String, String, Attributes) line: 627     
        SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(String, 
String, String, Attributes) line: 401 
...


DYNAMIC SDO

Thread [main] (Suspended (breakpoint at line 2904 in BasicExtendedMetaData))    
        
SDOExtendedMetaDataImpl(BasicExtendedMetaData).createEStructuralFeatureExtendedMetaData(EStructuralFeature)
 line: 2904  
        
SDOExtendedMetaDataImpl(BasicExtendedMetaData).getExtendedMetaData(EStructuralFeature)
 line: 2896       
        
SDOExtendedMetaDataImpl(BasicExtendedMetaData).setFeatureKind(EStructuralFeature,
 int) line: 446        
        SDOXSDEcoreBuilder(BaseSDOXSDEcoreBuilder).createFeature(EClass, 
String, EClassifier, XSDComponent, int, int) line: 1167        
        SDOXSDEcoreBuilder.createFeature(EClass, String, EClassifier, 
XSDComponent, int, int) line: 367 
        SDOXSDEcoreBuilder(BaseSDOXSDEcoreBuilder).createFeature(EClass, 
XSDElementDeclaration, String, XSDComponent, int, int) line: 1439      
        
SDOXSDEcoreBuilder(BaseSDOXSDEcoreBuilder).getEStructuralFeature(XSDFeature) 
line: 1476 
        SDOXSDEcoreBuilder(BaseSDOXSDEcoreBuilder).generate(XSDSchema) line: 
1517       
        XSDHelperImpl.define(InputSource, String) line: 246     
        XSDHelperImpl.define(InputStream, String) line: 224     
        SubstitutionWithExtensionValuesTestCase.test() line: 40 
...


> 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]

Reply via email to