-
Couldn't load subscription status.
- Fork 38.8k
Description
Janning Vygen opened SPR-11215 and commented
Image I have an IBAN saved as a String and a @IBANFormat to trigger formatting. When I render the IBAN with spring:eval it does not work.
ExpressionUtils does not call ConversionService if both types are the same and lacking formatting the value.
Line 66 in ExpressionUtils:
{{
public static <T> T convertTypedValue(EvaluationContext context, TypedValue typedValue, Class<T> targetType) {
Object value = typedValue.getValue();
if ((targetType == null) || (value != null && ClassUtils.isAssignableValue(targetType, value))) {
return (T) value;
}
if (context != null) {
return (T) context.getTypeConverter().convertValue(value, typedValue.getTypeDescriptor(), TypeDescriptor.valueOf(targetType));
}
throw new EvaluationException("Cannot convert value '" + value + "' to type '" + targetType.getName() + "'");
}
}}
The first "if" statement is triggered because both values are Strings. No conversion and no formatting takes place.
More details at the link from StackOverflow
Affects: 4.0 GA
Reference URL: http://stackoverflow.com/questions/20542259/