-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
6u21
-
sparc
-
solaris_10
A DESCRIPTION OF THE REQUEST :
sun.misc.CharacterEncoder.encode(byte[]) and encodeBuffer(byte[]) throw a java.lang.Error, but ignore the causing exception so its stacktrace is being lost and makes it more difficult to find the real problem.
It is also catching ALL Exception types and rethrows them as an Error, which is not a recommended practice for RuntimeException types.
JUSTIFICATION :
It otherwise makes determining of the root cause of problems nearly impossible. I just filed an other bug report, which shows that a static sun.misc.HexDumpEncoder instance used in sun.security.krb5.EncryptionKey.toString() caused ArrayIndexOutOfBoundsException in the encodeAtom method. However this exception was lost as the CharacterEncoder.encode method replaces it by the "internal Error" message.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Either the causing exception should be added in the Error constructor or do not catch all exception types and rethrow them as an Error at all.
ACTUAL -
Causing exception is lost and all exception types are catched and rethrown as Errors.
sun.misc.CharacterEncoder.encode(byte[]) and encodeBuffer(byte[]) throw a java.lang.Error, but ignore the causing exception so its stacktrace is being lost and makes it more difficult to find the real problem.
It is also catching ALL Exception types and rethrows them as an Error, which is not a recommended practice for RuntimeException types.
JUSTIFICATION :
It otherwise makes determining of the root cause of problems nearly impossible. I just filed an other bug report, which shows that a static sun.misc.HexDumpEncoder instance used in sun.security.krb5.EncryptionKey.toString() caused ArrayIndexOutOfBoundsException in the encodeAtom method. However this exception was lost as the CharacterEncoder.encode method replaces it by the "internal Error" message.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Either the causing exception should be added in the Error constructor or do not catch all exception types and rethrow them as an Error at all.
ACTUAL -
Causing exception is lost and all exception types are catched and rethrown as Errors.