src/share/classes/java/awt/datatransfer/MimeType.java

Print this page

        

*** 28,37 **** --- 28,38 ---- import java.io.Externalizable; import java.io.ObjectOutput; import java.io.ObjectInput; import java.io.IOException; import java.util.Enumeration; + import java.util.Locale; /** * A Multipurpose Internet Mail Extension (MIME) type, as defined * in RFC 2045 and 2046.
*** 91,108 **** */ public MimeType(String primary, String sub, MimeTypeParameterList mtpl) throws MimeTypeParseException { // check to see if primary is valid if(isValidToken(primary)) { ! primaryType = primary.toLowerCase(); } else { throw new MimeTypeParseException("Primary type is invalid."); } // check to see if sub is valid if(isValidToken(sub)) { ! subType = sub.toLowerCase(); } else { throw new MimeTypeParseException("Sub type is invalid."); } parameters = (MimeTypeParameterList)mtpl.clone(); --- 92,109 ---- */ public MimeType(String primary, String sub, MimeTypeParameterList mtpl) throws MimeTypeParseException { // check to see if primary is valid if(isValidToken(primary)) { ! 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(Locale.ENGLISH); } else { throw new MimeTypeParseException("Sub type is invalid."); } parameters = (MimeTypeParameterList)mtpl.clone();
*** 156,176 **** // we have a ';' (and therefore a parameter list), // but no '/' indicating a sub type is present 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(); parameters = new MimeTypeParameterList(); } else if (slashIndex < semIndex) { // we have all three items in the proper sequence ! primaryType = rawdata.substring(0, ! slashIndex).trim().toLowerCase(); subType = rawdata.substring(slashIndex + 1, ! semIndex).trim().toLowerCase(); parameters = new MimeTypeParameterList(rawdata.substring(semIndex)); } else { // we have a ';' lexically before a '/' which means we have a primary type // & a parameter list but no sub type --- 157,177 ---- // we have a ';' (and therefore a parameter list), // but no '/' indicating a sub type is present 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(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(Locale.ENGLISH); subType = rawdata.substring(slashIndex + 1, ! semIndex).trim().toLowerCase(Locale.ENGLISH); parameters = new MimeTypeParameterList(rawdata.substring(semIndex)); } else { // we have a ';' lexically before a '/' which means we have a primary type // & a parameter list but no sub type