disallow opening non-whitelisted file types on Java 6 or lower

Tested works on both Java 6 (by disallowing non-whitelisted types) and Java 7 (by detecting non-whitelisted types as `text`).