Chris,

I guess Frank's fix would work which is to use XSDResourceFactoryImpl always 
inside XSDHelper.define() to load the file.

Fuhwei Lwo

Fuhwei Lwo <[EMAIL PROTECTED]> wrote: Hi Chris,

Currently SDO is using the extension to decide what resource factory should be 
used to load the content of the file. If the extension is .xsd or .wsdl, 
XSDResourceFactoryImpl was used. If it's .xml, SDOXMLResourceFactoryImpl was 
used. If the extension couldn't be recognized, the default is 
SDOXMLResourceFactoryImpl. In your case, since the .tmp couldn't be recognized, 
SDOXMLResourceFactoryImpl was used to attempt loading the file.

In EMF, you need to set up the resource factory yourself before loading. In 
SDO, it hides all these details and procedures for you for simplicity.

>From a SDO user point of view, can you offer some suggestion for possible 
>solutions?  Thanks.

Fuhwei Lwo

"Chris Mildebrandt (JIRA)"  wrote: [Java SDO] ClassCastException when defining 
schema file without .xsd extension
------------------------------------------------------------------------------

                 Key: TUSCANY-1333
                 URL: https://issues.apache.org/jira/browse/TUSCANY-1333
             Project: Tuscany
          Issue Type: Bug
          Components: Java SDO Tools
    Affects Versions: Java-SDO-beta1
         Environment: IBM JDK 1.4.2
            Reporter: Chris Mildebrandt


With the following code:

HelperContext context = SDOUtil.createHelperContext();
context.getXSDHelper().define(new FileInputStream("./Person.xsd.tmp"), (new 
File("./Person.xsd.tmp")).toURI().toString());

I get the following exception:

java.lang.ClassCastException: 
org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl
 at org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:245)
 at org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:236)
 at Test.doubleContextTest(Test.java:193)
 at Test.main(Test.java:214)
Exception in thread "main" java.lang.IllegalArgumentException: 
org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl
 at org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:278)
 at org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java:236)
 at Test.doubleContextTest(Test.java:193)
 at Test.main(Test.java:214)

If I remove the .tmp from the schema file name, the exception goes away. 

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