Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346846 - ArrayIndexOutOfBoundException when comparing identical resources
Summary: ArrayIndexOutOfBoundException when comparing identical resources
Status: CLOSED WORKSFORME
Alias: None
Product: EMFCompare
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: EMF Compare CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-23 06:17 EDT by Mikaël Barbero CLA
Modified: 2011-07-21 05:53 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.