cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frederic MONCLAR (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-6880) ODATA Parser : searching object from Id of its nested object failed
Date Tue, 26 Apr 2016 15:17:13 GMT

    [ https://issues.apache.org/jira/browse/CXF-6880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15258252#comment-15258252
] 

Frederic MONCLAR commented on CXF-6880:
---------------------------------------


When the odata request "$filter=call.id eq 1" is treated, the "property.typeInfo" return "Call"
and then go deeper to analyse Id from Call, and at the end it tries to get type returned by
getId() method which is "Integer extends Serializable" but it returns only Serializable. Which
is not a problem when requesting Id from main class (CalHeader).
What is surprising me is that the way to get the "typedValue" is not the same when going deeper.
At top level, we get "typedValue" directly  from "value.value", but deeper, you manage "value"
via "value.literal" as a string in private method "parseType" and finally doesn't use it in
the "else" condition part of "if (index == -1)" (line 167). The "typedValue" should be the
one of the right side of the expression in all cases. I think the top level test or mechanism
is missing.

Fred

> ODATA Parser : searching object from Id of its nested object failed
> -------------------------------------------------------------------
>
>                 Key: CXF-6880
>                 URL: https://issues.apache.org/jira/browse/CXF-6880
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 3.1.6
>         Environment: Jdk 1.8, Spring, JPA, REST
>            Reporter: Frederic MONCLAR
>            Priority: Blocker
>         Attachments: class hierarchy.png
>
>
> Hi,
> I'm using odata parser to manage odata request. When I'm doing a simple request as :
$filter=id eq 1 on object entity containing id parameter, the matching type action is resolved,
but when I'm doing it again on a nested object on the same parameter type as : $filter=call.id
eq 1 it failed.
> I'm getting the following exception : 
> 2016-04-25 12:20:12.728  INFO 12020 --- [nio-8081-exec-1] o.a.c.c.C.[.[.[/api/business/v0]
        : Initializing Spring FrameworkServlet 'dispatcherServlet'
> 2016-04-25 12:20:12.768 DEBUG 12020 --- [nio-8081-exec-1] o.s.b.c.web.OrderedRequestContextFilter
 : Bound request context to thread: org.apache.catalina.connector.RequestFacade@35a2318d
> 2016-04-25 12:20:13.235 DEBUG 12020 --- [nio-8081-exec-1] o.s.b.c.web.OrderedRequestContextFilter
 : Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@35a2318d
> 2016-04-25 12:20:13.239 ERROR 12020 --- [nio-8081-exec-1] o.a.c.c.C.[.[.[.[dispatcherServlet]
     : Servlet.service() for servlet [dispatcherServlet] in context with path [/api/business/v0]
threw exception [Request processing failed; nested exception is fr.gyptis.ci5.backend.commons.exception.RequestException:
org.apache.cxf.jaxrs.ext.search.SearchParseException: Cannot convert String value "1" to a
value of class fr.gyptis.ci5.backend.business.dao.entities.Call] with root cause
> java.lang.NoSuchMethodException: java.io.Serializable.<init>()
> 	at java.lang.Class.getConstructor0(Class.java:3082) ~[na:1.8.0_72]
> 	at java.lang.Class.newInstance(Class.java:412) ~[na:1.8.0_72]
> 	at org.apache.cxf.jaxrs.ext.search.AbstractSearchConditionParser.parseType(AbstractSearchConditionParser.java:208)
~[cxf-rt-rs-extension-search-3.1.6.jar:3.1.6]
> 	at org.apache.cxf.jaxrs.ext.search.odata.ODataParser.access$600(ODataParser.java:61)
~[cxf-rt-rs-extension-search-3.1.6.jar:3.1.6]
> 	at org.apache.cxf.jaxrs.ext.search.odata.ODataParser$FilterExpressionVisitor.visitBinary(ODataParser.java:173)
~[cxf-rt-rs-extension-search-3.1.6.jar:3.1.6]
> 	at org.apache.olingo.odata2.core.uri.expression.BinaryExpressionImpl.accept(BinaryExpressionImpl.java:90)
~[olingo-odata2-core-2.0.6.jar:2.0.6]
> 	at org.apache.olingo.odata2.core.uri.expression.FilterExpressionImpl.accept(FilterExpressionImpl.java:58)
~[olingo-odata2-core-2.0.6.jar:2.0.6]
> 	at org.apache.cxf.jaxrs.ext.search.odata.ODataParser.parse(ODataParser.java:286) ~[cxf-rt-rs-extension-search-3.1.6.jar:3.1.6]
> 	at fr.gyptis.ci5.backend.business.init.SearchContext.getCondition(SearchContext.java:118)
~[classes/:na]
> 	at fr.gyptis.ci5.backend.business.init.SearchContext.getCondition(SearchContext.java:99)
~[classes/:na]
> 	at fr.gyptis.ci5.backend.business.init.SearchContext.getCondition(SearchContext.java:94)
~[classes/:na]
> 	at fr.gyptis.ci5.backend.business.init.SearchContext.getCondition(SearchContext.java:81)
~[classes/:na]
> 	at fr.gyptis.ci5.backend.business.dao.facade.impl.CallHeaderDaoImpl.findAllByCriteria(CallHeaderDaoImpl.java:45)
~[classes/:na]
> 	at fr.gyptis.ci5.backend.business.resources.CallHeaderResource.findAll(CallHeaderResource.java:81)
~[classes/:na]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_72]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_72]
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.8.0_72]
> 	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_72]
> 	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222)
~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814)
~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737)
~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)
~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:860)
~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845)
~[spring-webmvc-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) ~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:178)
~[spring-orm-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at fr.gyptis.ci5.backend.business.init.SearchParamFilter.doFilterInternal(SearchParamFilter.java:26)
~[classes/:na]
> 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87)
~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
~[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) [tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521) [tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_72]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_72]
> 	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
[tomcat-embed-core-8.0.30.jar:8.0.30]
> 	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_72]
> extract from SpringFramework :
> @MappedSuperclass
> public abstract class AbstractPersistable<PK extends Serializable> implements Persistable<PK>
{
> 	private static final long serialVersionUID = -5554308939380869754L;
> 	@Id @GeneratedValue private PK id;
> 	/*
> 	 * (non-Javadoc)
> 	 * @see org.springframework.data.domain.Persistable#getId()
> 	 */
> 	public PK getId() {
> 		return id;
> 	}
> Thanks in advance for anyhelp.
> Fred



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message