HHH-6408 Be tolerant with empty (ie not null) properties

This commit is contained in:
Emmanuel Bernard 2011-07-06 23:09:59 +02:00
parent 671a273e75
commit f0a8fe5643
1 changed files with 6 additions and 1 deletions

View File

@ -160,7 +160,12 @@ public final class ConfigurationHelper {
return (Integer) value; return (Integer) value;
} }
if ( String.class.isInstance( value ) ) { if ( String.class.isInstance( value ) ) {
return Integer.valueOf( (String) value ); //empty values are ignored
final String trimmed = value.toString().trim();
if ( trimmed.isEmpty() ) {
return null;
}
return Integer.valueOf( trimmed );
} }
throw new ConfigurationException( throw new ConfigurationException(
"Could not determine how to handle configuration value [name=" + name + "Could not determine how to handle configuration value [name=" + name +