brett 2004/07/01 07:03:00
Modified: src/java/org/apache/maven/util Tag: MAVEN-1_0-BRANCH
HttpUtils.java
xdocs Tag: MAVEN-1_0-BRANCH changes.xml
Log:
PR: MAVEN-1188
double check modification time to avoid race condition when server time is behond
local time
Revision Changes Path
No revision
No revision
1.28.4.12 +10 -3 maven/src/java/org/apache/maven/util/HttpUtils.java
Index: HttpUtils.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/util/HttpUtils.java,v
retrieving revision 1.28.4.11
retrieving revision 1.28.4.12
diff -u -r1.28.4.11 -r1.28.4.12
--- HttpUtils.java 1 Jul 2004 12:55:46 -0000 1.28.4.11
+++ HttpUtils.java 1 Jul 2004 14:03:00 -0000 1.28.4.12
@@ -415,7 +415,7 @@
if ( connection.getLastModified() <= timestamp &&
connection.getLastModified() != 0 )
{
- if (!silent) LOG.debug("Not modified");
+ LOG.debug("Not modified");
return;
}
@@ -475,7 +475,7 @@
boolean use = statusCode < 300;
if (statusCode == HttpURLConnection.HTTP_NOT_MODIFIED) {
- if (!silent) LOG.debug("Not modified");
+ LOG.debug("Not modified");
}
else if (statusCode >= 300 && statusCode < 400) {
Header header = get.getResponseHeader("Location");
@@ -518,7 +518,14 @@
LOG.debug("last-modified = " + header.getValue() + " (" +
remoteTimestamp + ")");
}
else {
- if (!silent) LOG.warn("warning: last-modified not specified");
+ LOG.warn("warning: last-modified not specified");
+ }
+ if ( remoteTimestamp <= timestamp && remoteTimestamp != 0 )
+ {
+ LOG.debug("Not modified - local file is newer");
+ // TODO: httpclient doesn't seem to think it is valid to close
the stream before its done like this. Why?
+ // use = false;
+ return null;
}
}
process( use, is, destinationFile, projected, timestamp,
remoteTimestamp, silent );
No revision
No revision
1.14.4.28 +1 -0 maven/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/maven/xdocs/changes.xml,v
retrieving revision 1.14.4.27
retrieving revision 1.14.4.28
diff -u -r1.14.4.27 -r1.14.4.28
--- changes.xml 1 Jul 2004 12:55:49 -0000 1.14.4.27
+++ changes.xml 1 Jul 2004 14:03:00 -0000 1.14.4.28
@@ -25,6 +25,7 @@
</properties>
<body>
<release version="1.0-final-SNAPSHOT" date="in CVS">
+ <action dev="brett" type="fix" issue="MAVEN-1188">Check last modified
timestamp as well as conditional GET in case the server time is behind the local
time</action>
<action dev="brett" type="fix" issue="MAVEN-1343">Bugfixes for new httpclient
based downloading (incorrect timestamps)</action>
<action dev="brett" type="fix" issue="MAVEN-1353">Handle cross site
redirects</action>
<action dev="brett" type="fix" issue="MAVEN-1290">Correct absolute paths with
no drive designator on windows</action>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]