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

Robert Poskrobek commented on DBCP-347:
---------------------------------------

Sure, I'll.
 
"Gary Gregory (JIRA)" <[email protected]> napisaƂ(a): 
 > 
 >     [ 
 > https://issues.apache.org/jira/browse/DBCP-347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12925341#action_12925341
 >  ] 
 > 
 > Gary Gregory commented on DBCP-347:
 > -----------------------------------
 > 
 > Would you be willing to provide a patch that includes a unit test to prove 
 > what is broken?
 > 
 > > DelegatingStatement class has incomplete isWrapperFor method
 > > ------------------------------------------------------------
 > >
 > >                 Key: DBCP-347
 > >                 URL: https://issues.apache.org/jira/browse/DBCP-347
 > >             Project: Commons Dbcp
 > >          Issue Type: Bug
 > >         Environment: Windows 7. java version "1.6.0_21". Dell Latitude 
 > > E6410.
 > >            Reporter: Robert Poskrobek
 > >   Original Estimate: 1h
 > >  Remaining Estimate: 1h
 > >
 > > Currently org.apache.commons.dbcp.DelegatingStatement#isWrapperFor checks 
 > > only if:
 > > 1. Requested class is assignable from the DelegatingStatement instance:    
 > >     iface.isAssignableFrom(getClass())
 > > 2. Wrapped object is a wrapper for the requested class:            
 > > _stmt.isWrapperFor(iface)
 > > I think there should be another option checked i.e. requested class is 
 > > assignable from the wrapped object's class. For example:   
 > > iface.isAssignableFrom(_stmt.getClass())
 > > This is especially that in fact unwrap method properly assumes this 
 > > possiblity i.e.:     return iface.cast(_stmt);
 > > The whole method should be:
 > >     public boolean isWrapperFor(Class<?> iface) throws SQLException {
 > >         return iface.isAssignableFrom(getClass()) || 
 > > iface.isAssignableFrom(_stmt.getClass()) || _stmt.isWrapperFor(iface);
 > >     }
 > 
 > -- 
 > This message is automatically generated by JIRA.
 > -
 > You can reply to this email to add a comment to the issue online.
 > 


> DelegatingStatement class has incomplete isWrapperFor method
> ------------------------------------------------------------
>
>                 Key: DBCP-347
>                 URL: https://issues.apache.org/jira/browse/DBCP-347
>             Project: Commons Dbcp
>          Issue Type: Bug
>         Environment: Windows 7. java version "1.6.0_21". Dell Latitude E6410.
>            Reporter: Robert Poskrobek
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Currently org.apache.commons.dbcp.DelegatingStatement#isWrapperFor checks 
> only if:
> 1. Requested class is assignable from the DelegatingStatement instance:       
>  iface.isAssignableFrom(getClass())
> 2. Wrapped object is a wrapper for the requested class:            
> _stmt.isWrapperFor(iface)
> I think there should be another option checked i.e. requested class is 
> assignable from the wrapped object's class. For example:   
> iface.isAssignableFrom(_stmt.getClass())
> This is especially that in fact unwrap method properly assumes this 
> possiblity i.e.:     return iface.cast(_stmt);
> The whole method should be:
>     public boolean isWrapperFor(Class<?> iface) throws SQLException {
>         return iface.isAssignableFrom(getClass()) || 
> iface.isAssignableFrom(_stmt.getClass()) || _stmt.isWrapperFor(iface);
>     }

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