Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 346846

Summary: ArrayIndexOutOfBoundException when comparing identical resources
Product: [Modeling] EMFCompare Reporter: Mikaël Barbero <mikael.barbero>
Component: CoreAssignee: EMF Compare <emf.compare-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: laurent.goubet, mikael.barbero
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Mikaël Barbero CLA 2011-05-23 06:17:29 EDT
I got a corner case when trying to compare identical resources, ModelContentMergeDiffTab#mapDifference() is throwing me an ArrayIndexOutOfBoundException.

The else statement should test the items array of the tree for emptyness before accessing it. The comment says to do something else, but I don't see what. Maybe the real fix is not the test for emptyness, but to remove the TODO ;)

} else {
	// TODO for now, we're using the first item's data, we should
	// look for the matchedElement
	TreeItem[] items = getTree().getItems();
	if (items.length > 0) {
		dataToDiff.put(items[0].getData(), diff);
	}
}
Comment 1 Laurent Goubet CLA 2011-07-21 05:53:56 EDT
This seems to have been fixed since.