FULL PRODUCT VERSION :
1.8.0_45
ADDITIONAL OS VERSION INFORMATION :
Window 8.1 32 bits
EXTRA RELEVANT SYSTEM CONFIGURATION :
Files.probeContentType(file.toPath()) returns null for all tested files: txt, pdf and .ini.
A DESCRIPTION OF THE PROBLEM :
This doesn't happen on Windows 7 64 bits using jdk 1.8.0_45. So it must be a bug in the jdk 1.8.0_45 for 32 bits.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Testiing code:
// http://www.ibm.com/developerworks/library/j-nativememory-linux/j-nativememory-linux-pdf.pdf
FIle file = new File(D:\\j-nativememory-linux/j-nativememory-linux-pdf.pdf);
if (file.isFile())
{
String s = Files.probeContentType(file.toPath());
// s is always null on Win8 32 bits, this works on Win7 64 bits
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Files.probeContentType must return "application/pdf" for pdf files.
ACTUAL -
Files.probeContentType returns null for pdf files.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Throws Java.NullPointerException whe tried to do:
Files.probeContentType(file.toPath()).equals("application/pdf");
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
// http://www.ibm.com/developerworks/library/j-nativememory-linux/j-nativememory-linux-pdf.pdf
FIle file = new File(D:\\j-nativememory-linux/j-nativememory-linux-pdf.pdf);
if (file.isFile())
{
String s = Files.probeContentType(file.toPath());
// s is always null on Win8 32 bits, this works on Win7 64 bits
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
reading pdf's header