Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Delaigue2016-07-11 05:01:33 -0400
committerLaurent Goubet2016-07-11 10:28:54 -0400
commit4a548a2ac74e3622bac8c0e08c2e5bcfa12de513 (patch)
tree645facdbcfab4c7b46ca43f8a58a7d505c317e60
parenta5e980797626b8b5b04c712f2b1374ba7487e4c3 (diff)
downloadorg.eclipse.emf.compare-4a548a2ac74e3622bac8c0e08c2e5bcfa12de513.tar.gz
org.eclipse.emf.compare-4a548a2ac74e3622bac8c0e08c2e5bcfa12de513.tar.xz
org.eclipse.emf.compare-4a548a2ac74e3622bac8c0e08c2e5bcfa12de513.zip
[497492] Fix NPE in tooltip provider
Bug: 497492 Change-Id: Ic0bc125b972d4a310629ffee1e3dbf35f5848201 Signed-off-by: Laurent Delaigue <laurent.delaigue@obeo.fr>
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/AttributeChangeTooltipProvider.java3
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/utils/ReferenceUtil.java14
2 files changed, 10 insertions, 7 deletions
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/AttributeChangeTooltipProvider.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/AttributeChangeTooltipProvider.java
index d1c99f880..b3cf69b7e 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/AttributeChangeTooltipProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/tooltip/AttributeChangeTooltipProvider.java
@@ -93,6 +93,9 @@ public class AttributeChangeTooltipProvider extends AbstractTooltipProvider<Attr
default:
throw new IllegalArgumentException();
}
+ if (changedContainer == null) {
+ return null;
+ }
return String.valueOf(safeEGet(changedContainer, attribute));
}
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/utils/ReferenceUtil.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/utils/ReferenceUtil.java
index c60ba88a5..7fe6bd1b0 100644
--- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/utils/ReferenceUtil.java
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/utils/ReferenceUtil.java
@@ -81,9 +81,9 @@ public final class ReferenceUtil {
* nonetheless, and thus we can use the feature name in order to retrieve the feature's value.
*
* @param object
- * The object for which feature we need a value.
+ * The object for which feature we need a value, must not be <code>null</code>.
* @param feature
- * The actual feature of which we need the value.
+ * The actual feature of which we need the value, must not be <code>null</code>.
* @return The value of the given {@code feature} for the given {@code object}.
*/
public static Object safeEGet(EObject object, EStructuralFeature feature) {
@@ -103,9 +103,9 @@ public final class ReferenceUtil {
* nonetheless, and thus we can use the feature name in order to retrieve the feature's value.
*
* @param object
- * The object for which feature we need a value.
+ * The object for which feature we need a value, must not be <code>null</code>.
* @param feature
- * The actual feature of which we need the value.
+ * The actual feature of which we need the value, must not be <code>null</code>.
* @return whether the {@code feature} for the given {@code object} is set.
*/
public static boolean safeEIsSet(EObject object, EStructuralFeature feature) {
@@ -125,11 +125,11 @@ public final class ReferenceUtil {
* nonetheless, and thus we can use the feature name in order to retrieve the feature's value.
*
* @param object
- * The object for which feature we'll set the value.
+ * The object for which feature we'll set the value, must not be <code>null</code>.
* @param feature
- * The actual feature of which we'll set the value.
+ * The actual feature of which we'll set the value, must not be <code>null</code>.
* @param newValue
- * The value to set.
+ * The value to set, can be <code>null</code>.
*/
public static void safeESet(EObject object, EStructuralFeature feature, Object newValue) {
final EClass clazz = object.eClass();

Back to the top