You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andriy Redko (Jira)" <ji...@apache.org> on 2021/12/07 17:02:00 UTC
[jira] [Updated] (CXF-8624) CXF Extension @QueryParam("") does not parse correctly LocalDate in the bean
[ https://issues.apache.org/jira/browse/CXF-8624?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andriy Redko updated CXF-8624:
------------------------------
Affects Version/s: 3.3.12
> CXF Extension @QueryParam("") does not parse correctly LocalDate in the bean
> ----------------------------------------------------------------------------
>
> Key: CXF-8624
> URL: https://issues.apache.org/jira/browse/CXF-8624
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 3.3.12, 3.4.5
> Reporter: Anthony Durussel
> Assignee: Andriy Redko
> Priority: Major
> Fix For: 3.4.6
>
>
> If you use the @QueryParam("") extension on a method parameter:
> {code:java}
> public void foo(@QueryParam("") Bar bar);
> {code}
> with Bar class equals to :
> {code:java}
> public class Bar {
> private LocalDate date;
> } {code}
> The URL generate from the following method parse the localDate as a standard object instead of singleValue as it's done for standard java.util.date
> {code:java}
> org.apache.cxf.jaxrs.utils.InjectionUtils.fillInValuesFromBean(Object, String, MultivaluedMap<String, Object>)
> {code}
> {code:java}
> if (isPrimitive(value.getClass()) || Date.class.isAssignableFrom(value.getClass())) {
> values.putSingle(propertyName, value);
> } else if (value.getClass().isEnum()) {
> values.putSingle(propertyName, value.toString());
> } else if (isSupportedCollectionOrArray(value.getClass())) {
> final List<Object> theValues;
> if (value.getClass().isArray()) {
> theValues = Arrays.asList((Object[])value);
> } else if (value instanceof Set) {
> theValues = new ArrayList<>((Set<?>)value);
> } else {
> theValues = CastUtils.cast((List<?>)value);
> }
> values.put(propertyName, theValues);
> } else if (Map.class.isAssignableFrom(value.getClass())) {
> if (isSupportedMap(m.getGenericReturnType())) {
> Map<Object, Object> map = CastUtils.cast((Map<?, ?>)value);
> for (Map.Entry<Object, Object> entry : map.entrySet()) {
> values.add(propertyName + '.' + entry.getKey().toString(),
> entry.getValue().toString());
> }
> }
> } else {
> fillInValuesFromBean(value, propertyName, values);
> }{code}
> Ideally, we should add the LocalDate in the first "if condition" to handle it correctly
--
This message was sent by Atlassian Jira
(v8.20.1#820001)