Community
Participate
Working Groups
The cleanDiffGroup(DiffGroup) method is cleaning (removing from its container) an "empty" DiffGroup. From its point of view, an empty DiffGroup is a group with no visible (i.e. not hidden) DiffElement. It causes NPE and other IllegalArguments exception when trying to apply a set of merge operations from an AbstractDiffExtension because a parent group can be removed from its container at a given step. It should remove a DiffGroup only if subDiffElements list is empty and not if there is no more visible diff elements. Mika
The patch is to change the method DefaultMerger#cleanDiffGroup(DiffGroup) from protected void cleanDiffGroup(DiffGroup diffGroup) { if (diffGroup != null && diffGroup.getSubchanges() == 0) { final EObject parent = diffGroup.eContainer(); if (parent instanceof DiffGroup) { EcoreUtil.remove(diffGroup); cleanDiffGroup((DiffGroup)parent); } } } to protected void cleanDiffGroup(DiffGroup diffGroup) { if (diffGroup != null && diffGroup.getSubDiffElements().isEmpty()) { // This line is different final EObject parent = diffGroup.eContainer(); if (parent instanceof DiffGroup) { EcoreUtil.remove(diffGroup); cleanDiffGroup((DiffGroup)parent); } } }
This had been fixed on master with "diffGroup.getSubDiffElements().size() == 0".