ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 25770] - [PATCH] FixCRLF "preserveLastModified"
Date Fri, 23 Apr 2004 17:29:16 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=25770>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=25770

[PATCH] FixCRLF "preserveLastModified"





------- Additional Comments From jeremy@las-inc.com  2004-04-23 17:29 -------
Open mouth, insert foot... Just after clicked the "Commit" button it occurs to 
me that you really don't want to set the timestamp to 0, which is the value 
returned by File.lastModified() if anything goes wrong. So to be extra cautious 
I would recommend the following patch to my patch:
            if (destIsWrong) {
                long modified = srcFile.lastModified();
                fileUtils.rename(tmpFile, destFile);
                if (this.preserveLastModified && (modified!=0))
                    destFile.setLastModified(modified);
                tmpFile = null;
            }
Chances are that if you can't read the timestamp you can't set it either, so 
you might argue that this is overkill. But it's an easy thing to check, so we 
might as well. Perhaps it would also be a good idea to log the setting of the 
timestamp, and possibly the failure to read the timestamp?

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


Mime
View raw message