[ https://issues.apache.org/jira/browse/TUSCANY-1317?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Amita Vadhavkar updated TUSCANY-1317: ------------------------------------- Attachment: 1317.patch Attached clean patch for JIRA "1317.patch" dated July 3, this does not have any code from JIRA 1391 as well as all commented code removed (which was there due to restructuring of HelperContext<->Helpers relationship) Reason for changes to existing test cases during JIRA 1317 to pass XML_LOAD_SCHEMA as FALSE explicitly is - Before this JIRA, when no option was passed, default assumed was FALSE, and the existing test cases passed even though there were MalFormedURL in the test documents. With default to TRUE now, the processSchemaLocation option in EMF is set to TRUE and the MalformedURLs are not ignored. Say, in XMLDocumentTestCase.testSchemaLocation() - if no FALSE is sent, it takes path of TRUE as that is the default now. In this, in SDOXMLResourceImpl.doLoad() { ... super.doLoad(inputSource, options); } the call to super.doLoad() throws the below exception, as due to default true, xmlOptions.setProcessSchemaLocation(true); takes place. java.net.MalformedURLException at java.net.URL.<init>(URL.java:601) at java.net.URL.<init>(URL.java:464) at java.net.URL.<init>(URL.java:413) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:968) at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:184) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:798) 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.DOMParser.parse(DOMParser.java:250) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292) at org.eclipse.xsd.util.XSDResourceImpl.getDocument(XSDResourceImpl.java:335) at org.eclipse.xsd.util.XSDResourceImpl.getDocument(XSDResourceImpl.java:372) at org.eclipse.xsd.util.XSDResourceImpl.doLoad(XSDResourceImpl.java:680) at org.eclipse.xsd.util.XSDResourceImpl.load(XSDResourceImpl.java:617) at org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:296) at org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:286) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$5.generate(SDOXMLResourceImpl.java:532) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processSchemaLocations(XMLHandler.java:1462) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleTopLocations(SDOXMLResourceImpl.java:264) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1142) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1247) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:883) 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:364) 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.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:779) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1794) 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) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:546) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634) at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:259) at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:232) at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:129) at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:100) at org.apache.tuscany.sdo.test.XMLDocumentTestCase.testSchemaLocation(XMLDocumentTestCase.java:68) 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: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) java.net.MalformedURLException at java.net.URL.<init>(URL.java:601) at java.net.URL.<init>(URL.java:464) at java.net.URL.<init>(URL.java:413) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:968) at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:184) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:798) 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.DOMParser.parse(DOMParser.java:250) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292) at org.eclipse.xsd.util.XSDResourceImpl.getDocument(XSDResourceImpl.java:335) at org.eclipse.xsd.util.XSDResourceImpl.getDocument(XSDResourceImpl.java:372) at org.eclipse.xsd.util.XSDResourceImpl.doLoad(XSDResourceImpl.java:680) at org.eclipse.xsd.util.XSDResourceImpl.load(XSDResourceImpl.java:617) at org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:296) at org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:286) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$5.generate(SDOXMLResourceImpl.java:532) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processSchemaLocations(XMLHandler.java:1462) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleTopLocations(SDOXMLResourceImpl.java:264) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1142) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1247) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:883) 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:364) 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.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:779) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1794) 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) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:546) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634) at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:259) at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:232) at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:129) at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:100) at org.apache.tuscany.sdo.test.XMLDocumentTestCase.testSchemaLocation(XMLDocumentTestCase.java:68) 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: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) java.net.MalformedURLException at java.net.URL.<init>(URL.java:601) at java.net.URL.<init>(URL.java:464) at java.net.URL.<init>(URL.java:413) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:968) at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:184) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:798) 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.DOMParser.parse(DOMParser.java:250) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292) at org.eclipse.xsd.util.XSDResourceImpl.getDocument(XSDResourceImpl.java:335) at org.eclipse.xsd.util.XSDResourceImpl.getDocument(XSDResourceImpl.java:372) at org.eclipse.xsd.util.XSDResourceImpl.doLoad(XSDResourceImpl.java:680) at org.eclipse.xsd.util.XSDResourceImpl.load(XSDResourceImpl.java:617) at org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:296) at org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:286) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$5.generate(SDOXMLResourceImpl.java:532) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processSchemaLocations(XMLHandler.java:1462) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleTopLocations(SDOXMLResourceImpl.java:264) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1142) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1247) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:883) 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:364) 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.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:779) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1794) 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) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:546) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634) at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:259) at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:232) at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:129) at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:100) at org.apache.tuscany.sdo.test.XMLDocumentTestCase.testSchemaLocation(XMLDocumentTestCase.java:68) 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: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) The document under use is XMLDocumentTestCase.xml.............. <sl:purchaseReport xmlns:sl="http://www.example.com/xmlDocumentSchemaLocation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.com/xmlDocumentSchemaLocation /XMLDocumentSchemaLocation.xsd http://www.example.com/open /open.xsd" xsi:noNamespaceSchemaLocation="/XMLDocumentNoNamespaceSchemaLocation.xsd" periodEnding="2007-12-31"> <sl:schemaLocationElement>some string</sl:schemaLocationElement> <aNoNamespaceSchemaLocationElement date="2006-04-01"> <anElement>another string</anElement> </aNoNamespaceSchemaLocationElement> </sl:purchaseReport> *********************************************************************** if it is changed to the one as below and also if code is changed for expected result and from [1] to [2] [1]XMLDocument doc = XMLHelper.INSTANCE.load(getClass().getResourceAsStream(TEST_XML_DOCUMENT)); [2]XMLDocument doc = XMLHelper.INSTANCE.load(getClass().getResourceAsStream(TEST_XML_DOCUMENT),"whatever", null); the case succeeds WITHOUT PASSING OPTION FALSE <sl:purchaseReport xmlns:sl="http://www.example.com/xmlDocumentSchemaLocation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.com/xmlDocumentSchemaLocation XMLDocumentSchemaLocation.xsd http://www.example.com/open open.xsd" xsi:noNamespaceSchemaLocation="XMLDocumentNoNamespaceSchemaLocation.xsd" periodEnding="2007-12-31"> <sl:schemaLocationElement>some string</sl:schemaLocationElement> <aNoNamespaceSchemaLocationElement date="2006-04-01"> <anElement>another string</anElement> </aNoNamespaceSchemaLocationElement> </sl:purchaseReport> ***************************************************************************** Thus, I thought that the clean way is to make the same code path as before to be traversed by the test case as that way the test case will succeed without no "virtual" change, i.e. the option passed is only to ensure that old code path is taken by test case. This is the same analysis for all the 3 test classes (5 test cases) changes for passing explicit FALSE option. > Provide a way to set default XML load options to be used during Java > deserialization > ------------------------------------------------------------------------------------ > > Key: TUSCANY-1317 > URL: https://issues.apache.org/jira/browse/TUSCANY-1317 > Project: Tuscany > Issue Type: New Feature > Components: Java SDO Implementation > Affects Versions: Java-SDO-beta1, Java-SDO-1.0 > Reporter: Daniel Peter > Fix For: Java-SDO-1.0 > > Attachments: 1317.patch, 1317.patch, 1317.patch, JIRA1317Design.txt, > JIRA1317Design.txt, JIRA_1317_June21.txt, JIRA_1317_June25_Amita.txt > > > XML load options can be passed when calling the XMLHelper.load(...) methods. > But there is currently no way to pass such load options to be used during > Java deserialization. > Thus a way to set default load options should be provided, e.g. > SDOUtil.setDefaultXMLOptions(HelperContext, Object options) > These default options could then be picked up during Java deserialization, > i.e. in the method readDataObject in class HelperProviderImpl.ResolvableImpl. > Additionally the XMLResource.OPTION_RECORD_UNKNOWN_FEATURE option could be > exposed in Tuscany SDO. -- 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]