Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Charles David2017-09-19 09:03:18 +0000
committerStéphane Bégaudeau2018-01-26 15:04:18 +0000
commit49452bd0cced75898803c737373b7f052f162edb (patch)
treed954f2ede70913075bfbff2f3ca7c699e3105794
parent78d12316b8f118cd30e68973dc5ae641430dea79 (diff)
downloadorg.eclipse.eef-49452bd0cced75898803c737373b7f052f162edb.tar.gz
org.eclipse.eef-49452bd0cced75898803c737373b7f052f162edb.tar.xz
org.eclipse.eef-49452bd0cced75898803c737373b7f052f162edb.zip
Fix potential NPE in error reporting code
If the 'class' attribute is missing in the extension configuration, we'll hit the error handling block, but we should not pass null to MessageFormat.format() in this case. Change-Id: Ie44bf601dcd0ce209431d76e97963f73b47b4bca Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
-rw-r--r--plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/internal/extension/impl/EEFDescriptorRegistryEventListener.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/internal/extension/impl/EEFDescriptorRegistryEventListener.java b/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/internal/extension/impl/EEFDescriptorRegistryEventListener.java
index 9cf36368e..ae8fabaf3 100644
--- a/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/internal/extension/impl/EEFDescriptorRegistryEventListener.java
+++ b/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/internal/extension/impl/EEFDescriptorRegistryEventListener.java
@@ -136,8 +136,14 @@ public class EEFDescriptorRegistryEventListener<T> extends AbstractRegistryEvent
EEFTabbedPropertyViewPlugin.getPlugin().error(message);
}
} catch (CoreException e) {
- String message = MessageFormat.format(Messages.DescriptorRegistryEventListener_cannotInstantiateExtension,
- configurationElement.getAttribute(IMPL_CLASS_DESCRIPTOR_ATTR));
+ String attr = configurationElement.getAttribute(IMPL_CLASS_DESCRIPTOR_ATTR);
+ String message;
+ if (attr != null) {
+ message = MessageFormat.format(Messages.DescriptorRegistryEventListener_cannotInstantiateExtension, attr);
+ } else {
+ message = MessageFormat.format(Messages.DescriptorRegistryEventListener_missingAttribute,
+ configurationElement.getNamespaceIdentifier(), IMPL_CLASS_DESCRIPTOR_ATTR);
+ }
EEFTabbedPropertyViewPlugin.getPlugin().error(message, e);
return false;
}

Back to the top