You are viewing a plain text version of this content. The canonical link for it is here.
Posted to m2-dev@maven.apache.org by jd...@apache.org on 2004/08/10 04:38:08 UTC

cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/phase GoalResolutionPhase.java

jdcasey     2004/08/09 19:38:08

  Modified:    maven-core/src/main/java/org/apache/maven/lifecycle/phase
                        GoalResolutionPhase.java
  Log:
  o Added check for null MojoDescriptor in the lifecycle context (throws GoalNotFoundException if == null)
  
  Revision  Changes    Path
  1.2       +8 -2      maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/phase/GoalResolutionPhase.java
  
  Index: GoalResolutionPhase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/phase/GoalResolutionPhase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GoalResolutionPhase.java	9 Aug 2004 19:02:35 -0000	1.1
  +++ GoalResolutionPhase.java	10 Aug 2004 02:38:07 -0000	1.2
  @@ -17,6 +17,7 @@
    * 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 @@
               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 );