You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by mb...@apache.org on 2005/03/02 00:09:58 UTC

cvs commit: ant WHATSNEW

mbenson     2005/03/01 15:09:58

  Modified:    src/main/org/apache/tools/ant/taskdefs Get.java
               src/testcases/org/apache/tools/ant/taskdefs GetTest.java
               src/etc/testcases/taskdefs get.xml
               .        WHATSNEW
  Log:
  Get with usetimestamp did not work when local timestamp roughly >= now.
  
  Revision  Changes    Path
  1.49      +3 -6      ant/src/main/org/apache/tools/ant/taskdefs/Get.java
  
  Index: Get.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Get.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- Get.java	25 Feb 2005 22:23:07 -0000	1.48
  +++ Get.java	1 Mar 2005 23:09:58 -0000	1.49
  @@ -160,20 +160,17 @@
           if (connection instanceof HttpURLConnection) {
               HttpURLConnection httpConnection
                       = (HttpURLConnection) connection;
  +            long lastModified = httpConnection.getLastModified();
               if (httpConnection.getResponseCode()
                       == HttpURLConnection.HTTP_NOT_MODIFIED
  -                //workaround:  doesn't work on 1.2
  -                || (hasTimestamp
  -                && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)
  -                && timestamp > httpConnection.getLastModified())) {
  +                || (lastModified != 0 && hasTimestamp
  +                && timestamp > lastModified)) {
                   //not modified so no file download. just return
                   //instead and trace out something so the user
                   //doesn't think that the download happened when it
                   //didn't
                   log("Not modified - so not downloaded", logLevel);
                   return false;
  -                // also, if timestamp is roughly >= now, HTTP_NOT_MODIFIED is _not_
  -                // returned... We may want to remove the 1.2 qualifier above.
               }
               // test for 401 result (HTTP only)
               if (httpConnection.getResponseCode()
  
  
  
  1.14      +4 -0      ant/src/testcases/org/apache/tools/ant/taskdefs/GetTest.java
  
  Index: GetTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/GetTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- GetTest.java	25 Feb 2005 23:07:19 -0000	1.13
  +++ GetTest.java	1 Mar 2005 23:09:58 -0000	1.14
  @@ -64,4 +64,8 @@
           executeTarget("testUseTimestamp");
       }
   
  +    public void testUseTomorrow() {
  +        executeTarget("testUseTomorrow");
  +    }
  +
   }
  
  
  
  1.6       +16 -2     ant/src/etc/testcases/taskdefs/get.xml
  
  Index: get.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/get.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- get.xml	25 Feb 2005 22:23:07 -0000	1.5
  +++ get.xml	1 Mar 2005 23:09:58 -0000	1.6
  @@ -37,11 +37,25 @@
       </fail>
     </target>
   
  -  <target name="testUseTimestamp">
  +  <target name="testUseTimestamp" depends="-90s,-timestamp" />
  +
  +  <target name="-90s">
  +    <property name="off" value="-90" />
  +    <property name="unit" value="second" />
  +  </target>
  +
  +  <target name="testUseTomorrow" depends="+1d,-timestamp" />
  +
  +  <target name="+1d">
  +    <property name="off" value="1" />
  +    <property name="unit" value="day" />
  +  </target>
  +
  +  <target name="-timestamp">
       <property name="pat" value="yyyyMMddHHmm" />
   
       <tstamp>
  -      <format property="dt" pattern="${pat}" offset="-90" unit="second" />
  +      <format property="dt" pattern="${pat}" offset="${off}" unit="${unit}" />
       </tstamp>
   
       <touch file="get.tmp" datetime="${dt}" pattern="${pat}" />
  
  
  
  1.760     +2 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.759
  retrieving revision 1.760
  diff -u -r1.759 -r1.760
  --- WHATSNEW	1 Mar 2005 22:59:44 -0000	1.759
  +++ WHATSNEW	1 Mar 2005 23:09:58 -0000	1.760
  @@ -357,6 +357,8 @@
   
   * Get with usetimestamp did not work on Java 1.2.
   
  +* Get with usetimestamp did not work when local timestamp roughly >= now.
  +
   Changes from Ant 1.6.1 to Ant 1.6.2
   ===================================
   
  
  
  

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