https://issues.apache.org/bugzilla/show_bug.cgi?id=50898

--- Comment #5 from Philippe Mouawad <[email protected]> 2011-10-01 
23:24:41 UTC ---
I confirm there is an issue related to hashCode and equals.

to test this hypothesis I modified HashTree#traverseInto:
private void traverseInto(HashTreeTraverser visitor) {

        if (list().size() == 0) {
            visitor.processPath();
        } else {
            Iterator<?> iter = list().iterator();

            while (iter.hasNext()) {
                Object item = iter.next();
                final HashTree treeItem = getTree(item);
                visitor.addNode(item, treeItem);
                if(treeItem==null)
                {
                    List<IncludeController>  list = new
ArrayList<IncludeController>();
                    Iterator<?> iter2 = list().iterator();
                    while (iter2.hasNext()) {
                        Object item2 = iter2.next();
                        if(item2 instanceof IncludeController)
                        {
                            list.add((IncludeController)item2);
                        }
                    }
                    if(list.size()==2)
                    {
                        IncludeController controller1 = list.get(0);
                        IncludeController controller2 = list.get(1);
                        System.out.println(controller1.equals(controller2));
                        System.out.println(controller1.hashCode());
                        System.out.println(controller2.hashCode());
                    }
                }
                treeItem.traverseInto(visitor);
            }
        }
        visitor.subtractNode();
    }



And it shows the following:
true => Objects are equals
831453930
1248040939

According to javadocs:
If two objects are equal according to the equals(Object) method, then calling
the hashCode method on each of the two objects must produce the same integer
result.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to