Derby
  1. Derby
  2. DERBY-5452

Possible NPE in NsTest.printException()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.8.1.2, 10.9.1.0
    • Fix Version/s: 10.8.2.2, 10.9.1.0
    • Component/s: Test
    • Labels:
      None

      Description

      NsTest.printException() contains the following piece of code:

      if (e.getMessage().equals(null))

      { System.out.println("NULL error message detected"); System.out.println("Here is the NULL exection - " + e.toString()); System.out.println("Stack trace of the NULL exception - "); e.printStackTrace(System.out); }

      It's supposed to detect if e.getMessage() returns null. However, if it does return null, calling equals() on the return value will result in a NullPointerException.

      The condition should be changed to (e.getMessage() == null).

      1. d5452.diff
        0.8 kB
        Knut Anders Hatlen

        Issue Links

          Activity

          Knut Anders Hatlen created issue -
          Knut Anders Hatlen made changes -
          Field Original Value New Value
          Status Open [ 1 ] In Progress [ 3 ]
          Hide
          Knut Anders Hatlen added a comment -

          Attaching a patch that changes the condition as suggested.

          Show
          Knut Anders Hatlen added a comment - Attaching a patch that changes the condition as suggested.
          Knut Anders Hatlen made changes -
          Attachment d5452.diff [ 12498403 ]
          Hide
          Kristian Waagan added a comment -

          +1

          Show
          Kristian Waagan added a comment - +1
          Hide
          Knut Anders Hatlen added a comment -

          Thanks, Kristian. Committed to trunk with revision 1180858 and to 10.8 with revision 1180874.

          Show
          Knut Anders Hatlen added a comment - Thanks, Kristian. Committed to trunk with revision 1180858 and to 10.8 with revision 1180874.
          Knut Anders Hatlen made changes -
          Fix Version/s 10.8.2.2 [ 12317968 ]
          Fix Version/s 10.9.0.0 [ 12316344 ]
          Affects Version/s 10.8.1.2 [ 12316362 ]
          Knut Anders Hatlen made changes -
          Status In Progress [ 3 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Knut Anders Hatlen made changes -
          Link This issue is related to DERBY-5465 [ DERBY-5465 ]
          Gavin made changes -
          Workflow jira [ 12637033 ] Default workflow, editable Closed status [ 12796648 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open In Progress In Progress
          6m 32s 1 Knut Anders Hatlen 10/Oct/11 10:15
          In Progress In Progress Closed Closed
          1h 52m 1 Knut Anders Hatlen 10/Oct/11 12:07

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development