ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r797509 - in /ant/core/trunk: CONTRIBUTORS WHATSNEW contributors.xml docs/manual/CoreTasks/get.html src/main/org/apache/tools/ant/taskdefs/Get.java
Date Fri, 24 Jul 2009 14:55:06 GMT
Author: bodewig
Date: Fri Jul 24 14:55:05 2009
New Revision: 797509

URL: http://svn.apache.org/viewvc?rev=797509&view=rev
Log:
configurable number of retries in get, option to skip existing files.  Submitted by David
M. Lloyd.  PR 40058

Modified:
    ant/core/trunk/CONTRIBUTORS
    ant/core/trunk/WHATSNEW
    ant/core/trunk/contributors.xml
    ant/core/trunk/docs/manual/CoreTasks/get.html
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java

Modified: ant/core/trunk/CONTRIBUTORS
URL: http://svn.apache.org/viewvc/ant/core/trunk/CONTRIBUTORS?rev=797509&r1=797508&r2=797509&view=diff
==============================================================================
Binary files - no diff available.

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=797509&r1=797508&r2=797509&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Fri Jul 24 14:55:05 2009
@@ -808,6 +808,10 @@
    expression based way to determine progress based on logged messages.
    Bugzilla Report 39957.
 
+ * the number of retries on error in <get> is now configurable.  <get>
+   can be told to not download files that already exist locally.
+   Bugzilla Report 40058.
+
 Changes from Ant 1.7.0 TO Ant 1.7.1
 =============================================
 

Modified: ant/core/trunk/contributors.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/contributors.xml?rev=797509&r1=797508&r2=797509&view=diff
==============================================================================
--- ant/core/trunk/contributors.xml (original)
+++ ant/core/trunk/contributors.xml Fri Jul 24 14:55:05 2009
@@ -314,6 +314,11 @@
   </name>
   <name>
     <first>David</first>
+    <middle>M.</middle>
+    <last>Lloyd</last>
+  </name>
+  <name>
+    <first>David</first>
     <last>Maclean</last>
   </name>
   <name>

Modified: ant/core/trunk/docs/manual/CoreTasks/get.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/get.html?rev=797509&r1=797508&r2=797509&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/get.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/get.html Fri Jul 24 14:55:05 2009
@@ -103,6 +103,18 @@
     <td align="center" valign="top">No: default 0 which means no
       maximum time</td>
   </tr>  
+  <tr>
+    <td valign="top">retries</td>
+    <td valign="top">the number of retries on error<br/>
+      <em>since Ant 1.8.0</em></td>
+    <td align="center" valign="top">No; default "3"</td>
+  </tr>
+  <tr>
+    <td valign="top">skipexisting</td>
+    <td valign="top">skip files that already exist on the local filesystem<br/>
+      <em>since Ant 1.8.0</em></td>
+    <td align="center" valign="top">No; default "false"</td>
+  </tr>
 </table>
 <h3>Examples</h3>
 <pre>  &lt;get src=&quot;http://ant.apache.org/&quot; dest=&quot;help/index.html&quot;/&gt;</pre>

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java?rev=797509&r1=797508&r2=797509&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java Fri Jul 24 14:55:05 2009
@@ -65,6 +65,8 @@
     private String uname = null;
     private String pword = null;
     private long maxTime = 0;
+    private int numberRetries = NUMBER_RETRIES;
+    private boolean skipExisting = false;
 
     /**
      * Does the work.
@@ -108,6 +110,12 @@
             throws IOException {
         checkAttributes();
 
+        if (dest.exists() && skipExisting) {
+            log("Destination already exists (skipping): "
+                + dest.getAbsolutePath(), logLevel);
+            return true;
+        }
+
         //dont do any progress, unless asked
         if (progress == null) {
             progress = new NullProgress();
@@ -267,13 +275,35 @@
      * The time in seconds the download is allowed to take before
      * being terminated.
      *
-     * @since ant 1.8.0
+     * @since Ant 1.8.0
      */
     public void setMaxTime(long maxTime) {
         this.maxTime = maxTime;
     }
 
     /**
+     * The number of retries to attempt upon error, defaults to 3.
+     *
+     * @param r retry count
+     *
+     * @since Ant 1.8.0
+     */
+    public void setRetries(int r) {
+        this.numberRetries = r;
+    }
+
+    /**
+     * Skip files that already exist locally.
+     *
+     * @param s "true" to skip existing destination files
+     *
+     * @since Ant 1.8.0
+     */
+    public void setSkipExisting(boolean s) {
+        this.skipExisting = s;
+    }
+
+    /**
      * Interface implemented for reporting
      * progess of downloading.
      */
@@ -536,7 +566,7 @@
 
         private boolean downloadFile()
                 throws FileNotFoundException, IOException {
-            for (int i = 0; i < NUMBER_RETRIES; i++) {
+            for (int i = 0; i < numberRetries; i++) {
                 // this three attempt trick is to get round quirks in different
                 // Java implementations. Some of them take a few goes to bind
                 // property; we ignore the first couple of such failures.



Mime
View raw message