[ 
https://issues.apache.org/jira/browse/DBCP-310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12783284#action_12783284
 ] 

Niall Pemberton commented on DBCP-310:
--------------------------------------

Doh! Didn't re-read that thread - and I even agreed at the time :( - how stupid 
does that look!

Anyway, having said that I guess I'm going to lose the argument, but here goes 
anyway:

    * The contract of the API doesn't specify that SQLNestedException is 
thrown, just SQLException - so no-one should be relying on that implementation 
being thrown
    * If they did anticipate it being thrown, then they should have done it as 
a specific } catch(SQLNestedException) { block so that if another 
implementation is thrown their code doesn't break
   * Since DBCP 1.3 is now a minimum of JDK 1.4 which has a getCause() method - 
then anyone wanting to unwrap can do so without casting to SQLNestedException

I guess its not a big deal, except for the guy who has a remote client side GUI 
that knows nothing about DBCP.

I'll give up now, but I think we should apply the changes to SQLNestedException 
- since that simplifies it greatly, is completely backwards compatible and 
removes the hacks required for JDK 1.3
 

> SQLNestedException & use of initCause() with SQLException
> ---------------------------------------------------------
>
>                 Key: DBCP-310
>                 URL: https://issues.apache.org/jira/browse/DBCP-310
>             Project: Commons Dbcp
>          Issue Type: Improvement
>            Reporter: Niall Pemberton
>            Priority: Minor
>             Fix For: 1.3, 1.4
>
>         Attachments: DBCP-310-v2.patch, SQLNestedException.patch
>
>
> SQLNestedException in its current state is a hangover from supporting JDK 1.3 
> when there was no "initCause()" method. This implementation can now be 
> greatly simplified with DBCP now having a minimum of JDK 1.4
> Also SQLNestedException is deprecated and the following code has been used in 
> a number of places
> {code}
>      throw (SQLException )new SQLException(message).initCause(e)
> {code}
> DBCP is inconsistent though - sometimes using the above and sometimes using 
> SQLNestedException. IMO SQLNestedException  should be un-deprecated and used 
> consistently everywhere - its now a simple implementation and I think the 
> code is cleaner using it rather than the above.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to