aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Brychcy2018-05-22 14:40:16 -0400
committerFred Bricon2018-05-22 17:10:27 -0400
commita1e24f9f417719d3685824383291f05a111a409e (patch)
treeb9c89102b180a78b5d4abd29ce02357336738abb
parentbecd640851486fdd17bb711d32346d71969201a1 (diff)
downloadm2e-core-a1e24f9f417719d3685824383291f05a111a409e.tar.gz
m2e-core-a1e24f9f417719d3685824383291f05a111a409e.tar.xz
m2e-core-a1e24f9f417719d3685824383291f05a111a409e.zip
Bug 387736 - NPE thrown when no "action" supplied in lifecycle-mapping
pluginExecution Change-Id: I69f3d1588fdd39fb5a3d64db3ce95bfeebfe381c Signed-off-by: Till Brychcy <register.eclipse@brychcy.de>
-rw-r--r--org.eclipse.m2e.core/mdo/lifecycle-mapping-metadata-model.xml8
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java6
2 files changed, 9 insertions, 5 deletions
diff --git a/org.eclipse.m2e.core/mdo/lifecycle-mapping-metadata-model.xml b/org.eclipse.m2e.core/mdo/lifecycle-mapping-metadata-model.xml
index c7b76018..791b62f1 100644
--- a/org.eclipse.m2e.core/mdo/lifecycle-mapping-metadata-model.xml
+++ b/org.eclipse.m2e.core/mdo/lifecycle-mapping-metadata-model.xml
@@ -233,13 +233,15 @@
<codeSegment>
<code><![CDATA[
public org.eclipse.m2e.core.lifecyclemapping.model.PluginExecutionAction getAction() {
- org.codehaus.plexus.util.xml.Xpp3Dom actionDom = ((org.codehaus.plexus.util.xml.Xpp3Dom) getActionDom()).getChild(0);
- return org.eclipse.m2e.core.lifecyclemapping.model.PluginExecutionAction.valueOf(actionDom.getName());
+ org.codehaus.plexus.util.xml.Xpp3Dom actionDom = (org.codehaus.plexus.util.xml.Xpp3Dom) getActionDom();
+ org.codehaus.plexus.util.xml.Xpp3Dom childDom = actionDom == null ? null : actionDom.getChild(0);
+ if(childDom == null) return org.eclipse.m2e.core.lifecyclemapping.model.PluginExecutionAction.configurator;
+ return org.eclipse.m2e.core.lifecyclemapping.model.PluginExecutionAction.valueOf(childDom.getName());
}
public org.codehaus.plexus.util.xml.Xpp3Dom getConfiguration() {
org.codehaus.plexus.util.xml.Xpp3Dom actionDom = ((org.codehaus.plexus.util.xml.Xpp3Dom) getActionDom());
- return actionDom.getChild(0);
+ return actionDom == null ? null : actionDom.getChild(0);
}
private transient LifecycleMappingMetadataSource source;
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java
index 93f12331..ad3d3222 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java
@@ -895,7 +895,8 @@ public class LifecycleMappingFactory {
}
public static String getProjectConfiguratorId(IPluginExecutionMetadata metadata) {
- Xpp3Dom child = ((PluginExecutionMetadata) metadata).getConfiguration().getChild(ATTR_ID);
+ Xpp3Dom configuration = ((PluginExecutionMetadata) metadata).getConfiguration();
+ Xpp3Dom child = configuration == null ? null : configuration.getChild(ATTR_ID);
if(child == null || child.getValue().trim().length() == 0) {
throw new LifecycleMappingConfigurationException("A configurator id must be specified");
}
@@ -903,7 +904,8 @@ public class LifecycleMappingFactory {
}
public static String getActionMessage(IPluginExecutionMetadata metadata) {
- Xpp3Dom child = ((PluginExecutionMetadata) metadata).getConfiguration().getChild(ELEMENT_MESSAGE);
+ Xpp3Dom configuration = ((PluginExecutionMetadata) metadata).getConfiguration();
+ Xpp3Dom child = configuration == null ? null : configuration.getChild(ELEMENT_MESSAGE);
if(child == null || child.getValue().trim().length() == 0) {
return null;
}