Details
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
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
- relates to
-
JDK-7142921 (fs) Files.probeContentType reports a MIME type of "text/plain" on Ubuntu 11.04
- Closed
-
JDK-8008345 (fs) Files.probeContentType returns null on Mac OS X
- Resolved