Commons Dbcp
  1. Commons Dbcp
  2. DBCP-313

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

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major 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.

        Activity

        Phil Steitz made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Sebb made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Sebb added a comment -

        URL: http://svn.apache.org/viewvc?rev=895869&view=rev
        Log:
        DBCP-313 Remove code that catches and ignores Exceptions when calling
        PooledConnection.removeConnectionEventListener(ConnectionEventListener)
        as the method does not throw any Exceptions.

        Show
        Sebb added a comment - URL: http://svn.apache.org/viewvc?rev=895869&view=rev Log: DBCP-313 Remove code that catches and ignores Exceptions when calling PooledConnection.removeConnectionEventListener(ConnectionEventListener) as the method does not throw any Exceptions.
        sebb committed 895869 (3 files)
        Reviews: none

        DBCP-313 Remove code that catches and ignores Exceptions when calling
        PooledConnection.removeConnectionEventListener(ConnectionEventListener)
        as the method does not throw any Exceptions.

        Hide
        Phil Steitz added a comment -

        Agree the protection should be removed

        Show
        Phil Steitz added a comment - Agree the protection should be removed
        Sebb created issue -

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development