From 567a47cf8237df0e3e70cd8561650f261fd15770 Mon Sep 17 00:00:00 2001 From: John Dennis Casey Date: Tue, 10 Aug 2004 02:38:07 +0000 Subject: [PATCH] o Added check for null MojoDescriptor in the lifecycle context (throws GoalNotFoundException if == null) git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@162940 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/lifecycle/phase/GoalResolutionPhase.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/phase/GoalResolutionPhase.java b/maven-core/src/main/java/org/apache/maven/lifecycle/phase/GoalResolutionPhase.java index 3726bc8a75..48914f3053 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/phase/GoalResolutionPhase.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/phase/GoalResolutionPhase.java @@ -17,6 +17,7 @@ package org.apache.maven.lifecycle.phase; * limitations under the License. */ +import org.apache.maven.GoalNotFoundException; import org.apache.maven.decoration.GoalDecorator; import org.apache.maven.decoration.GoalDecoratorBindings; import org.apache.maven.lifecycle.AbstractMavenLifecyclePhase; @@ -47,7 +48,12 @@ public class GoalResolutionPhase extends AbstractMavenLifecyclePhase pluginManager = (PluginManager) context.getContainer().lookup( PluginManager.ROLE ); // First, start by retrieving the currently-requested goal. - String goal = context.getMojoDescriptor().getId(); + MojoDescriptor goalDescriptor = context.getMojoDescriptor(); + if(goalDescriptor == null) { + throw new GoalNotFoundException(context.getGoalName()); + } + + String goal = goalDescriptor.getId(); List resolvedGoals = resolveTopLevel( goal, new HashSet(), new LinkedList(), context, pluginManager );