changeset 4946:84b153cd9bd4

7121761: creation of java.awt.DataFlavour fails for turkish locale Reviewed-by: anthony
author denis
date Thu, 19 Jan 2012 14:59:43 +0400
parents fe1278123fbb
children e32db6535c05
files src/share/classes/java/awt/datatransfer/MimeType.java
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/awt/datatransfer/MimeType.java	Wed Jan 18 11:41:13 2012 -0800
+++ b/src/share/classes/java/awt/datatransfer/MimeType.java	Thu Jan 19 14:59:43 2012 +0400
@@ -30,6 +30,7 @@
 import java.io.ObjectInput;
 import java.io.IOException;
 import java.util.Enumeration;
+import java.util.Locale;
 
 
 /**
@@ -93,14 +94,14 @@
 MimeTypeParseException {
         //    check to see if primary is valid
         if(isValidToken(primary)) {
-            primaryType = primary.toLowerCase();
+            primaryType = primary.toLowerCase(Locale.ENGLISH);
         } else {
             throw new MimeTypeParseException("Primary type is invalid.");
         }
 
         //    check to see if sub is valid
         if(isValidToken(sub)) {
-            subType = sub.toLowerCase();
+            subType = sub.toLowerCase(Locale.ENGLISH);
         } else {
             throw new MimeTypeParseException("Sub type is invalid.");
         }
@@ -158,17 +159,17 @@
             throw new MimeTypeParseException("Unable to find a sub type.");
         } else if((slashIndex >= 0) && (semIndex < 0)) {
             //    we have a primary and sub type but no parameter list
-            primaryType = rawdata.substring(0,
-slashIndex).trim().toLowerCase();
-            subType = rawdata.substring(slashIndex +
-1).trim().toLowerCase();
+            primaryType = rawdata.substring(0,slashIndex).
+                trim().toLowerCase(Locale.ENGLISH);
+            subType = rawdata.substring(slashIndex + 1).
+                trim().toLowerCase(Locale.ENGLISH);
             parameters = new MimeTypeParameterList();
         } else if (slashIndex < semIndex) {
             //    we have all three items in the proper sequence
-            primaryType = rawdata.substring(0,
-slashIndex).trim().toLowerCase();
+            primaryType = rawdata.substring(0, slashIndex).
+                trim().toLowerCase(Locale.ENGLISH);
             subType = rawdata.substring(slashIndex + 1,
-semIndex).trim().toLowerCase();
+                semIndex).trim().toLowerCase(Locale.ENGLISH);
             parameters = new
 MimeTypeParameterList(rawdata.substring(semIndex));
         } else {