Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-316

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

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

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

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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sebb Sebb
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: