[ 
https://issues.apache.org/jira/browse/DERBY-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen updated DERBY-1998:
--------------------------------------

    Urgency: Normal

Triaged for 10.5.2.

> JDBC 4 isWrapper() and unWrap() methods allow unwrapping to Derby 
> implementation classes.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-1998
>                 URL: https://issues.apache.org/jira/browse/DERBY-1998
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>            Reporter: Daniel John Debrunner
>
> I do not believe that the unwrapping mechanism of JDBC 4 should allow or 
> encourage unwrapping a JDBC 4 object as one of Derby's pribvate 
> implementation types.
> Since Derby does *not* wrap objects in any way I would say there is a stong 
> case for saying that the isWrapper() method should always return false and 
> the unWrap() method always throw an exception.
> For example in EmbedStatement40 this code will allow "unwrapping" to
>    EmbedStatement40, EmbedStatement, EngineStatement, ConnectionChild, 
> Object, Statement
>    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
>         checkStatus();
>         return interfaces.isInstance(this);
>     }
>     public <T> T unwrap(java.lang.Class<T> interfaces)
>     throws SQLException{
>         checkStatus();
>         try {
>             return interfaces.cast(this);
>         } catch (ClassCastException cce) {
>             throw newSQLException(SQLState.UNABLE_TO_UNWRAP,interfaces);
>         }
>     }

-- 
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