8164556: Drop AAC and FLAC from content type check in java/nio/file/Files/probeContentType/Basic.java
Remove file extensions of AAC and FLAC audio encodings from the list of extensions verified. Reviewed-by: alanb
This commit is contained in:
parent
496a6f67d6
commit
dc3e5ed9fb
@ -95,7 +95,7 @@ public class Basic {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int checkContentTypes(String[] extensions, String[][] expectedTypes)
|
||||
static int checkContentTypes(String[] extensions, String[] expectedTypes)
|
||||
throws IOException {
|
||||
if (extensions.length != expectedTypes.length) {
|
||||
System.err.println("Parameter array lengths differ");
|
||||
@ -112,27 +112,10 @@ public class Basic {
|
||||
System.err.println("Content type of " + extension
|
||||
+ " cannot be determined");
|
||||
failures++;
|
||||
} else {
|
||||
boolean isTypeFound = false;
|
||||
for (String s : expectedTypes[i]) {
|
||||
if (type.equals(s)) {
|
||||
isTypeFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isTypeFound) {
|
||||
System.err.printf("Content type: %s; expected: ", type);
|
||||
int j = 0;
|
||||
for (String s : expectedTypes[i]) {
|
||||
if (j++ == 0) {
|
||||
System.err.printf("%s", s);
|
||||
} else {
|
||||
System.err.printf(", or %s", s);
|
||||
}
|
||||
}
|
||||
System.err.println();
|
||||
failures++;
|
||||
}
|
||||
} else if (!type.equals(expectedTypes[i])) {
|
||||
System.err.printf("Content type: %s; expected: %s%n",
|
||||
type, expectedTypes);
|
||||
failures++;
|
||||
}
|
||||
} finally {
|
||||
Files.delete(file);
|
||||
@ -174,8 +157,6 @@ public class Basic {
|
||||
|
||||
// Verify that certain media extensions are mapped to the correct type.
|
||||
String[] extensions = new String[]{
|
||||
"aac",
|
||||
"flac",
|
||||
"jpg",
|
||||
"mp3",
|
||||
"mp4",
|
||||
@ -183,15 +164,13 @@ public class Basic {
|
||||
"png",
|
||||
"webm"
|
||||
};
|
||||
String[][] expectedTypes = new String[][] {
|
||||
{"audio/aac", "audio/x-aac", "audio/vnd.dlna.adts"},
|
||||
{"audio/flac", "audio/x-flac"},
|
||||
{"image/jpeg"},
|
||||
{"audio/mpeg"},
|
||||
{"video/mp4"},
|
||||
{"application/pdf"},
|
||||
{"image/png"},
|
||||
{"video/webm"}
|
||||
String[] expectedTypes = new String[] {
|
||||
"image/jpeg",
|
||||
"audio/mpeg",
|
||||
"video/mp4",
|
||||
"application/pdf",
|
||||
"image/png",
|
||||
"video/webm"
|
||||
};
|
||||
failures += checkContentTypes(extensions, expectedTypes);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user