commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] Created: (DBCP-316) datasources.SharedPoolDataSource.getPooledConnectionAndInfo() contains an impossible null check
Date Tue, 05 Jan 2010 02:16:55 GMT
datasources.SharedPoolDataSource.getPooledConnectionAndInfo() contains an impossible null check
-----------------------------------------------------------------------------------------------

                 Key: DBCP-316
                 URL: https://issues.apache.org/jira/browse/DBCP-316
             Project: Commons Dbcp
          Issue Type: Bug
            Reporter: Sebb


datasources.SharedPoolDataSource.getPooledConnectionAndInfo() contains an impossible null
check:

{code}
synchronized (userKeys) {
    key = getUserPassKey(username, password);
}
        
try {
    info = (PooledConnectionAndInfo) pool.borrowObject(key);
}
catch (SQLException ex) {  // Remove bad UserPassKey
    if (userKeys != null) { // <== cannot be null here, else synch. would have failed with
NPE
...
{code}

The null check should be removed, as userKeys cannot be null (it is a final variable, and
set non-null).

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


Mime
View raw message