]
Steven Hawkins resolved TEIID-4856.
-----------------------------------
Fix Version/s: 9.3
Resolution: Done
Ensured that at least 1 result exists.
OData - Teiid throws IndexOutOfBoundsException if user requests value
of nonexistent propery
--------------------------------------------------------------------------------------------
Key: TEIID-4856
URL:
https://issues.jboss.org/browse/TEIID-4856
Project: Teiid
Issue Type: Bug
Components: OData
Affects Versions: 9.3
Reporter: Juraj DurĂ¡ni
Assignee: Steven Hawkins
Fix For: 9.3
If user requests property of entity which is not present, Teiid returns 404 (this is
correct behavior). However, if user requests value of the property ($value), Teiid returns
500 which is cause by IndexOutOfBoundsException \[1\]. VDB \[2\].
http://localhost:8080/odata4/vdb/test/t1(1)/fk/id/ - returns 404
http://localhost:8080/odata4/vdb/test/t1(1)/fk/id/$value - returns 500
{code:text|title=\[1\] Exception}
09:20:27,462 ERROR [org.teiid.ODATA] (default task-26) TEIID16052 Unable to process
odata request due to: Index: 0, Size: 0: java.lang.IndexOutOfBoundsException: Index: 0,
Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:638)
at java.util.ArrayList.get(ArrayList.java:414)
at org.teiid.olingo.service.TeiidServiceHandler$1.visit(TeiidServiceHandler.java:189)
at
org.apache.olingo.server.core.responses.PrimitiveValueResponse.accepts(PrimitiveValueResponse.java:113)
at org.teiid.olingo.service.TeiidServiceHandler.read(TeiidServiceHandler.java:179)
at
org.apache.olingo.server.core.requests.DataRequest$ValueRequest.execute(DataRequest.java:674)
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:67)
at org.teiid.olingo.web.ODataServlet.service(ODataServlet.java:43)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
at org.teiid.olingo.web.ODataFilter.internalDoFilter(ODataFilter.java:228)
at org.teiid.olingo.web.ODataFilter.doFilter(ODataFilter.java:100)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
at
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.teiid.olingo.web.gzip.GzipFilter.doFilter(GzipFilter.java:61)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
at
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.teiid.olingo.web.CorsFilter.doFilter(CorsFilter.java:80)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
at
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at
org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at
io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at
io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at
io.undertow.server.handlers.DisableCacheHandler.handleRequest(DisableCacheHandler.java:33)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at
io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:51)
at
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at
io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at
io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:56)
at
io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at
io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at
io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
at
io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at
org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at
io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
at
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
at
io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
at
io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:744)
{code}
{code:xml|title=\[2\] VDB}
<vdb name="vdb" version="1">
<model name="test" type="VIRTUAL">
<metadata>
CREATE VIEW t1 (
id integer PRIMARY KEY,
fid integer,
CONSTRAINT fk FOREIGN KEY (fid) REFERENCES t1(id))
AS
SELECT 1, null;
</metadata>
</model>
</vdb>
{code}