You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Brent Daniel (JIRA)" <tu...@ws.apache.org> on 2006/06/16 16:34:31 UTC

[jira] Updated: (TUSCANY-475) Class cast exception on

     [ http://issues.apache.org/jira/browse/TUSCANY-475?page=all ]

Brent Daniel updated TUSCANY-475:
---------------------------------

    Component: Java SDO Implementation
                   (was: Java DAS RDB)

The indexing here should start at 1. As for the error, when you try to use a zero index it should probably be handled the way other out of bounds indices are handled, by throwing an IndexOutOfBoundsException. Assigning this over to the SDO component. 

> Class cast exception on
> -----------------------
>
>          Key: TUSCANY-475
>          URL: http://issues.apache.org/jira/browse/TUSCANY-475
>      Project: Tuscany
>         Type: Bug

>   Components: Java SDO Implementation
>     Versions: Java-M1
>  Environment: Windows XP
>     Reporter: Simon Laws

>
> I'm trying to retrieve rows from a database via the relational DAS. When I run my test prgram I get 
> Exception in thread "main" java.lang.ClassCastException: org.eclipse.emf.ecore.util.EcoreEList$Dynamic incompatible with commonj.sdo.DataObject
> 	at org.apache.tuscany.sdo.impl.DataObjectImpl.getDataObject(DataObjectImpl.java:322)
> 	at org.apache.tuscany.sdo.interop.SDOInterop.testReadAndWriteRelationalDB2(SDOInterop.java)
> 	at org.apache.tuscany.sdo.interop.SDOInterop.main(SDOInterop.java:136)
> The code looks like.
>         CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getClass().getResourceAsStream("interopconfig-db2.xml"));
>         Command read = commandGroup.getCommand("all type");
>         DataObject root = read.executeQuery();
>         DataObject firstRow = root.getDataObject("alltype[0]");
> Now I expect to get a "firstRow" DataObject back. Indeed DataObjectImpl.getDataObject() casts the return to a DataObject
>   public DataObject getDataObject(String path)
>   {
>     return (DataObject)get(path);
>   }
> However the the DataObjectUtil.get() operation creates an Accessor and calls getAndRecycle
>   public static Object get(DataObject dataObject, String path) 
>   {
>     Property property = dataObject.getType().getProperty(path);
>     if (property != null) {
>       return dataObject.get(property);
>     } else {
>       return Accessor.create((EObject)dataObject, path).getAndRecyle();
>     }
>   }
> getAndRecycle call get which, because I have specified a 0 index, just returns  the value which happens to be of type EcoreEList$Dynamic
> So while I may have an error in my code somewhere or it might not be retrieving any data from the database a class cast exception  inside of SDO doesn't seem like the correct way to tell me. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org