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

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: