Fix NPE when calling Java code
getContentTypeCharset is in Java and can return null