Krzysztof Luszynski created CXF-6037: ----------------------------------------
Summary: in JAX-RS search there is no support for java.sql.Time in fiql Key: CXF-6037 URL: https://issues.apache.org/jira/browse/CXF-6037 Project: CXF Issue Type: Bug Components: JAX-RS Affects Versions: 3.0.1 Reporter: Krzysztof Luszynski Priority: Critical Fix For: 3.0.2, 3.0.1 When JPA annotated class is using java.sql.Time : ... @Temporal(TemporalType.TIME) private Time arrivalTime; ... I have set the property on the parser format of the date : Map<String, String> parserProperties = ImmutableMap.of( "search.date-format", "yyyy-MM-dd HH:mm:ss" ); searchContext.getCondition(genericType, beanProperties, parserProperties); ... and I want to use that property in url : curl -i -X GET "http://localhost:8181/cxf/.../page?_search=arrivalTime==0000-00-00%2017:00:00" I have an exception : <h3>Caused by:</h3><pre>java.lang.IllegalArgumentException: argument type mismatch; setter parameter type: java.sql.Time , set value type: java.util.Date at org.apache.cxf.jaxrs.ext.search.Beanspector.setValue(Beanspector.java:155) at org.apache.cxf.jaxrs.ext.search.Beanspector.setValue(Beanspector.java:134) at org.apache.cxf.jaxrs.ext.search.fiql.FiqlParser$Comparison.createTemplate(FiqlParser.java:387) at org.apache.cxf.jaxrs.ext.search.fiql.FiqlParser$Comparison.build(FiqlParser.java:365) at org.apache.cxf.jaxrs.ext.search.fiql.FiqlParser.parse(FiqlParser.java:166) at org.apache.cxf.jaxrs.ext.search.SearchContextImpl.getCondition(SearchContextImpl.java:98) at org.apache.cxf.jaxrs.ext.search.SearchContextImpl.getCondition(SearchContextImpl.java:69) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.cxf.jaxrs.impl.tl.ThreadLocalInvocationHandler.invoke(ThreadLocalInvocationHandler.java:46) at com.sun.proxy.$Proxy137.getCondition(Unknown Source) This is because during Condition creation the java.util.Date object is created as value instead of java.sql.Time. I have debugged the sources from : http://search.maven.org/remotecontent?filepath=org/apache/cxf/cxf-rt-rs-extension-search/3.0.1/cxf-rt-rs-extension-search-3.0.1-sources.jar The problem is in the class : org.apache.cxf.jaxrs.ext.search.AbstractSearchConditionParser#protected Object parseType(... starts in line 103 When value from fiql expression is determined there is if date can be constructed from string (line number 116): if (Date.class.isAssignableFrom(valueType)) { castedValue = convertToDate(valueType, value); } private Object convertToDate(... line number 261 ... try { if (Timestamp.class.isAssignableFrom(valueType)) { return convertToTimestamp(value); } else { return convertToDefaultDate(value); } ... The code goes to default date(value), however there should be if for java.sql.Time also and last option should be default date : java.sql.Time.class.isAssignableFrom(valueType) -- This message was sent by Atlassian JIRA (v6.3.4#6332)