Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7133484

(fs) Need FileTypeDetector implementation for MacOSX

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Duplicate
    • P4
    • 8
    • 7u4
    • core-libs
    • x86
    • os_x

    Description

      From http://java.net/jira/browse/MACOSX_PORT-153 --

      Files.probeContentType return null for htm/html files

      Test for reproducing issue:

      import java.nio.file.Files;
      import java.nio.file.Path;
      import java.nio.file.Paths;

      public class ContentTypeTest {

      public static void main(String[] argv) {
      String[] input = {"index.html", "index.htm"};
      int failCount = 0;
      try {
      for (String s : input) {
      Path path = Paths.get(s);
      String filetype = Files.probeContentType(path);
      if (filetype == null || !filetype.equals("text/html")) { System.out.println(path.toString() + " - file type is not text/html; file type is - " + filetype); failCount++; } else { System.out.println(path.toString() + " - file type is text/html"); }
      }
      } catch (Exception e) { e.printStackTrace(); }
      if(failCount > 0) { System.out.println("TEST FAIL!"); } else { System.out.println("TEST PASS!"); }
      }
      }

      Test result:

      index.html - file type is not text/html; file type is - null
      index.htm - file type is not text/html; file type is - null
      TEST FAIL!

      Attachments

        Issue Links

          Activity

            People

              dxu Dan Xu (Inactive)
              juh Jason Uh (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: