summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2012-09-20 06:06:29 (EDT)
committerStephan Born2012-09-20 06:06:29 (EDT)
commit27cd920769ef0abaa8361ee1a039946f8ec3fb37 (patch)
tree7a5e33d9c025a1851ca9673dbbe7dc210889760b
parentafe752ce4cbb37b9cf36dd6fb51f8a105ef2cb66 (diff)
downloadorg.eclipse.stardust.ui.web-27cd920769ef0abaa8361ee1a039946f8ec3fb37.zip
org.eclipse.stardust.ui.web-27cd920769ef0abaa8361ee1a039946f8ec3fb37.tar.gz
org.eclipse.stardust.ui.web-27cd920769ef0abaa8361ee1a039946f8ec3fb37.tar.bz2
CRNT-26269
1)Added a NP check for modifications EList in ChangesetMinifier.java git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@59387 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/postprocessing/ChangesetMinifier.java77
1 files changed, 41 insertions, 36 deletions
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/postprocessing/ChangesetMinifier.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/postprocessing/ChangesetMinifier.java
index f506a8f..940d5e2 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/postprocessing/ChangesetMinifier.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/postprocessing/ChangesetMinifier.java
@@ -7,6 +7,7 @@ import org.eclipse.emf.ecore.change.ChangeKind;
import org.eclipse.emf.ecore.change.FeatureChange;
import org.eclipse.emf.ecore.change.ListChange;
+import org.eclipse.stardust.common.CollectionUtils;
import org.eclipse.stardust.model.xpdl.builder.session.Modification;
import org.eclipse.stardust.ui.web.modeler.edit.spi.ChangePostprocessor;
@@ -22,67 +23,71 @@ public class ChangesetMinifier implements ChangePostprocessor
.get(candidate);
// count up to be sure not to miss any non-pure change
int nPureContainerChanges = 0;
- for (FeatureChange modification : modifications)
+ if (CollectionUtils.isNotEmpty(modifications))
{
- if (modification.getFeature() instanceof EReference)
+ for (FeatureChange modification : modifications)
{
- EReference eRef = (EReference) modification.getFeature();
- if (eRef.isContainment())
+ if (modification.getFeature() instanceof EReference)
{
- if (eRef.isMany())
+ EReference eRef = (EReference) modification.getFeature();
+ if (eRef.isContainment())
{
- if (modification.getListChanges().isEmpty())
+ if (eRef.isMany())
{
- @SuppressWarnings("rawtypes")
- EList elements = (EList) candidate.eGet(eRef);
- if (change.getAddedElements().containsAll(elements))
+ if (modification.getListChanges().isEmpty())
{
- ++nPureContainerChanges;
- continue;
+ @SuppressWarnings("rawtypes")
+ EList elements = (EList) candidate.eGet(eRef);
+ if (change.getAddedElements().containsAll(elements))
+ {
+ ++nPureContainerChanges;
+ continue;
+ }
}
- }
- else
- {
- for (ListChange listChange : modification.getListChanges())
+ else
{
- if (ChangeKind.REMOVE_LITERAL == listChange.getKind())
+ for (ListChange listChange : modification.getListChanges())
{
- // this actually means something was added
- @SuppressWarnings("rawtypes")
- EObject addedElement = (EObject) ((EList) candidate.eGet(eRef)).get(listChange.getIndex());
- if (change.getAddedElements().contains(addedElement))
+ if (ChangeKind.REMOVE_LITERAL == listChange.getKind())
{
- ++nPureContainerChanges;
- continue;
+ // this actually means something was added
+ @SuppressWarnings("rawtypes")
+ EObject addedElement = (EObject) ((EList) candidate.eGet(eRef)).get(listChange.getIndex());
+ if (change.getAddedElements().contains(addedElement))
+ {
+ ++nPureContainerChanges;
+ continue;
+ }
}
- }
- else if (ChangeKind.ADD_LITERAL == listChange.getKind())
- {
- // this actually means something was removed
- if (change.getRemovedElements().containsAll(listChange.getReferenceValues()))
+ else if (ChangeKind.ADD_LITERAL == listChange.getKind())
{
- ++nPureContainerChanges;
- continue;
+ // this actually means something was removed
+ if (change.getRemovedElements().containsAll(
+ listChange.getReferenceValues()))
+ {
+ ++nPureContainerChanges;
+ continue;
+ }
}
}
}
}
}
+ else
+ {
+ // other than modified containment reference, exit quickly
+ break;
+ }
}
else
{
- // other than modified containment reference, exit quickly
+ // other than modified reference, exit quickly
break;
}
}
- else
- {
- // other than modified reference, exit quickly
- break;
- }
}
- if (nPureContainerChanges == modifications.size())
+ if (CollectionUtils.isEmpty(modifications) || nPureContainerChanges == modifications.size())
{
change.markUnmodified(candidate);
}