Menu

#39 Comparing collections of different sizes transpose values

open
nobody
Bug (29)
5
2010-07-09
2010-07-09
Anonymous
No

When comparing two Collections of different length, the values in CompareResult are transposed if the collection passed in as object 1 is shorter. For example:
List one = new ArrayList();
one.add("first");
List two = new ArrayList();
two.add("first");
two.add("second");
CompareResult[] results = new ObjectUtil().compareAll(one,two);

In this case results[0].differentValue1 == "second", and results[0].differentValue2 == null

I've attached a test case to expose this behaviour and a patch to fix it.

Discussion

  • Mario Linke

    Mario Linke - 2010-07-16

    Is this realy a bug? The result is the different value on the position 1 in the list (differentPath = [1] and differentValue: second <> null).

    best regards
    Maro

     

Log in to post a comment.

MongoDB Logo MongoDB