Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 64533 invoked from network); 30 May 2005 17:56:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 30 May 2005 17:56:38 -0000 Received: (qmail 50190 invoked by uid 500); 30 May 2005 17:56:36 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 50019 invoked by uid 500); 30 May 2005 17:56:35 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 50004 invoked by uid 500); 30 May 2005 17:56:35 -0000 Received: (qmail 49994 invoked by uid 99); 30 May 2005 17:56:35 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Mon, 30 May 2005 10:56:35 -0700 Received: (qmail 64422 invoked by uid 1632); 30 May 2005 17:56:34 -0000 Date: 30 May 2005 17:56:34 -0000 Message-ID: <20050530175634.64421.qmail@minotaur.apache.org> From: scohen@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N scohen 2005/05/30 10:56:33 Modified: src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java Log: Add logging of local vs remote timestamps in task. PR:31812 Revision Changes Path 1.79 +28 -8 ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java Index: FTP.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v retrieving revision 1.78 retrieving revision 1.79 diff -u -r1.78 -r1.79 --- FTP.java 30 May 2005 14:41:34 -0000 1.78 +++ FTP.java 30 May 2005 17:56:33 -0000 1.79 @@ -26,7 +26,9 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.text.SimpleDateFormat; import java.util.Collection; +import java.util.Date; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; @@ -1817,6 +1819,10 @@ } return null; } + + private static final SimpleDateFormat TIMESTAMP_LOGGING_SDF = + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + /** * Checks to see if the remote file is current as compared with the local * file. Returns true if the target file is up to date. @@ -1853,16 +1859,30 @@ long remoteTimestamp = files[0].getTimestamp().getTime().getTime(); long localTimestamp = localFile.lastModified(); + long adjustedRemoteTimestamp = + remoteTimestamp + this.timeDiffMillis + this.granularityMillis; + + StringBuffer msg = new StringBuffer(" [") + .append(TIMESTAMP_LOGGING_SDF.format(new Date(localTimestamp))) + .append("] local"); + log(msg.toString(), Project.MSG_VERBOSE); + + msg = new StringBuffer(" [") + .append(TIMESTAMP_LOGGING_SDF.format(new Date(adjustedRemoteTimestamp))) + .append("] remote"); + if (remoteTimestamp != adjustedRemoteTimestamp) { + msg.append(" - (raw: ") + .append(TIMESTAMP_LOGGING_SDF.format(new Date(remoteTimestamp))) + .append(")"); + } + log(msg.toString(), Project.MSG_VERBOSE); + + + if (this.action == SEND_FILES) { - return remoteTimestamp - + this.timeDiffMillis - + this.granularityMillis - >= localTimestamp; + return adjustedRemoteTimestamp >= localTimestamp; } else { - return localTimestamp - >= remoteTimestamp - + this.timeDiffMillis - + this.granularityMillis; + return localTimestamp >= adjustedRemoteTimestamp; } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org