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

PooledConnection.removeConnectionEventListener(ConnectionEventListener) does not throw any Exceptions, yet DBCP protects calls to it

    XMLWordPrintableJSON

    Details

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

      Description

      javax.sql.PooledConnection.removeConnectionEventListener(ConnectionEventListener) does not throw any Exceptions, yet DBCP protects calls to it, generally ignoring any Exception.

      For example, in datasources.CPDSConnectionFactory:

      public void destroyObject(Object obj) throws Exception {
          if (obj instanceof PooledConnectionAndInfo) {
              PooledConnection pc = ((PooledConnectionAndInfo)obj).getPooledConnection();
              try {
                  pc.removeConnectionEventListener(this);
              } catch (Exception e) {
                  //ignore
              }
      ....
      

      This seems wrong, as the code may accidentally swallow a genuine Exception.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: