]
Steven Hawkins commented on TEIID-5091:
---------------------------------------
[~berenger] This was addressed in the community with an upgrade of olingo. It is
definitely in the 10.0 release, but it may also be in the last 9.2 and 9.3 releases if the
fix made it into olingo 4.3.
EdmPrimitiveTypeException in OData4 parse results
-------------------------------------------------
Key: TEIID-5091
URL:
https://issues.jboss.org/browse/TEIID-5091
Project: Teiid
Issue Type: Quality Risk
Components: OData
Affects Versions: 8.12.5
Environment: * JDV 6.3
Reporter: Kylin Soong
Assignee: Steven Hawkins
Decimal type has risk if use odata4 to query data, I would use below example to show how
to reproduce the errot:
h3. set up sample data in mysql
{code}
create table test(U_ID Decimal Primary Key);
insert into test values(11);
desc test;
+-------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------------+------+-----+---------+-------+
| U_ID | decimal(10,0) | NO | PRI | NULL | |
+-------+---------------+------+-----+---------+-------+
{code}
h3. Deploy VDB
The VDB only contain one source model
{code}
<model name="TEST">
<property name="importer.useFullSchemaName"
value="false"/>
<source name="mysql-connector"
translator-name="translator-mysql5"
connection-jndi-name="java:/TEST_DS"/>
</model>
{code}
h3. Reproduce
Once the vdb deployed finished, the
http://localhost:8080/odata4/TEST_VDB/TEST/test will
return below error in web browswer
{code}
<error
xmlns="http://docs.oasis-open.org/odata/ns/metadata">
<code>null</code>
<message>
org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException: The value '11' does
not match the facets' constraints.
</message>
</error>
{code}
The server log have a error like
{code}
15:47:05,306 ERROR [org.teiid.ODATA] (http-0.0.0.0:8180-3) TEIID16050 Unable to process
odata request due to: org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException: The
value '11' does not match the facets' constraints. with cause The value
'11' does not match the facets' constraints.:
org.apache.olingo.server.api.ODataApplicationException:
org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException: The value '11' does
not match the facets' constraints.
at
org.teiid.olingo.service.TeiidServiceHandler.read(TeiidServiceHandler.java:174)
[teiid-olingo-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.apache.olingo.server.core.requests.DataRequest$EntityRequest.execute(DataRequest.java:332)
at
org.apache.olingo.server.core.requests.DataRequest.execute(DataRequest.java:255)
at
org.apache.olingo.server.core.ServiceDispatcher.internalExecute(ServiceDispatcher.java:160)
at
org.apache.olingo.server.core.ServiceDispatcher.execute(ServiceDispatcher.java:98)
at
org.apache.olingo.server.core.OData4HttpHandler.process(OData4HttpHandler.java:66)
at org.teiid.olingo.web.ODataServlet.service(ODataServlet.java:43)
[teiid-olingo-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
[jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-2.jar:1.0.2.Final-redhat-2]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
[jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
[jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at org.teiid.olingo.web.ODataFilter.internalDoFilter(ODataFilter.java:231)
[teiid-olingo-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.olingo.web.ODataFilter.doFilter(ODataFilter.java:100)
[teiid-olingo-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
[jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
[jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
[jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
[jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:512)
[jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
[jboss-as-web-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150)
[jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
[jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
[jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
[jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854)
[jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654)
[jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926)
[jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_131]
Caused by: java.sql.SQLException:
org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException: The value '11' does
not match the facets' constraints.
at
org.teiid.olingo.service.EntityCollectionResponse.createEntity(EntityCollectionResponse.java:275)
[teiid-olingo-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.olingo.service.EntityCollectionResponse.isSameEntity(EntityCollectionResponse.java:151)
[teiid-olingo-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.olingo.service.LocalClient.executeSQL(LocalClient.java:280)
[teiid-olingo-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.olingo.service.TeiidServiceHandler.executeQuery(TeiidServiceHandler.java:349)
[teiid-olingo-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.olingo.service.TeiidServiceHandler.read(TeiidServiceHandler.java:172)
[teiid-olingo-8.12.5.redhat-8.jar:8.12.5.redhat-8]
... 25 more
Caused by: org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException: The value
'11' does not match the facets' constraints.
at
org.apache.olingo.commons.core.edm.primitivetype.EdmDecimal.internalValueToString(EdmDecimal.java:185)
at
org.apache.olingo.commons.core.edm.primitivetype.AbstractPrimitiveType.valueToString(AbstractPrimitiveType.java:86)
at
org.apache.olingo.server.core.responses.EntityResponse.buildLocation(EntityResponse.java:200)
at
org.teiid.olingo.service.EntityCollectionResponse.createEntity(EntityCollectionResponse.java:247)
[teiid-olingo-8.12.5.redhat-8.jar:8.12.5.redhat-8]
... 29 more
{code}