private void checkParameters(String attribute, String value) {
   Assert.hasLength(attribute, "parameter attribute must not be empty");
   Assert.hasLength(value, "parameter value must not be empty");
   checkToken(attribute);
   if (PARAM_QUALITY_FACTOR.equals(attribute)) {
     value = unquote(value);
     double d = Double.parseDouble(value);
     Assert.isTrue(
         d >= 0D && d <= 1D,
         "Invalid quality value \"" + value + "\": should be between 0.0 and 1.0");
   } else if (PARAM_CHARSET.equals(attribute)) {
     value = unquote(value);
     Charset.forName(value);
   } else if (!isQuotedString(value)) {
     checkToken(value);
   }
 }
 /**
  * Create a new {@code MediaType} for the given type, subtype, and parameters.
  *
  * @param type the primary type
  * @param subtype the subtype
  * @param parameters the parameters, may be <code>null</code>
  * @throws IllegalArgumentException if any of the parameters contain illegal characters
  */
 public MediaType(String type, String subtype, Map<String, String> parameters) {
   Assert.hasLength(type, "'type' must not be empty");
   Assert.hasLength(subtype, "'subtype' must not be empty");
   checkToken(type);
   checkToken(subtype);
   this.type = type.toLowerCase(Locale.ENGLISH);
   this.subtype = subtype.toLowerCase(Locale.ENGLISH);
   if (!CollectionUtils.isEmpty(parameters)) {
     Map<String, String> m =
         new LinkedCaseInsensitiveMap<String>(parameters.size(), Locale.ENGLISH);
     for (Map.Entry<String, String> entry : parameters.entrySet()) {
       String attribute = entry.getKey();
       String value = entry.getValue();
       checkParameters(attribute, value);
       m.put(attribute, unquote(value));
     }
     this.parameters = Collections.unmodifiableMap(m);
   } else {
     this.parameters = Collections.emptyMap();
   }
 }