OPENJPA-719 - Ensure English locale is used in toUpperCase/toLowerCase for locale insensitive code.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@698813 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Albert Lee 2008-09-25 04:45:48 +00:00
parent 85b44d83d5
commit 07c6b1e5dd
2 changed files with 5 additions and 4 deletions

View File

@ -41,6 +41,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -2566,7 +2567,7 @@ public class PCEnhancer {
// or 'Object'; figure out what type to use // or 'Object'; figure out what type to use
String typeName = type.getName(); String typeName = type.getName();
if (type.isPrimitive()) if (type.isPrimitive())
typeName = typeName.substring(0, 1).toUpperCase() typeName = typeName.substring(0, 1).toUpperCase(Locale.ENGLISH)
+ typeName.substring(1); + typeName.substring(1);
else if (type.equals(String.class)) else if (type.equals(String.class))
typeName = "String"; typeName = "String";
@ -3971,7 +3972,7 @@ public class PCEnhancer {
String methName; String methName;
if (type.isPrimitive()) { if (type.isPrimitive()) {
methName = type.getName(); methName = type.getName();
methName = Character.toUpperCase(methName.charAt(0)) methName = methName.substring(0, 1).toUpperCase(Locale.ENGLISH)
+ methName.substring(1); + methName.substring(1);
methName = "read" + methName; methName = "read" + methName;
} else } else
@ -4128,7 +4129,7 @@ public class PCEnhancer {
String methName; String methName;
if (type.isPrimitive()) { if (type.isPrimitive()) {
methName = type.getName(); methName = type.getName();
methName = Character.toUpperCase(methName.charAt(0)) methName = methName.substring(0, 1).toUpperCase(Locale.ENGLISH)
+ methName.substring(1); + methName.substring(1);
methName = "write" + methName; methName = "write" + methName;
} else } else

View File

@ -241,7 +241,7 @@ public class LogFactoryImpl
* Returns a symbolic constant for the specified string level. * Returns a symbolic constant for the specified string level.
*/ */
public static short getLevel(String str) { public static short getLevel(String str) {
str = str.toUpperCase().trim(); str = str.toUpperCase(Locale.ENGLISH).trim();
short val = TRACE_STR.equals(str) ? Log.TRACE : short val = TRACE_STR.equals(str) ? Log.TRACE :
INFO_STR.equals(str) ? Log.INFO : INFO_STR.equals(str) ? Log.INFO :
WARN_STR.equals(str) ? Log.WARN : WARN_STR.equals(str) ? Log.WARN :