Commons Lang
  1. Commons Lang
  2. LANG-42

[lang] EqualsBuilder.append(Object[], Object[]) crashes with a NullPointerException if an element of the first array is null

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.2
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: Mac OS X 10.3
      Platform: Macintosh

      Description

      If you use EqualsBuilder.append(Object[], Object[]), and the first array contains an element that is null
      (and before any other mismatches between the arrays are present), then EqualsBuilder will throw a
      NullPointerException at line 513.

      Steps to reproduce:

      Object[] x1 = new Object[]

      { new Integer(1), null, new Integer(3) }

      ;
      Object[] x2 = new Object[]

      { new Integer(1), new Integer(2), new Integer(3) }

      ;

      new EqualsBuilder().append(x1, x2);

      The third line of this program will crash.

      Attached is a patch that fixes this bug and adds code to an existing unit-test case that proves it's fixed
      (i.e., the test fails without the source patch, and passes with it, and is a valid test).

      This patch also fixes another bug related to exact types of objects in an array (which I'm about to enter,
      and which I will relate to this bug if I figure out how .

        Activity

        Andrew Geweke created issue -
        Hide
        Andrew Geweke added a comment -

        Created an attachment (id=13983)
        Patch includes a testcase that proves existence of the bug / that it's fixed,
        and fixes the bug in the source.

        Show
        Andrew Geweke added a comment - Created an attachment (id=13983) Patch includes a testcase that proves existence of the bug / that it's fixed, and fixes the bug in the source.
        Hide
        Andrew Geweke added a comment -

        See also COM-1843.

        Show
        Andrew Geweke added a comment - See also COM-1843 .
        Hide
        ggregory@seagullsw.com added a comment -

        This appears to be already fixed in CVS and should be in the nightly build. I've
        added the test case in a new method testNpeForNullElement().

        Show
        ggregory@seagullsw.com added a comment - This appears to be already fixed in CVS and should be in the nightly build. I've added the test case in a new method testNpeForNullElement().
        Hide
        Henri Yandell added a comment -
            • COM-2001 has been marked as a duplicate of this bug. ***
        Show
        Henri Yandell added a comment - COM-2001 has been marked as a duplicate of this bug. ***
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 33067 12341994
        Henri Yandell made changes -
        Key COM-1842 LANG-42
        Fix Version/s 2.2 [ 12311686 ]
        Component/s Lang [ 12311121 ]
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Project Commons [ 12310458 ] Commons Lang [ 12310481 ]
        Affects Version/s 2.0 Final [ 12311658 ]
        Henri Yandell made changes -
        Affects Version/s 2.0 Final [ 12311706 ]
        Henri Yandell made changes -
        Fix Version/s 2.2 [ 12311702 ]
        Henri Yandell made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12370899 ] Default workflow, editable Closed status [ 12602395 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Resolved Resolved Closed Closed
        754d 20h 56m 1 Henri Yandell 06/Feb/07 23:47

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development