Bad old NT 4.0.
I think I asked the wrong question. After going through the other code, googling usenet, performing experiments and finally as a last resort checking the documentation, I have a suspicion I know what is going on. You are using JDK 1.1, aren't you?
Here is the important line from the touch task documentation page. I had read it before but hadn't fully registered it until now.
For JDK 1.1 only the creation of new files with a modification time of now works, all other cases will emit a warning.
What this implies (in case you had as much trouble with that line as I originally did) is that my use of the <touch> task to set the timestamps on existing files won't work for a JDK 1.1 VM. The File.setLastModified() call is @since 1.2. The fix in this case is obvious, skip all date testing if running under a JDK 1.1 VM. To be safe, depend testing should be turned off as well because, although it works now, it could fail any time in the future if the original files' dates are changed.
In trying to tickle this bug out of hiding I went back to my old Windows 98 box and found another, more subtle one. It turns out that on Windows 98, at least in my setup (JDK1.3.1_03), Java is unable to affect the timestamp on a directory. Because of this a depend test that includes a test on a directory timestamp is returning the wrong value. All other platforms I've encountered (including apparently NT, since Magesh did not encounter an error with depend testing) can change the timestamp on a directory without a problem. For now, I'll just ignore the return value from the directory in that test.
I've attached a patch for both these issues. Magesh, perhaps you could test this with your setup once you've had a chance to catch your breath after releasing Beta 2. Please don't hold Beta 2 on account of this, I don't think that anything here is that critical in my opinion.
Index: src/testcases/org/apache/tools/ant/types/selectors/DateSelectorTest.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/testcases/org/apache/tools/ant/types/selectors/Attic/DateSelectorTest.java,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 DateSelectorTest.java
--- src/testcases/org/apache/tools/ant/types/selectors/DateSelectorTest.java
31 May 2002 22:31:31 -0000 1.1.2.1
+++ src/testcases/org/apache/tools/ant/types/selectors/DateSelectorTest.java
1 Jun 2002 04:58:18 -0000
@@ -56,9 +56,9 @@
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
-import org.apache.tools.ant.util.*;
import org.apache.tools.ant.BuildFileTest;
import org.apache.tools.ant.types.Parameter;
+import org.apache.tools.ant.util.JavaEnvUtils;
import junit.framework.TestCase;
import junit.framework.AssertionFailedError;
@@ -172,6 +172,10 @@
DateSelector s;
String results;
+ if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
+ return;
+ }
+
DateSelector.TimeComparisons before = new
DateSelector.TimeComparisons();
before.setValue("before");
@@ -209,7 +213,7 @@
s.setWhen(before);
results = selectionString(s);
assertEquals("TFTFFFFFFFFT", results);
-/*
+
s = (DateSelector)getInstance();
s.setDatetime("11/21/2001 4:55 AM");
java.util.Date d = new java.util.Date("11/21/2001 4:55 AM");
@@ -236,7 +240,7 @@
s.setGranularity(15000);
results = selectionString(s);
assertEquals("TTFFTFFFTTTT", results);
-*/
+
s = (DateSelector)getInstance();
s.setDatetime("11/21/2001 4:56 AM");
s.setWhen(after);
Index:
src/testcases/org/apache/tools/ant/types/selectors/DependSelectorTest.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/testcases/org/apache/tools/ant/types/selectors/Attic/DependSelectorTest.java,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 DependSelectorTest.java
--- src/testcases/org/apache/tools/ant/types/selectors/DependSelectorTest.java
31 May 2002 22:31:31 -0000 1.1.2.1
+++ src/testcases/org/apache/tools/ant/types/selectors/DependSelectorTest.java
1 Jun 2002 04:58:18 -0000
@@ -56,12 +56,12 @@
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
-import org.apache.tools.ant.util.*;
import org.apache.tools.ant.BuildFileTest;
import org.apache.tools.ant.types.Mapper;
import org.apache.tools.ant.util.FileNameMapper;
import org.apache.tools.ant.util.IdentityMapper;
import org.apache.tools.ant.util.GlobPatternMapper;
+import org.apache.tools.ant.util.JavaEnvUtils;
import junit.framework.TestCase;
import junit.framework.AssertionFailedError;
@@ -119,6 +119,11 @@
DependSelector s;
String results;
Mapper m;
+
+ if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
+ return;
+ }
+
Mapper.MapperType identity = new Mapper.MapperType();
identity.setValue("identity");
Mapper.MapperType glob = new Mapper.MapperType();
@@ -147,7 +152,7 @@
m.setType(merge);
m.setTo("asf-logo.gif.gz");
results = selectionString(s);
- assertEquals("TFFFFTTTFFFF", results);
+ assertEquals("TFFFFTTTFFF", results.substring(0,11));
s = (DependSelector)getInstance();
s.setTargetdir(basedirname);
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
