Browse Source

No need to use Touch task as we can just call File.setLastModified()

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270493 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
d44f286ff0
2 changed files with 8 additions and 44 deletions
  1. +4
    -22
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Get.java
  2. +4
    -22
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Get.java

+ 4
- 22
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Get.java View File

@@ -17,7 +17,6 @@ import java.net.URLConnection;
import java.util.Date;
import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.file.Touch;

/**
* Get a particular file from a URL source. Options include verbose reporting,
@@ -270,8 +269,11 @@ public class Get extends Task
getLogger().info( "last modified = " + t.toString()
+ ( ( remoteTimestamp == 0 ) ? " - using current time instead" : "" ) );
}

if( remoteTimestamp != 0 )
touchFile( dest, remoteTimestamp );
{
dest.setLastModified( remoteTimestamp );
}
}
}
catch( IOException ioe )
@@ -283,26 +285,6 @@ public class Get extends Task
}
}

/**
* set the timestamp of a named file to a specified time.
*
* @param file Description of Parameter
* @param timemillis Description of Parameter
* @return true if it succeeded. False means that this is a java1.1 system
* and that file times can not be set
* @exception TaskException Thrown in unrecoverable error. Likely this
* comes from file access failures.
*/
protected void touchFile( File file, long timemillis )
throws TaskException
{

Touch touch = (Touch)getProject().createTask( "touch" );
touch.setFile( file );
touch.setMillis( timemillis );
touch.touch();
}

/**
* BASE 64 encoding of a String or an array of bytes. Based on RFC 1421.
*


+ 4
- 22
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Get.java View File

@@ -17,7 +17,6 @@ import java.net.URLConnection;
import java.util.Date;
import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.file.Touch;

/**
* Get a particular file from a URL source. Options include verbose reporting,
@@ -270,8 +269,11 @@ public class Get extends Task
getLogger().info( "last modified = " + t.toString()
+ ( ( remoteTimestamp == 0 ) ? " - using current time instead" : "" ) );
}

if( remoteTimestamp != 0 )
touchFile( dest, remoteTimestamp );
{
dest.setLastModified( remoteTimestamp );
}
}
}
catch( IOException ioe )
@@ -283,26 +285,6 @@ public class Get extends Task
}
}

/**
* set the timestamp of a named file to a specified time.
*
* @param file Description of Parameter
* @param timemillis Description of Parameter
* @return true if it succeeded. False means that this is a java1.1 system
* and that file times can not be set
* @exception TaskException Thrown in unrecoverable error. Likely this
* comes from file access failures.
*/
protected void touchFile( File file, long timemillis )
throws TaskException
{

Touch touch = (Touch)getProject().createTask( "touch" );
touch.setFile( file );
touch.setMillis( timemillis );
touch.touch();
}

/**
* BASE 64 encoding of a String or an array of bytes. Based on RFC 1421.
*


Loading…
Cancel
Save