Normalize error messages between C and java extensions.
Add missing error case in java extension.