Polishing

Issue: SPR-11215
This commit is contained in:
Juergen Hoeller
2013-12-17 21:39:40 +01:00
parent 67abeb4722
commit 234272eb8f
3 changed files with 48 additions and 37 deletions

View File

@@ -21,8 +21,8 @@ import org.springframework.core.convert.TypeDescriptor;
/**
* A type converter can convert values between different types encountered during
* expression evaluation. This is an SPI for the expression parser; see
* {@link org.springframework.core.convert.ConversionService} for the primary user API to
* Spring's conversion facilities.
* {@link org.springframework.core.convert.ConversionService} for the primary
* user API to Spring's conversion facilities.
*
* @author Andy Clement
* @author Juergen Hoeller
@@ -31,8 +31,8 @@ import org.springframework.core.convert.TypeDescriptor;
public interface TypeConverter {
/**
* Return true if the type converter can convert the specified type to the desired
* target type.
* Return {@code true} if the type converter can convert the specified type
* to the desired target type.
* @param sourceType a type descriptor that describes the source type
* @param targetType a type descriptor that describes the requested result type
* @return true if that conversion can be performed
@@ -46,9 +46,9 @@ public interface TypeConverter {
* than simply a List.
* @param value the value to be converted
* @param sourceType a type descriptor that supplies extra information about the
* source object
* source object
* @param targetType a type descriptor that supplies extra information about the
* requested result type
* requested result type
* @return the converted value
* @throws EvaluationException if conversion is not possible
*/

View File

@@ -67,11 +67,13 @@ public class StandardTypeConverter implements TypeConverter {
try {
return this.conversionService.convert(value, sourceType, targetType);
}
catch (ConverterNotFoundException cenfe) {
throw new SpelEvaluationException(cenfe, SpelMessage.TYPE_CONVERSION_ERROR, sourceType.toString(), targetType.toString());
catch (ConverterNotFoundException ex) {
throw new SpelEvaluationException(
ex, SpelMessage.TYPE_CONVERSION_ERROR, sourceType.toString(), targetType.toString());
}
catch (ConversionException ce) {
throw new SpelEvaluationException(ce, SpelMessage.TYPE_CONVERSION_ERROR, sourceType.toString(), targetType.toString());
catch (ConversionException ex) {
throw new SpelEvaluationException(
ex, SpelMessage.TYPE_CONVERSION_ERROR, sourceType.toString(), targetType.toString());
}
}