You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2014/03/04 14:30:20 UTC
[jira] [Updated] (DERBY-6493) Improve reporting of exceptions
wrapped in InvocationTargetException
[ https://issues.apache.org/jira/browse/DERBY-6493?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Knut Anders Hatlen updated DERBY-6493:
--------------------------------------
Attachment: d6493-1a.diff
Attached is a patch (d6493-1a.diff) that makes StandardException.unexpectedUserException() and StandardException.plainWrapException() unwrap InvocationTargetExceptions and PrivilegedActionExceptions before reporting them. This change simplified the exception chain in the example above to:
{noformat}
ij> call syscs_util.syscs_import_table(null, 'T', null, null, null, null, 0);
ERROR XIE05: Data file cannot be null.
{noformat}
Other changes in the patch:
- Remove unneeded unwrapping of InvocationTargetException in ReflectMethod and FromVTI since that's now handled centrally in StandardException.
- Fix a test case in ImportExportProcedureTest where it was checked for the SQLState of the InvocationTargetException (38000) instead of the error code for the underlying exception.
All the regression tests passed.
> Improve reporting of exceptions wrapped in InvocationTargetException
> --------------------------------------------------------------------
>
> Key: DERBY-6493
> URL: https://issues.apache.org/jira/browse/DERBY-6493
> Project: Derby
> Issue Type: Improvement
> Components: JDBC
> Affects Versions: 10.11.0.0
> Reporter: Knut Anders Hatlen
> Assignee: Knut Anders Hatlen
> Attachments: d6493-1a.diff
>
>
> When Derby encounters an exception in a method that's called via reflection, the actual problem may be well hidden at the end of a long exception chain. For example:
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> call syscs_util.syscs_import_table(null, 'T', null, null, null, null, 0);
> ERROR 38000: The exception 'java.sql.SQLException: The exception 'java.lang.reflect.InvocationTargetException' was thrown while evaluating an expression.' was thrown while evaluating an expression.
> ERROR 38000: The exception 'java.lang.reflect.InvocationTargetException' was thrown while evaluating an expression.
> ERROR XJ001: Java exception: ': java.lang.reflect.InvocationTargetException'.
> ERROR XIE05: Data file cannot be null.
> Only the last exception provides any useful information to the user in this case. I think it would be good to remove the InvocationTargetException from the chain so that it's easier to spot the actual problem.
--
This message was sent by Atlassian JIRA
(v6.2#6252)