Though UniversalDetector.detectCharset() is in try-catch block, it doesn't always emit Exception to signal failure.
It returns NULL sometimes. This special case is treated with this commit.
It can be tested using an empty file (length 0 bytes).
Not that I hit an error with the original implementation, it is more of a safety-fix.
Was playing around EpicWorshipParser throwing an empty file at it ;-)
Though UniversalDetector.detectCharset() is in try-catch block, it doesn't always emit Exception to signal failure. It returns NULL sometimes. This special case is treated with this commit. It can be tested using an empty file (length 0 bytes).
Not that I hit an error with the original implementation, it is more of a safety-fix. Was playing around EpicWorshipParser throwing an empty file at it ;-)