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

(fs) Files.probeContentType returns null on Solaris 64-bit

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • P4
    • Resolution: Fixed
    • 8
    • 8
    • core-libs
    • b68
    • generic
    • solaris
    • Verified

    Description

      On solaris 64bit machine, run with 64bit java, Files.probeContentType returns right type without -d64 but returns null with -d64

      Test to reproduce the issue:
      ============================
      import java.nio.file.*;
      import java.io.*;

      public class Basic {

          static Path createHtmlFile() throws IOException {
              Path file = Files.createTempFile("foo", ".html");
              try (OutputStream out = Files.newOutputStream(file)) {
                  out.write("<html><body>foo</body></html>".getBytes());
              }

              return file;
          }

          public static void main(String[] args) throws IOException {

              // exercise default file type detector
              Path file = createHtmlFile();
              try {
                  String type = Files.probeContentType(file);
                  System.out.println("type=" + type);
                  if (type == null) {
                      System.err.println("Content type is null, should be text/html");
                  } else {
                      if (!type.equals("text/html"))
                          throw new RuntimeException("Unexpected type: " + type);
                  }

              } finally {
                  Files.delete(file);
              }


          }
      }


      Output without and with -d64 (on same machine)
      ============================
      bash-3.00$ $JAVA_HOME/bin/java Basic
      type=text/html

      bash-3.00$ $JAVA_HOME/bin/java -d64 Basic
      type=null
      Content type is null, should be text/html

      Attachments

        Issue Links

          Activity

            People

              dxu Dan Xu (Inactive)
              amlu Amy Lu (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: