You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/01/12 18:51:05 UTC

DO NOT REPLY [Bug 33067] New: - EqualsBuilder.append(Object[], Object[]) crashes with a NullPointerException if an element of the first array is null

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33067>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33067

           Summary: EqualsBuilder.append(Object[], Object[]) crashes with a
                    NullPointerException if an element of the first array is
                    null
           Product: Commons
           Version: 2.0 Final
          Platform: Macintosh
        OS/Version: Mac OS X 10.3
            Status: NEW
          Keywords: PatchAvailable
          Severity: critical
          Priority: P1
         Component: Lang
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: andrew@terracottatech.com


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 :-).

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org