refined PropertyEditor exposure for the ConversionService case

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2670 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller
2009-12-15 11:34:19 +00:00
parent c4d1940d06
commit 95d1eccd65
3 changed files with 21 additions and 14 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,16 +59,16 @@ abstract class ValueFormatter {
if (propertyEditor != null && !(value instanceof String)) {
try {
propertyEditor.setValue(value);
return getDisplayString(propertyEditor.getAsText(), htmlEscape);
String text = propertyEditor.getAsText();
if (text != null) {
return getDisplayString(text, htmlEscape);
}
}
catch (Throwable ex) {
// The PropertyEditor might not support this value... pass through.
return getDisplayString(value, htmlEscape);
}
}
else {
return getDisplayString(value, htmlEscape);
}
return getDisplayString(value, htmlEscape);
}
}