added null check

This commit is contained in:
Keith Donald
2008-10-13 15:55:22 +00:00
parent f5389d81ec
commit bb5280bd62

View File

@@ -90,11 +90,15 @@ class BindingValueExpression extends ValueExpression {
}
private Object convertValueIfNecessary(Object value, Class expectedType) {
try {
return conversionService.executeConversion(value, expectedType);
} catch (ConversionException e) {
throw new ELException("Unable to coerce value " + StylerUtils.style(value) + " to expected type ["
+ expectedType + "]", e);
if (expectedType == null) {
return value;
} else {
try {
return conversionService.executeConversion(value, expectedType);
} catch (ConversionException e) {
throw new ELException("Unable to coerce value " + StylerUtils.style(value) + " to expected type ["
+ expectedType + "]", e);
}
}
}