Author: doogie
Date: Mon Mar 1 03:12:11 2010
New Revision: 917363
URL:
http://svn.apache.org/viewvc?rev=917363&view=revLog:
BUG FIX: Trim all space before converting a string to a Boolean.
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/BooleanConverters.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/ObjectTypeTests.java
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/BooleanConverters.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/BooleanConverters.java?rev=917363&r1=917362&r2=917363&view=diff==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/BooleanConverters.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/BooleanConverters.java Mon Mar 1 03:12:11 2010
@@ -56,7 +56,7 @@
}
public Boolean convert(String obj) throws ConversionException {
- return "TRUE".equals(obj.toUpperCase());
+ return "TRUE".equals(obj.trim().toUpperCase());
}
}
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/ObjectTypeTests.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/ObjectTypeTests.java?rev=917363&r1=917362&r2=917363&view=diff==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/ObjectTypeTests.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/ObjectTypeTests.java Mon Mar 1 03:12:11 2010
@@ -201,8 +201,8 @@
//BUG simpleTypeConvertTestSingleMulti("empty-String->anything", "", new String[] {"List", "Map"}, null);
//BUG simpleTypeConvertTestSingleMulti("empty-String->bad-class", "", new String[] {"no-class"}, null);
simpleTypeConvertTestError("String->error", "one", new String[] {});
- simpleTypeConvertTestMultiMulti("String->Boolean(true)", new String[] {"true", /*BUG " true ", " TrUe" */}, new String[] {"Boolean", "java.lang.Boolean"}, Boolean.TRUE);
- simpleTypeConvertTestMultiMulti("String->Boolean(false)", new String[] {"false", /*BUG " false ", " FaLsE" */}, new String[] {"Boolean", "java.lang.Boolean"}, Boolean.FALSE);
+ simpleTypeConvertTestMultiMulti("String->Boolean(true)", new String[] {"true", " true ", " TrUe"}, new String[] {"Boolean", "java.lang.Boolean"}, Boolean.TRUE);
+ simpleTypeConvertTestMultiMulti("String->Boolean(false)", new String[] {"false", " false ", " FaLsE"}, new String[] {"Boolean", "java.lang.Boolean"}, Boolean.FALSE);
simpleTypeConvertTestSingleMulti("String->Locale", "en_us", new String[] {"Locale", "java.util.Locale"}, localeData.goodLocale);
simpleTypeConvertTestError("String->error-Locale", "o", new String[] {"Locale", "java.util.Locale"});
// TZ can never be null, will default to GMT if it can't be parsed(from the javadocs of java.util.TimeZone)