8164556: Drop AAC and FLAC from content type check in java/nio/file/Files/probeContentType/Basic.java
authorbpb
Tue, 23 Aug 2016 10:51:17 -0700
changeset 40537 d397283124a2
parent 40536 8ea134098b80
child 40538 86086b400786
8164556: Drop AAC and FLAC from content type check in java/nio/file/Files/probeContentType/Basic.java Summary: Remove file extensions of AAC and FLAC audio encodings from the list of extensions verified. Reviewed-by: alanb
jdk/test/java/nio/file/Files/probeContentType/Basic.java
--- a/jdk/test/java/nio/file/Files/probeContentType/Basic.java	Tue Aug 23 10:49:15 2016 -0700
+++ b/jdk/test/java/nio/file/Files/probeContentType/Basic.java	Tue Aug 23 10:51:17 2016 -0700
@@ -95,7 +95,7 @@
         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 @@
                     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 @@
 
         // Verify that certain media extensions are mapped to the correct type.
         String[] extensions = new String[]{
-            "aac",
-            "flac",
             "jpg",
             "mp3",
             "mp4",
@@ -183,15 +164,13 @@
             "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);