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/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file Mkdir.java
Date Tue, 01 Jan 2002 09:02:17 GMT
donaldp     02/01/01 01:02:17

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file
                        Mkdir.java
  Log:
  Cleaned up and made extend AbstractTask rather than Task
  
  Revision  Changes    Path
  1.3       +19 -16    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Mkdir.java
  
  Index: Mkdir.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Mkdir.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Mkdir.java	23 Dec 2001 06:34:24 -0000	1.2
  +++ Mkdir.java	1 Jan 2002 09:02:17 -0000	1.3
  @@ -8,48 +8,51 @@
   package org.apache.tools.ant.taskdefs.file;
   
   import java.io.File;
  +import org.apache.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.api.TaskException;
  -import org.apache.tools.ant.Task;
   
   /**
    * Creates a given directory.
    *
    * @author duncan@x180.com
    */
  -
  -public class Mkdir extends Task
  +public class Mkdir
  +    extends AbstractTask
   {
  +    private File m_dir;
   
  -    private File dir;
  -
  -    public void setDir( File dir )
  +    public void setDir( final File dir )
       {
  -        this.dir = dir;
  +        m_dir = dir;
       }
   
       public void execute()
           throws TaskException
       {
  -        if( dir == null )
  +        if( m_dir == null )
           {
  -            throw new TaskException( "dir attribute is required" );
  +            final String message = "dir attribute is required";
  +            throw new TaskException( message );
           }
   
  -        if( dir.isFile() )
  +        if( m_dir.isFile() )
           {
  -            throw new TaskException( "Unable to create directory as a file already exists
with that name: " + dir.getAbsolutePath() );
  +            final String message = "Unable to create directory as a file " +
  +                "already exists with that name: " + m_dir.getAbsolutePath();
  +            throw new TaskException( message );
           }
   
  -        if( !dir.exists() )
  +        if( !m_dir.exists() )
           {
  -            boolean result = dir.mkdirs();
  +            boolean result = m_dir.mkdirs();
               if( result == false )
               {
  -                String msg = "Directory " + dir.getAbsolutePath() + " creation was not
" +
  +                final String message = "Directory " + m_dir.getAbsolutePath() + " creation
was not " +
                       "successful for an unknown reason";
  -                throw new TaskException( msg );
  +                throw new TaskException( message );
               }
  -            getLogger().info( "Created dir: " + dir.getAbsolutePath() );
  +            final String message = "Created dir: " + m_dir.getAbsolutePath();
  +            getLogger().info( message );
           }
       }
   }
  
  
  

--
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