Author: allee8285
Date: Sun Nov 8 05:03:29 2009
New Revision: 833826
URL:
http://svn.apache.org/viewvc?rev=833826&view=revLog:
OPENJPA-1377 - convert property value to upper-case before converting to its corresponding enum type.
Modified:
openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAProperties.java
Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAProperties.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAProperties.java?rev=833826&r1=833825&r2=833826&view=diff==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAProperties.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/JPAProperties.java Sun Nov 8 05:03:29 2009
@@ -129,9 +129,9 @@
if (JPAProperties.isValidKey(key)) {
// works because enum values are identical String
if (value instanceof CacheRetrieveMode) {
- return (T)DataCacheRetrieveMode.valueOf(value.toString());
+ return (T)DataCacheRetrieveMode.valueOf(value.toString().trim().toUpperCase());
} else if (value instanceof CacheStoreMode) {
- return (T)DataCacheStoreMode.valueOf(value.toString());
+ return (T)DataCacheStoreMode.valueOf(value.toString().trim().toUpperCase());
}
}
return (T)value;
@@ -148,9 +148,9 @@
if (JPAProperties.isValidKey(key)) {
// works because enum values are identical String
if (value instanceof DataCacheRetrieveMode) {
- return CacheRetrieveMode.valueOf(value.toString());
+ return CacheRetrieveMode.valueOf(value.toString().trim().toUpperCase());
} else if (value instanceof DataCacheStoreMode) {
- return CacheStoreMode.valueOf(value.toString());
+ return CacheStoreMode.valueOf(value.toString().trim().toUpperCase());
}
}
return value;
@@ -202,7 +202,7 @@
if (type.isInstance(val))
return (E)val;
if (val instanceof String) {
- return Enum.valueOf(type, val.toString());
+ return Enum.valueOf(type, val.toString().trim().toUpperCase());
}
if (values != null && values.length > 0 && val instanceof Number) {
return values[((Number)val).intValue()];