MNG-5349: Make sure lifecycles have and id. When we switch to JSR330 I would prefer to use private final fields in Lifecycle.java and use the Precondition.assertNotNull check. This will serve for now.

This commit is contained in:
Jason van Zyl 2014-06-15 17:05:45 -04:00
parent 6cf9320942
commit 1a4c003a2b
1 changed files with 6 additions and 2 deletions

View File

@ -24,6 +24,8 @@ import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.StringUtils;
import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@ -119,7 +121,9 @@ public class DefaultLifecycles
ArrayList<Lifecycle> result = new ArrayList<Lifecycle>();
for ( String name : lifecycleNames )
{
result.add( lifecycles.get( name ) );
Lifecycle lifecycle = lifecycles.get( name );
Preconditions.checkNotNull( "A lifecycle must have an id.", lifecycle.getId() );
result.add( lifecycle );
}
return result;
@ -129,7 +133,7 @@ public class DefaultLifecycles
{
Set<String> phases = new LinkedHashSet<String>();
for ( Lifecycle lifecycle : lifecycles.values() )
for ( Lifecycle lifecycle : getLifeCycles() )
{
phases.addAll( lifecycle.getPhases() );
}