mbenson 2005/03/01 15:15:10 Modified: src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH Get.java src/testcases/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH GetTest.java src/etc/testcases/taskdefs Tag: ANT_16_BRANCH get.xml . Tag: ANT_16_BRANCH WHATSNEW Log: Merge fix get with usetimestamp when local timestamp >= now. Revision Changes Path No revision No revision 1.38.2.6 +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.38.2.5 retrieving revision 1.38.2.6 diff -u -r1.38.2.5 -r1.38.2.6 --- Get.java 25 Feb 2005 23:15:15 -0000 1.38.2.5 +++ Get.java 1 Mar 2005 23:15:09 -0000 1.38.2.6 @@ -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() No revision No revision 1.7.2.6 +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.7.2.5 retrieving revision 1.7.2.6 diff -u -r1.7.2.5 -r1.7.2.6 --- GetTest.java 25 Feb 2005 23:15:16 -0000 1.7.2.5 +++ GetTest.java 1 Mar 2005 23:15:10 -0000 1.7.2.6 @@ -64,4 +64,8 @@ executeTarget("testUseTimestamp"); } + public void testUseTomorrow() { + executeTarget("testUseTomorrow"); + } + } No revision No revision 1.4.6.2 +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.4.6.1 retrieving revision 1.4.6.2 diff -u -r1.4.6.1 -r1.4.6.2 --- get.xml 25 Feb 2005 23:15:16 -0000 1.4.6.1 +++ get.xml 1 Mar 2005 23:15:10 -0000 1.4.6.2 @@ -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}" /> No revision No revision 1.503.2.185 +2 -0 ant/WHATSNEW Index: WHATSNEW =================================================================== RCS file: /home/cvs/ant/WHATSNEW,v retrieving revision 1.503.2.184 retrieving revision 1.503.2.185 diff -u -r1.503.2.184 -r1.503.2.185 --- WHATSNEW 25 Feb 2005 23:15:15 -0000 1.503.2.184 +++ WHATSNEW 1 Mar 2005 23:15:10 -0000 1.503.2.185 @@ -221,6 +221,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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]