Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Gabel2016-07-13 06:09:34 -0400
committerSebastien Gabel2016-07-13 06:09:34 -0400
commit0f9caefb8b78f84844d4573e5a65b2211df12ca6 (patch)
tree78172b05949c20bbdeae5dcab28077efb8169e35 /plugins
parentf2d0367bf3fcfba6a5dbb6c597e346af6fd96666 (diff)
downloadorg.eclipse.papyrus-0f9caefb8b78f84844d4573e5a65b2211df12ca6.tar.gz
org.eclipse.papyrus-0f9caefb8b78f84844d4573e5a65b2211df12ca6.tar.xz
org.eclipse.papyrus-0f9caefb8b78f84844d4573e5a65b2211df12ca6.zip
Bug 497819: Potential NPE in
ConstraintPasteStrategy#getGraphicalCommand(...) https://bugs.eclipse.org/bugs/show_bug.cgi?id=497819 Check constraintClipboard variable before using it. Change-Id: I0ce193c63216a20d97bbf83f19dfc67c9620185d Signed-off-by: Sebastien Gabel <sebastien.gabel@esterel-technologies.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/ConstraintPasteStrategy.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/ConstraintPasteStrategy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/ConstraintPasteStrategy.java
index c76e827ba00..0575b075a68 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/ConstraintPasteStrategy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/strategy/paste/ConstraintPasteStrategy.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
+ * Copyright (c) 2014, 2016 CEA LIST, Esterel Technologies SAS and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ * Sebastien Bordes (Esterel Technologies SAS) - Bug 497819
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.strategy.paste;
@@ -160,17 +162,18 @@ public class ConstraintPasteStrategy extends AbstractPasteStrategy implements IP
}
Object internalFromTarget = getInternalFromTarget(papyrusClipboard, targetConstraint);
ConstraintClipboard constraintClipboard = (ConstraintClipboard) additionalDataMap.get(internalFromTarget);
- Namespace context = constraintClipboard.getContext();
- if (checkContext(targetOwner, context)) {
- RecordingCommand semanticCommand = buildSemanticCommand(domain, targetConstraint, context);
- if (semanticCommand != null) {
- compoundCommand.add(EMFtoGEFCommandWrapper.wrap(semanticCommand));
- ShowConstraintContextLink command = new ShowConstraintContextLink((TransactionalEditingDomain) domain, targetEditPart, (View) target);
- compoundCommand.add(GMFtoGEFCommandWrapper.wrap(command));
- alreadyprocesed.add(targetConstraint);
+ if (constraintClipboard != null) {
+ Namespace context = constraintClipboard.getContext();
+ if (checkContext(targetOwner, context)) {
+ RecordingCommand semanticCommand = buildSemanticCommand(domain, targetConstraint, context);
+ if (semanticCommand != null) {
+ compoundCommand.add(EMFtoGEFCommandWrapper.wrap(semanticCommand));
+ ShowConstraintContextLink command = new ShowConstraintContextLink((TransactionalEditingDomain) domain, targetEditPart, (View) target);
+ compoundCommand.add(GMFtoGEFCommandWrapper.wrap(command));
+ alreadyprocesed.add(targetConstraint);
+ }
}
}
-
}
}
}

Back to the top