ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces EmbeddedAnt.java Resources.properties
Date Thu, 23 May 2002 06:21:48 GMT
donaldp     02/05/22 23:21:48

  Modified:    container/src/java/org/apache/myrmidon/interfaces
                        EmbeddedAnt.java Resources.properties
  Log:
  Give warnings if targets no exist.
  
  Revision  Changes    Path
  1.13      +27 -3     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/EmbeddedAnt.java
  
  Index: EmbeddedAnt.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/EmbeddedAnt.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- EmbeddedAnt.java	23 May 2002 01:02:21 -0000	1.12
  +++ EmbeddedAnt.java	23 May 2002 06:21:47 -0000	1.13
  @@ -43,7 +43,7 @@
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.12 $ $Date: 2002/05/23 01:02:21 $
  + * @version $Revision: 1.13 $ $Date: 2002/05/23 06:21:47 $
    */
   public class EmbeddedAnt
       extends AbstractLogEnabled
  @@ -238,7 +238,9 @@
           //if we didn't specify a target, then choose default
           if( targets == null || targets.length == 0 )
           {
  -            final TargetMetaData target = project.getTarget( project.getDefaultTargetName()
);
  +            final String defaultTargetName = project.getDefaultTargetName();
  +            final TargetMetaData target = project.getTarget( defaultTargetName );
  +            checkNotNullTarget( defaultTargetName, target );
               project.execute( frame, target );
           }
           else
  @@ -246,12 +248,33 @@
               for( int i = 0; i < targets.length; i++ )
               {
                   final TargetMetaData target = project.getTarget( targets[ i ] );
  +                checkNotNullTarget( targets[ i ], target );
                   project.execute( frame, target );
               }
           }
       }
   
       /**
  +     * Verify target not nhull and if it is throw an exception.
  +     *
  +     * @param name the name we were looking up
  +     * @param target the target to check
  +     * @throws TaskException if target is null
  +     */
  +    private void checkNotNullTarget( final String name,
  +                                     final TargetMetaData target )
  +        throws TaskException
  +    {
  +        if( null == target )
  +        {
  +            final String message =
  +                REZ.getString( "embed.missing-target.error",
  +                               name );
  +            throw new TaskException( message );
  +        }
  +    }
  +
  +    /**
        * Make sure myrmidon home directory has been specified, and is a
        * directory.  Set the paths that the embeddor expects.
        */
  @@ -372,7 +395,8 @@
           final File projectFile = ( new File( m_projectFile ) ).getCanonicalFile();
           if( !projectFile.isFile() )
           {
  -            final String message = REZ.getString( "bad-file.error", projectFile );
  +            final String message =
  +                REZ.getString( "bad-file.error", projectFile );
               throw new Exception( message );
           }
   
  
  
  
  1.2       +1 -0      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/Resources.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Resources.properties	14 Apr 2002 08:47:26 -0000	1.1
  +++ Resources.properties	23 May 2002 06:21:47 -0000	1.2
  @@ -7,3 +7,4 @@
   lib-dir.name=Library directory
   task-lib-dir.name=Antlib directory
   ext-dir.name=Extension directory
  +embed.missing-target.error=Unable to locate target named "{0}".
  \ No newline at end of file
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message