Derby
  1. Derby
  2. DERBY-3307

NPE in PooledConnction event notification handling if a null listener is added

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.3.2.1, 10.4.1.3
    • Fix Version/s: 10.4.2.0, 10.5.1.1
    • Component/s: JDBC
    • Labels:
      None

      Description

      If a null reference is passed in to one of the ClientPooledConnection.addXEventListener, a NPE will be thrown if an event occurs.
      I will attach a simple repro as a patch to the test jdbc4.StatementEventsTests. I believe the situation is the same for connection event listeners.

      I have found no information in the specs regarding null listeners, but I assume it would be okay to ignore them.

      1. derby-3307-1a-test_repro.diff
        1 kB
        Kristian Waagan
      2. d3307.diff
        4 kB
        Knut Anders Hatlen

        Issue Links

          Activity

          Hide
          Kristian Waagan added a comment -

          I verified the fix in trunk by running the repro after removing the code change in CPC. It fails with the code removed, and succeeds with the code in place.

          Thank you Knut Anders!

          Show
          Kristian Waagan added a comment - I verified the fix in trunk by running the repro after removing the code change in CPC. It fails with the code removed, and succeeds with the code in place. Thank you Knut Anders!
          Hide
          Knut Anders Hatlen added a comment -

          Merged to 10.4 and committed revision 666094.

          Show
          Knut Anders Hatlen added a comment - Merged to 10.4 and committed revision 666094.
          Hide
          Knut Anders Hatlen added a comment -

          Committed revision 666040.

          Show
          Knut Anders Hatlen added a comment - Committed revision 666040.
          Hide
          Knut Anders Hatlen added a comment -

          The attached patch adds a null check in ClientPooledConnection.addConnectionEventListener() and a regression test in J2EEDataSourceTest.

          Show
          Knut Anders Hatlen added a comment - The attached patch adds a null check in ClientPooledConnection.addConnectionEventListener() and a regression test in J2EEDataSourceTest.
          Hide
          Knut Anders Hatlen added a comment -

          > I have found no information in the specs regarding null listeners, but I assume it would be okay to ignore them.

          That's at least what the embedded driver does. And it would be consistent with how listeners work in the Swing/AWT world.

          Show
          Knut Anders Hatlen added a comment - > I have found no information in the specs regarding null listeners, but I assume it would be okay to ignore them. That's at least what the embedded driver does. And it would be consistent with how listeners work in the Swing/AWT world.
          Hide
          Kristian Waagan added a comment -

          Note that the existing repro ('derby-3307-1a-test_repro.diff') only tests the statement event listener case, which has already been fixed (see DERBY-3695).
          Another repro / test should be written for a connection event listener.

          Show
          Kristian Waagan added a comment - Note that the existing repro ('derby-3307-1a-test_repro.diff') only tests the statement event listener case, which has already been fixed (see DERBY-3695 ). Another repro / test should be written for a connection event listener.
          Hide
          Kristian Waagan added a comment -

          'derby-3307-1a-test_repro.diff' can be used as a repro for this issue. It adds another test to jdbc4.StatementEventsTests.

          Show
          Kristian Waagan added a comment - 'derby-3307-1a-test_repro.diff' can be used as a repro for this issue. It adds another test to jdbc4.StatementEventsTests.

            People

            • Assignee:
              Knut Anders Hatlen
              Reporter:
              Kristian Waagan
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development