Details
Description
When trying to filter using fiql language :
filter:"closingDate=gt=2014-11-04"
with closingDate is of type LocalDate.
We get the exception "Cannot convert String Value to a value of class LocalDate"
Cause : in AbstractSearchConditionParser:: ParseType :
if (Date.class.isAssignableFrom(valueType)) { castedValue = convertToDate(valueType, value); } else { boolean isPrimitive = InjectionUtils.isPrimitive(valueType); boolean isPrimitiveOrEnum = isPrimitive || valueType.isEnum(); if (ownerBean == null || isPrimitiveOrEnum) { try { CollectionCheck collCheck = getCollectionCheck(originalPropName, isCollection, actualType); if (collCheck == null) { castedValue = InjectionUtils.convertStringToPrimitive(value, actualType); } if (collCheck == null && isCollection) { castedValue = getCollectionSingleton(valueType, castedValue); } else if (isCollection) { typeInfo.setCollectionCheckInfo(new CollectionCheckInfo(collCheck, castedValue)); castedValue = getEmptyCollection(valueType); } } catch (Exception e) { throw new SearchParseException("Cannot convert String value \"" + value + "\" to a value of class " + valueType.getName(), e); } } else { Class<?> classType = isCollection ? valueType : value.getClass(); try { Method setterM = valueType.getMethod("set" + getMethodNameSuffix(setter), new Class[]{classType}); Object objectValue = !isCollection ? value : getCollectionSingleton(valueType, value); setterM.invoke(ownerBean, new Object[]{objectValue}); castedValue = objectValue; } catch (Throwable ex) { throw new SearchParseException("Cannot convert String value \"" + value + "\" to a value of class " + valueType.getName(), ex); } } }
{}-> here the code consider LocalDate as a primitive Type and tries to cast it.
-> Can we consider adding LocalDate and LocalDateTime types like doing with the Date type ?
Attachments
Issue Links
- links to