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

Nested connections in a transaction (local) throws null pointer

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0, 2.1
    • Fix Version/s: 2.1.1
    • Labels:
      None
    • Environment:

      All (linux, aix, windows)

    • Flags:
      Important

      Description

      In a transaction context, if we open multiple connections and close each of them after commit, we get a null pointer exception. Sample code:
      transactionManager.begin();

      Connection c1 = null;
      Connection c2 = null;

      c1 = newConnection();
      c2 = newConnection();

      transactionManager.commit();

      try

      { c1.close(); }

      catch(Exception e)

      { e.printStackTrace(); }

      try

      { c2.close(); }

      catch(Exception e)

      { //throws execption e.printStackTrace(); }

      Null pointer is thrown at:
      org.apache.commons.dbcp2.DelegatingConnection.closeInternal

      Affects versions-- 2.1, 2.0

        Attachments

        1. dbcpNull.png
          99 kB
          Raihan Kibria
        2. TestManagedDataSourceInNesetedConnTx.java
          2 kB
          Raihan Kibria

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              raihan Raihan Kibria
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: