Fix NPE in NotifyingXMLHelper.setValue()
A potential NPE has been introduced in a recent change. This change
avoid this NPE.
Change-Id: Ia0e92bdcce5c780be037cb00eefb4eea50b15fc0
Signed-off-by: Philip Langer <planger@eclipsesource.com>
diff --git a/plugins/org.eclipse.emf.compare.ide/src/org/eclipse/emf/compare/ide/internal/utils/NotifyingParserPool.java b/plugins/org.eclipse.emf.compare.ide/src/org/eclipse/emf/compare/ide/internal/utils/NotifyingParserPool.java
index 10b3ed7..89452d4 100644
--- a/plugins/org.eclipse.emf.compare.ide/src/org/eclipse/emf/compare/ide/internal/utils/NotifyingParserPool.java
+++ b/plugins/org.eclipse.emf.compare.ide/src/org/eclipse/emf/compare/ide/internal/utils/NotifyingParserPool.java
@@ -287,23 +287,24 @@
}
@Override
- public void setValue(EObject eObject, EStructuralFeature eStructuralFeature, Object value,
- int position) {
- if (eStructuralFeature instanceof EReference) {
- boolean isContainment = eStructuralFeature instanceof EReference
- && ((EReference)eStructuralFeature).isContainment();
+ public void setValue(EObject eObject, EStructuralFeature feature, Object value, int position) {
+ if (feature instanceof EReference) {
+ boolean isContainment = feature instanceof EReference
+ && ((EReference)feature).isContainment();
if (!containmentOnly || isContainment) {
- super.setValue(eObject, eStructuralFeature, value, position);
+ super.setValue(eObject, feature, value, position);
}
- EObject eObjectValue = (EObject)value;
- final ProxyEntry entry = new ProxyEntry(eObject, eStructuralFeature, eObjectValue, position);
- if (eObjectValue.eIsProxy()) {
- notifyProxy(entry);
- } else if (!isContainment) {
- potentialProxies.add(entry);
+ if (value instanceof EObject) {
+ final EObject eObjectValue = (EObject)value;
+ final ProxyEntry entry = new ProxyEntry(eObject, feature, eObjectValue, position);
+ if (eObjectValue.eIsProxy()) {
+ notifyProxy(entry);
+ } else if (!isContainment) {
+ potentialProxies.add(entry);
+ }
}
} else if (!containmentOnly) {
- super.setValue(eObject, eStructuralFeature, value, position);
+ super.setValue(eObject, feature, value, position);
}
}