I use mime-util to test if the content of a file match his extension. So I use MimeUtil.getMimeTypes(InputStream) to test the file and I can only have a MagicMimeDetector and a TextMimeDetector registered.
The PDF has the fonts definition at the beginning, that cause the TextMimeDetector returning text/plain. The MagicMimeDetector returns application/pdf.
Then I used the getMostSpecificMimeType(mimeTypes) on the returned collection and THAT returns text/plain because they both have 1 as specificity.
According to the Documentation of the MimeType.getSpecificity: text/plain and application/octet-stream should always have a specificity of 0: "As this can be a false positive for types such as application/octect-stream
* and text/plain where they would be returned by multiple MimeDetector(s). These types are referred to as root
* mime types where ALL mime types derive from application/octet-stream and all text/* types derive from text/plan
* so in these cases we set the specificity to 0 no matter how many times they match."
I tested it with mime-util 2.1.3