Daniel John Debrunner (JIRA) wrote:
Client should unwrap exceptions thrown in privilege blocks rather than throwing
the java.security.PrivilegedActionException
---------------------------------------------------------------------------------------------------------------------------
Key: DERBY-1069
URL: http://issues.apache.org/jira/browse/DERBY-1069
Project: Derby
Type: Bug
Components: Network Client
Reporter: Daniel John Debrunner
Can lead to misunderstanding the root cause of the problem.
Hi Dan,
Are you thinking of the problem that a new exception is created in the
try-catch block around the
'AccessController.doPrivileged(PrivilegedExceptionAction)', and thus the
stacktrace for the original exception is "polluted"?
(or lost if the original exception is not set as cause for the new one)
If we are not to throw the 'PrivilegedActionException', I guess we are
left with two choices:
1) Writing code for casting the 'PrivilegedActionException' to other
exception types in the catch-block and re-throwing it.
2) Creating a new exception and setting
'PrivilegedActionException.getException()' as cause for this.
Any opinions on the approaches above?
Have I missed anything?
--
Kristian