refined PropertyEditor exposure for the ConversionService case

This commit is contained in:
Juergen Hoeller
2009-12-15 11:34:19 +00:00
parent 0057481a0a
commit 5f9f69958e
3 changed files with 21 additions and 14 deletions

View File

@@ -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);
}
}