提交 f6584616 编写于 作者: D denis

7121761: creation of java.awt.DataFlavour fails for turkish locale

Reviewed-by: anthony
上级 6ffe70d6
...@@ -30,6 +30,7 @@ import java.io.ObjectOutput; ...@@ -30,6 +30,7 @@ import java.io.ObjectOutput;
import java.io.ObjectInput; import java.io.ObjectInput;
import java.io.IOException; import java.io.IOException;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Locale;
/** /**
...@@ -93,14 +94,14 @@ class MimeType implements Externalizable, Cloneable { ...@@ -93,14 +94,14 @@ class MimeType implements Externalizable, Cloneable {
MimeTypeParseException { MimeTypeParseException {
// check to see if primary is valid // check to see if primary is valid
if(isValidToken(primary)) { if(isValidToken(primary)) {
primaryType = primary.toLowerCase(); primaryType = primary.toLowerCase(Locale.ENGLISH);
} else { } else {
throw new MimeTypeParseException("Primary type is invalid."); throw new MimeTypeParseException("Primary type is invalid.");
} }
// check to see if sub is valid // check to see if sub is valid
if(isValidToken(sub)) { if(isValidToken(sub)) {
subType = sub.toLowerCase(); subType = sub.toLowerCase(Locale.ENGLISH);
} else { } else {
throw new MimeTypeParseException("Sub type is invalid."); throw new MimeTypeParseException("Sub type is invalid.");
} }
...@@ -158,17 +159,17 @@ MimeTypeParseException { ...@@ -158,17 +159,17 @@ MimeTypeParseException {
throw new MimeTypeParseException("Unable to find a sub type."); throw new MimeTypeParseException("Unable to find a sub type.");
} else if((slashIndex >= 0) && (semIndex < 0)) { } else if((slashIndex >= 0) && (semIndex < 0)) {
// we have a primary and sub type but no parameter list // we have a primary and sub type but no parameter list
primaryType = rawdata.substring(0, primaryType = rawdata.substring(0,slashIndex).
slashIndex).trim().toLowerCase(); trim().toLowerCase(Locale.ENGLISH);
subType = rawdata.substring(slashIndex + subType = rawdata.substring(slashIndex + 1).
1).trim().toLowerCase(); trim().toLowerCase(Locale.ENGLISH);
parameters = new MimeTypeParameterList(); parameters = new MimeTypeParameterList();
} else if (slashIndex < semIndex) { } else if (slashIndex < semIndex) {
// we have all three items in the proper sequence // we have all three items in the proper sequence
primaryType = rawdata.substring(0, primaryType = rawdata.substring(0, slashIndex).
slashIndex).trim().toLowerCase(); trim().toLowerCase(Locale.ENGLISH);
subType = rawdata.substring(slashIndex + 1, subType = rawdata.substring(slashIndex + 1,
semIndex).trim().toLowerCase(); semIndex).trim().toLowerCase(Locale.ENGLISH);
parameters = new parameters = new
MimeTypeParameterList(rawdata.substring(semIndex)); MimeTypeParameterList(rawdata.substring(semIndex));
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册