You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Simon Laws (JIRA)" <tu...@ws.apache.org> on 2006/06/16 15:49:29 UTC
[jira] Created: (TUSCANY-475) Class cast exception on
Class cast exception on
------------------------
Key: TUSCANY-475
URL: http://issues.apache.org/jira/browse/TUSCANY-475
Project: Tuscany
Type: Bug
Components: Java DAS RDB
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
[jira] Updated: (TUSCANY-475) Class cast exception on
Posted by "Brent Daniel (JIRA)" <tu...@ws.apache.org>.
[ 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
[jira] Resolved: (TUSCANY-475) Class cast exception on
Posted by "ant elder (JIRA)" <tu...@ws.apache.org>.
[ http://issues.apache.org/jira/browse/TUSCANY-475?page=all ]
ant elder resolved TUSCANY-475:
-------------------------------
Resolution: Fixed
Applied. Thanks for the patch Kelvin!
> 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
> Attachments: T475.patch
>
> 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
[jira] Updated: (TUSCANY-475) Class cast exception on
Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
[ http://issues.apache.org/jira/browse/TUSCANY-475?page=all ]
Kelvin Goodson updated TUSCANY-475:
-----------------------------------
Attachment: T475.patch
This patch is rooted in the directory java/sdo/impl.
The test has been updated with method testListIndexing().
The DataIObjectUtil.Accessor.setIndex() method now guards against negative values and throws IndexOutOfBounds as soon as a negative value is encountered. The special value NO_INDEX is used when the Property is not a vector and is set to -1, therefore the amended setIndex method must not be used to set a value of NO_INDEX. A comment to that effect has been added.
> 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
> Attachments: T475.patch
>
> 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