[
https://issues.jboss.org/browse/TEIID-2871?page=com.atlassian.jira.plugin...
]
Steven Hawkins resolved TEIID-2871.
-----------------------------------
Resolution: Done
Changed the top level mapping of Teiid byte to SByte and changed the translator mapping of
SByte to Short so that we retain the unsigned behavior.
Incorrect datatype conversion for java.lang.Byte
------------------------------------------------
Key: TEIID-2871
URL:
https://issues.jboss.org/browse/TEIID-2871
Project: Teiid
Issue Type: Bug
Components: OData
Affects Versions: 8.3
Environment: On windows 7 with JBoss DV 6 GA
Reporter: Patrick Deenen
Assignee: Steven Hawkins
Priority: Critical
Fix For: 8.7
When doing a simple odata query on a view which contains a column with a data type of
byte the following exception is thrown:
{quote}
10:37:46,642 WARN [org.teiid.ODATA] (http-localhost/127.0.0.1:8080-1) TEIID16012 Could
not produce a sucessful OData response. Returning status ServerErrorException with
message java.lang.Byte cannot be cast to org.odata4j.core.UnsignedByte.:
org.odata4j.exceptions.ServerErrorException: java.lang.Byte cannot be cast to
org.odata4j.core.UnsignedByte
at org.teiid.odata.LocalClient.executeSQL(LocalClient.java:238) [classes:]
at org.teiid.odata.TeiidProducer.getNavProperty(TeiidProducer.java:90) [classes:]
at org.teiid.odata.TeiidProducer.getEntities(TeiidProducer.java:79) [classes:]
at
org.odata4j.producer.resources.EntitiesRequestResource.getEntitiesImpl(EntitiesRequestResource.java:371)
[odata4j-core-0.8.0-SNAPSHOT-redhat.jar:]
at
org.odata4j.producer.resources.EntitiesRequestResource.getEntities(EntitiesRequestResource.java:266)
[odata4j-core-0.8.0-SNAPSHOT-redhat.jar:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[rt.jar:1.6.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[rt.jar:1.6.0_45]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_45]
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
[resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]
at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
[resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
[resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
[resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]
at
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
[resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
[resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
[resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]
at
org.teiid.odata.ODataServletContainerDispatcher.service(ODataServletContainerDispatcher.java:97)
[classes:]
at org.teiid.odata.ODataServlet.service(ODataServlet.java:61) [classes:]
at
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
[resteasy-jaxrs-2.3.6.Final-redhat-1.jar:2.3.6.Final-redhat-1]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
[jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at
org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.event(JBossWebContext.java:91)
at
org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.invoke(JBossWebContext.java:72)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:499)
[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
[jboss-as-web-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)
[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)
[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920)
[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_45]
Caused by: java.lang.ClassCastException: java.lang.Byte cannot be cast to
org.odata4j.core.UnsignedByte
at org.odata4j.core.OSimpleObjects.create(OSimpleObjects.java:47)
[odata4j-core-0.8.0-SNAPSHOT-redhat.jar:]
at org.odata4j.core.OProperties.simple(OProperties.java:54)
[odata4j-core-0.8.0-SNAPSHOT-redhat.jar:]
at org.teiid.odata.EntityList.buildPropery(EntityList.java:105) [classes:]
at org.teiid.odata.EntityList.getEntity(EntityList.java:114) [classes:]
at org.teiid.odata.EntityList.<init>(EntityList.java:85) [classes:]
at org.teiid.odata.LocalClient.executeSQL(LocalClient.java:236) [classes:]
... 35 more
{quote}
This is probably due to the fact that in class
org.teiid.translator.odata.ODataTypeManager the following is defined:
{code}
teiidkeyed.put(DataTypeManager.DefaultDataTypes.BYTE, EdmSimpleType.BYTE);
{code}
instead of
{code}
teiidkeyed.put(DataTypeManager.DefaultDataTypes.BYTE, EdmSimpleType.SBYTE);
{code}
The EdmSimpleType.BYTE tries to cast to the build in org.odata4j.core.UnsignedByte type
which is not possible for a java.lang.Byte.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira