@ -575,6 +575,9 @@ public class MediaType implements Comparable<MediaType> {
}
String type = fullType.substring(0, subIndex);
String subtype = fullType.substring(subIndex + 1, fullType.length());
if (WILDCARD_TYPE.equals(type) && !WILDCARD_TYPE.equals(subtype)) {
throw new IllegalArgumentException("A wildcard type is legal only in '*/*' (all media types).");
Map<String, String> parameters = null;
if (parts.length > 1) {
@ -128,6 +128,11 @@ public class MediaTypeTests {
MediaType.parseMediaType("audio/");
@Test(expected = IllegalArgumentException.class)
public void parseMediaTypeTypeRange() {
MediaType.parseMediaType("*/json");
public void parseMediaTypeIllegalType() {
MediaType.parseMediaType("audio(/basic");