On 4 February 2014 19:36, <[email protected]> wrote: > Author: markt > Date: Tue Feb 4 19:36:41 2014 > New Revision: 1564436 > > URL: http://svn.apache.org/r1564436 > Log: > Unable to find a way around this final generics warning so suppress it
Can the statement cause a class cast (or other) exception? If not, it would be helpful to document why it is safe to ignore the exception. And vice-versa. > Modified: > > commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java > > Modified: > commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java > URL: > http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java?rev=1564436&r1=1564435&r2=1564436&view=diff > ============================================================================== > --- > commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java > (original) > +++ > commons/proper/dbcp/trunk/src/main/java/org/apache/commons/dbcp2/PoolingConnection.java > Tue Feb 4 19:36:41 2014 > @@ -21,7 +21,6 @@ import java.sql.CallableStatement; > import java.sql.Connection; > import java.sql.PreparedStatement; > import java.sql.SQLException; > - > import java.util.NoSuchElementException; > > import org.apache.commons.pool2.KeyedObjectPool; > @@ -303,17 +302,20 @@ public class PoolingConnection extends D > } else { > if( null == key.getResultSetType() && null == > key.getResultSetConcurrency()) { > if (key.getStmtType() == STATEMENT_PREPAREDSTMT ) { > - return new > DefaultPooledObject<DelegatingPreparedStatement>( > - new > PoolablePreparedStatement(getDelegate().prepareStatement( key.getSql()), key, > _pstmtPool, this)); > + @SuppressWarnings({"rawtypes", "unchecked"}) // Unable > to find way to avoid this > + PoolablePreparedStatement pps = new > PoolablePreparedStatement( > + getDelegate().prepareStatement( key.getSql()), > key, _pstmtPool, this); > + return new > DefaultPooledObject<DelegatingPreparedStatement>(pps); > } else { > return new > DefaultPooledObject<DelegatingPreparedStatement>( > new > PoolableCallableStatement(getDelegate().prepareCall( key.getSql()), key, > _pstmtPool, this)); > } > } else { // Both _resultSetType and _resultSetConcurrency are > non-null here (both or neither are set by constructors) > if(key.getStmtType() == STATEMENT_PREPAREDSTMT) { > - return new > DefaultPooledObject<DelegatingPreparedStatement>( > - new > PoolablePreparedStatement(getDelegate().prepareStatement( > - key.getSql(), > key.getResultSetType().intValue(),key.getResultSetConcurrency().intValue()), > key, _pstmtPool, this)); > + @SuppressWarnings({"rawtypes", "unchecked"}) // Unable > to find way to avoid this > + PoolablePreparedStatement pps = new > PoolablePreparedStatement(getDelegate().prepareStatement( > + key.getSql(), > key.getResultSetType().intValue(),key.getResultSetConcurrency().intValue()), > key, _pstmtPool, this); > + return new > DefaultPooledObject<DelegatingPreparedStatement>(pps); > } else { > return new > DefaultPooledObject<DelegatingPreparedStatement>( > new PoolableCallableStatement( > getDelegate().prepareCall( > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
