cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2005-03-01 Thread mbenson
mbenson 2005/03/01 14:59:44

  Modified:.WHATSNEW
   src/main/org/apache/tools/ant/util FileUtils.java
   src/testcases/org/apache/tools/ant ProjectTest.java
   src/testcases/org/apache/tools/ant/taskdefs DirnameTest.java
   src/testcases/org/apache/tools/ant/types PathTest.java
   src/testcases/org/apache/tools/ant/util FileUtilsTest.java
  Log:
  On DOS and Netware, filenames beginning with a drive letter
  and followed by a colon but with no directory separator following
  the colon are no longer (incorrectly) accepted as absolute pathnames
  by FileUtils.normalize() and FileUtils.isAbsolutePath().  Netware
  volumes can still be specified without an intervening separator.
  UNC pathnames on Windows must include a server and share name, i.e.
  \\a\b to be considered valid absolute paths.
  FileUtils.resolveFile() promised to return absolute files but
  did not always do so.
  
  Revision  ChangesPath
  1.759 +12 -2 ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.758
  retrieving revision 1.759
  diff -u -r1.758 -r1.759
  --- WHATSNEW  25 Feb 2005 22:23:06 -  1.758
  +++ WHATSNEW  1 Mar 2005 22:59:44 -   1.759
  @@ -18,8 +18,15 @@
   
   * The Reference class now has a project field that will get
 used (if set) in preference to the passed in project, when
  -  dereferencing the reference.
  -  Bugzilla Report 25777.
  +  dereferencing the reference. Bugzilla Report 25777.
  +
  +* On DOS and Netware, filenames beginning with a drive letter
  +  and followed by a colon but with no directory separator following
  +  the colon are no longer (incorrectly) accepted as absolute pathnames
  +  by FileUtils.normalize() and FileUtils.isAbsolutePath().  Netware
  +  volumes can still be specified without an intervening separator.
  +  UNC pathnames on Windows must include a server and share name, i.e.
  +  \\a\b to be considered valid absolute paths.
   
   Fixed bugs:
   ---
  @@ -47,6 +54,9 @@
   * Create signjar's helper ExecTask instance directly rather than by
 typedef discovery mechanisms. Bugzilla report 33433.
   
  +* FileUtils.resolveFile() promised to return absolute files but
  +  did not always do so.
  +
   Other changes:
   --
   
  
  
  
  1.89  +131 -122  ant/src/main/org/apache/tools/ant/util/FileUtils.java
  
  Index: FileUtils.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/FileUtils.java,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- FileUtils.java4 Feb 2005 16:18:10 -   1.88
  +++ FileUtils.java1 Mar 2005 22:59:44 -   1.89
  @@ -664,71 +664,99 @@
   /**
* Interpret the filename as a file relative to the given file
* unless the filename already represents an absolute filename.
  + * Differs from codenew File(file, filename)/code in that
  + * the resulting File's path will always be a normalized,
  + * absolute pathname.  Also, if it is determined that
  + * codefilename/code is context-relative, codefile/code
  + * will be discarded and the reference will be resolved using
  + * available context/state information about the filesystem.
*
* @param file the reference file for relative paths. This
* instance must be an absolute file and must not contain
* quot;./quot; or quot;../quot; sequences (same for \ instead
* of /).  If it is null, this call is equivalent to
  - * codenew java.io.File(filename)/code.
  + * codenew java.io.File(filename).getAbsoluteFile()/code.
*
* @param filename a file name.
*
  - * @return an absolute file that doesn't contain quot;./quot; or
  - * quot;../quot; sequences and uses the correct separator for
  - * the current platform.
  + * @return an absolute file.
  + * @throws java.lang.NullPointerException if filename is null.
*/
   public File resolveFile(File file, String filename) {
  -filename = filename.replace('/', File.separatorChar)
  -.replace('\\', File.separatorChar);
  -
  -// deal with absolute files
  -if (isAbsolutePath(filename)) {
  -return normalize(filename);
  -}
  -if (file == null) {
  -return new File(filename);
  -}
  -File helpFile = new File(file.getAbsolutePath());
  -StringTokenizer tok = new StringTokenizer(filename, File.separator);
  -while (tok.hasMoreTokens()) {
  -String part = tok.nextToken();
  -if (part.equals(..)) {
  -helpFile = helpFile.getParentFile();
  -if (helpFile == null) {
  -String msg = The file 

cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2005-02-04 Thread bodewig
bodewig 2005/02/03 23:57:00

  Modified:src/testcases/org/apache/tools/ant Tag: ANT_16_BRANCH
ProjectTest.java
   src/testcases/org/apache/tools/ant/types Tag: ANT_16_BRANCH
CommandlineJavaTest.java
   src/testcases/org/apache/tools/ant/util Tag: ANT_16_BRANCH
FileUtilsTest.java
  Log:
  Tests didn't pass on Unix
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.18.2.5  +4 -1  ant/src/testcases/org/apache/tools/ant/ProjectTest.java
  
  Index: ProjectTest.java
  ===
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/ProjectTest.java,v
  retrieving revision 1.18.2.4
  retrieving revision 1.18.2.5
  diff -u -r1.18.2.4 -r1.18.2.5
  --- ProjectTest.java  9 Mar 2004 17:02:00 -   1.18.2.4
  +++ ProjectTest.java  4 Feb 2005 07:57:00 -   1.18.2.5
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2000-2004 The Apache Software Foundation
  + * Copyright  2000-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the License);
*  you may not use this file except in compliance with the License.
  @@ -20,6 +20,7 @@
   import org.apache.tools.ant.input.DefaultInputHandler;
   import org.apache.tools.ant.input.InputHandler;
   import org.apache.tools.ant.input.PropertyFileInputHandler;
  +import org.apache.tools.ant.taskdefs.condition.Os;
   import org.apache.tools.ant.types.*;
   import org.apache.tools.ant.util.JavaEnvUtils;
   
  @@ -74,6 +75,7 @@
   assertEquals(File.separator,
p.resolveFile(\\, null).getPath());
   
  +if (!Os.isFamily(unix)) {
   /*
* throw in drive letters
*/
  @@ -94,6 +96,7 @@
p.resolveFile(driveSpec + /, null).getPath());
   assertEquals(driveSpec + \\,
p.resolveFile(driveSpec + , 
null).getPath());
  +}
   
   /*
* Now test some relative file name magic.
  
  
  
  No   revision
  No   revision
  1.17.2.7  +3 -3  
ant/src/testcases/org/apache/tools/ant/types/CommandlineJavaTest.java
  
  Index: CommandlineJavaTest.java
  ===
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/types/CommandlineJavaTest.java,v
  retrieving revision 1.17.2.6
  retrieving revision 1.17.2.7
  diff -u -r1.17.2.6 -r1.17.2.7
  --- CommandlineJavaTest.java  20 Apr 2004 06:53:30 -  1.17.2.6
  +++ CommandlineJavaTest.java  4 Feb 2005 07:57:00 -   1.17.2.7
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2000-2004 The Apache Software Foundation
  + * Copyright  2000-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the License);
*  you may not use this file except in compliance with the License.
  @@ -43,7 +43,7 @@
   project.setProperty(build.sysclasspath, ignore);
   }
   
  -public void testGetCommandline() {
  +public void testGetCommandline() throws CloneNotSupportedException {
   CommandlineJava c = new CommandlineJava();
   
c.createArgument().setValue(org.apache.tools.ant.CommandlineJavaTest);
   c.setClassname(junit.textui.TestRunner);
  @@ -131,7 +131,7 @@
   assertNull(System.getProperty(key2));
   }
   
  -public void testAssertions() {
  +public void testAssertions() throws CloneNotSupportedException {
   if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)
   || JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) {
   return;
  
  
  
  No   revision
  No   revision
  1.22.2.5  +21 -29
ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
  
  Index: FileUtilsTest.java
  ===
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
  retrieving revision 1.22.2.4
  retrieving revision 1.22.2.5
  diff -u -r1.22.2.4 -r1.22.2.5
  --- FileUtilsTest.java9 Mar 2004 17:02:09 -   1.22.2.4
  +++ FileUtilsTest.java4 Feb 2005 07:57:00 -   1.22.2.5
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2004 The Apache Software Foundation
  + * Copyright  2001-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the License);
*  you may not use this file except in compliance with the License.
  @@ -17,7 +17,9 @@
   
   package org.apache.tools.ant.util;
   
  -import java.io.*;
  +import java.io.File;
  +import java.io.FileOutputStream;
  +import java.io.IOException;
   
   import junit.framework.TestCase;
   
  @@ -64,21 +66,14 @@
* granularity (should be  2s to account for Windows FAT).
   

cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2004-08-08 Thread stevel
stevel  2004/08/08 14:03:21

  Modified:src/testcases/org/apache/tools/ant/util FileUtilsTest.java
  Log:
  fixed the test failure, added a proper self contained test.
  
  I have commented out the test that asserts that sourceTime==destTime implies 
up-to-dateness. This is an interesting problem. Filesys granularity gets in the 
way.
  
  Revision  ChangesPath
  1.29  +22 -3 
ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
  
  Index: FileUtilsTest.java
  ===
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- FileUtilsTest.java4 Aug 2004 19:54:20 -   1.28
  +++ FileUtilsTest.java8 Aug 2004 21:03:21 -   1.29
  @@ -83,9 +83,6 @@
   long secondModTime = removeThis.lastModified();
   assertTrue(secondModTime  modTime);
   
  -//check that the isUpToDate logic works
  -assertFalse(fu.isUpToDate(modTime,secondModTime));
  -
   // number of milliseconds in a day
   final int millisperday=24 * 3600 * 1000;
   // in a previous version, the date of the file was set to 123456
  @@ -436,6 +433,28 @@
fu.fromURI(file:./foo));
   assertEqualsIgnoreDriveCase(localize(/foo bar), 
fu.fromURI(file:///foo%20bar));
   assertEqualsIgnoreDriveCase(localize(/foo#bar), 
fu.fromURI(file:///foo%23bar));
  +}
  +
  +public void testModificationTests() {
  +
  +//get a time
  +long firstTime=System.currentTimeMillis();
  +//add some time. We assume no OS has a granularity this bad
  +long secondTime=firstTime+6;
  +/*
  +assertTrue(same timestamp is up to date,
  +fu.isUpToDate(firstTime, firstTime));
  +*/
  +
  +//check that older is up to date with a newer dest
  +assertTrue(older source files are up to date,
  +fu.isUpToDate(firstTime,secondTime));
  +//check that older is up to date with a newer dest
  +assertFalse(newer source files are no up to date,
  +fu.isUpToDate(secondTime, firstTime));
  +
  +assertTrue(-1 dest timestamp implies nonexistence,
  +!fu.isUpToDate(firstTime,-1L));
   }
   
   /**
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2004-08-04 Thread stevel
stevel  2004/08/04 12:54:21

  Modified:src/testcases/org/apache/tools/ant/util FileUtilsTest.java
  Log:
  sneak in an explicit test of the new file utils timestamp comparison stuff
  
  Revision  ChangesPath
  1.28  +2 -0  
ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
  
  Index: FileUtilsTest.java
  ===
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- FileUtilsTest.java22 Apr 2004 14:03:46 -  1.27
  +++ FileUtilsTest.java4 Aug 2004 19:54:20 -   1.28
  @@ -83,6 +83,8 @@
   long secondModTime = removeThis.lastModified();
   assertTrue(secondModTime  modTime);
   
  +//check that the isUpToDate logic works
  +assertFalse(fu.isUpToDate(modTime,secondModTime));
   
   // number of milliseconds in a day
   final int millisperday=24 * 3600 * 1000;
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-07-22 Thread bodewig
bodewig 2003/07/22 07:52:45

  Modified:src/testcases/org/apache/tools/ant/util FileUtilsTest.java
  Log:
  removeLeadingPath doesn't work if leading is a filesystem root - found by 
Antoine
  
  Revision  ChangesPath
  1.22  +9 -0  
ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
  
  Index: FileUtilsTest.java
  ===
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- FileUtilsTest.java16 Jul 2003 10:43:15 -  1.21
  +++ FileUtilsTest.java22 Jul 2003 14:52:45 -  1.22
  @@ -421,6 +421,15 @@
 new File(/foo/bar/)));
   assertEquals(, fu.removeLeadingPath(new File(/foo/bar/),
 new File(/foo/bar)));
  +
  +String expected = foo/bar.replace('\\', File.separatorChar)
  +.replace('/', File.separatorChar);
  +assertEquals(expected, fu.removeLeadingPath(new File(/),
  +new File(/foo/bar)));
  +assertEquals(expected, fu.removeLeadingPath(new File(c:/),
  +new File(c:/foo/bar)));
  +assertEquals(expected, fu.removeLeadingPath(new File(c:\\),
  +new 
File(c:\\foo\\bar)));
   }
   
   /**
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-07-22 Thread Stefan Bodewig
it would be nice if anybody could run this test on Windows with the
patched version.

Thanks

Stefan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-07-16 Thread bodewig
bodewig 2003/07/16 03:43:15

  Modified:src/main/org/apache/tools/ant/launch Locator.java
   src/main/org/apache/tools/ant/util FileUtils.java
   src/testcases/org/apache/tools/ant/util FileUtilsTest.java
  Log:
  Make toURI and fromURI work correctly on Netware.
  
  Submitted by: Jeff Tulley JTULLEY at novell dot com
  
  Revision  ChangesPath
  1.4   +1 -1  ant/src/main/org/apache/tools/ant/launch/Locator.java
  
  Index: Locator.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/launch/Locator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Locator.java  9 Jul 2003 13:11:15 -   1.3
  +++ Locator.java  16 Jul 2003 10:43:11 -  1.4
  @@ -134,7 +134,7 @@
   
   uri = uri.replace('/', File.separatorChar);
   if (File.pathSeparatorChar == ';'  uri.startsWith(\\)  
uri.length()  2
  - Character.isLetter(uri.charAt(1))  uri.charAt(2) == ':') {
  + Character.isLetter(uri.charAt(1))  uri.lastIndexOf(':')  
-1) {
   uri = uri.substring(1);
   }
   
  
  
  
  1.49  +2 -2  ant/src/main/org/apache/tools/ant/util/FileUtils.java
  
  Index: FileUtils.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/FileUtils.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- FileUtils.java9 Jul 2003 13:11:16 -   1.48
  +++ FileUtils.java16 Jul 2003 10:43:15 -  1.49
  @@ -1219,7 +1219,7 @@
   path = normalize(path).getAbsolutePath();
   sb.append(//);
   // add an extra slash for filesystems with drive-specifiers
  -if (!path.startsWith(/)) {
  +if (!path.startsWith(File.separator)) {
   sb.append(/);
   }
   
  
  
  
  1.21  +6 -0  
ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
  
  Index: FileUtilsTest.java
  ===
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- FileUtilsTest.java11 Jul 2003 14:53:05 -  1.20
  +++ FileUtilsTest.java16 Jul 2003 10:43:15 -  1.21
  @@ -438,6 +438,9 @@
   if (Os.isFamily(dos)) {
   assertEquals(file:///C:/foo, fu.toURI(c:\\foo));
   }
  +if (Os.isFamily(netware)) {
  +assertEquals(file:///SYS:/foo, fu.toURI(sys:\\foo));
  +}
   assertEquals(file:/// + dosRoot + foo, fu.toURI(/foo));
   assertEquals(file:./foo,  fu.toURI(./foo));
   assertEquals(file:/// + dosRoot + foo, fu.toURI(\\foo));
  @@ -452,6 +455,9 @@
* test fromUri
*/
   public void testFromURI() {
  +if (Os.isFamily(netware)) {
  +assertEqualsIgnoreDriveCase(SYS:\\foo, 
fu.fromURI(file:///sys:/foo));
  +}
   if (Os.isFamily(dos)) {
   assertEqualsIgnoreDriveCase(C:\\foo, 
fu.fromURI(file:///c:/foo));
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-07-12 Thread Steve Loughran
Antoine Levy-Lambert wrote:
- Original Message -
From: Stefan Bodewig [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, July 11, 2003 4:59 PM
Subject: Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util
FileUtilsTest.java

is user.dir guaranteed to contain the drive letter on Windows?  I
guess it's not guaranteed to do but always does.
On Windows AFAIK a path always begins with a drive letter. Let me know if
Microsoft makes a revolution.
actually some versions of windows used to let you CD to a net drive
cd \\zermatt\c$
and this would cause no end of confusion from then on. NT tells you to 
stop it.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-07-12 Thread Antoine Levy-Lambert
Steve Loughran says on NT you cannot change directory to \\MachineName
On Windows 2000 it is not possible either.
Here an example (in German for those who understand)
C:\cd \\DJ0X820J\Programme
\\DJ0X820J\Programme ist ein ungültiger aktueller Verzeichnispfad.
UNC-Pfade werden nicht
unterstützt.

translation:
\\DJ0X820J\Programme is an invalid current directory. UNC paths are not
supported.

Antoine
- Original Message -
From: Magesh Umasankar [EMAIL PROTECTED]
To: Ant Developers List [EMAIL PROTECTED]
Sent: Saturday, July 12, 2003 12:33 AM
Subject: Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util
FileUtilsTest.java


 What about network shares that are not mapped to a
 drive letter?  Don't they begin with \\MachineName ?

 Cheers,
 Magesh

 - Original Message -
 From: Antoine Levy-Lambert [EMAIL PROTECTED]


  - Original Message -
  From: Stefan Bodewig [EMAIL PROTECTED]
 
 
   is user.dir guaranteed to contain the drive letter on Windows?  I
   guess it's not guaranteed to do but always does.
  
  On Windows AFAIK a path always begins with a drive letter. Let me know
if
  Microsoft makes a revolution.
 
  Antoine



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-07-11 Thread antoine
antoine 2003/07/11 07:53:05

  Modified:src/testcases/org/apache/tools/ant/util FileUtilsTest.java
  Log:
  Allow FileUtilsTest to run on DOS/Windows when current drive letter is not C:
  PR: 21383
  Submitted by: Brad Clarke ( bclarke at booksys dot com)
  
  Revision  ChangesPath
  1.20  +2 -8  
ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
  
  Index: FileUtilsTest.java
  ===
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- FileUtilsTest.java28 Jun 2003 14:18:40 -  1.19
  +++ FileUtilsTest.java11 Jul 2003 14:53:05 -  1.20
  @@ -429,20 +429,14 @@
   public void testToURI() {
   String dosRoot = null;
   if (Os.isFamily(dos)) {
  -dosRoot = C:/;
  +dosRoot = System.getProperty(user.dir).charAt(0) + :/;
   }
   else
   {
   dosRoot = ;
   }
   if (Os.isFamily(dos)) {
  -assertEquals(file:///+ dosRoot + foo, fu.toURI(c:\\foo));
  -}
  -if (Os.isFamily(dos)) {
  -// this amounts to : are we under cygwin ?
  -if 
(Character.isLowerCase(System.getProperty(user.dir).charAt(0))) {
  -dosRoot = c:/;
  -}
  +assertEquals(file:///C:/foo, fu.toURI(c:\\foo));
   }
   assertEquals(file:/// + dosRoot + foo, fu.toURI(/foo));
   assertEquals(file:./foo,  fu.toURI(./foo));
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-07-11 Thread Antoine Levy-Lambert
- Original Message -
From: Stefan Bodewig [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, July 11, 2003 4:59 PM
Subject: Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util
FileUtilsTest.java


 is user.dir guaranteed to contain the drive letter on Windows?  I
 guess it's not guaranteed to do but always does.

On Windows AFAIK a path always begins with a drive letter. Let me know if
Microsoft makes a revolution.

Antoine



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-07-11 Thread J.Pietschmann
Antoine Levy-Lambert wrote:
On Windows AFAIK a path always begins with a drive letter. Let me know if
Microsoft makes a revolution.
Users can manually edit most stuff, for example they can set
%systemdrive% to , or start java with -Duser.home=foo, or do
similar unpleasant stuff which will not necessarily result in
an immediate system crash.
J.Pietschmann
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-07-11 Thread Magesh Umasankar
What about network shares that are not mapped to a
drive letter?  Don't they begin with \\MachineName ?

Cheers,
Magesh

- Original Message - 
From: Antoine Levy-Lambert [EMAIL PROTECTED]


 - Original Message -
 From: Stefan Bodewig [EMAIL PROTECTED]
 
 
  is user.dir guaranteed to contain the drive letter on Windows?  I
  guess it's not guaranteed to do but always does.
 
 On Windows AFAIK a path always begins with a drive letter. Let me know if
 Microsoft makes a revolution.
 
 Antoine



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-06-28 Thread antoine
antoine 2003/06/28 07:18:40

  Modified:src/testcases/org/apache/tools/ant/util FileUtilsTest.java
  Log:
  Make FileUtilsTest pass under cygwin
  I found doing this how to tell whether one is running under cygwin
  if the first letter (drive letter) of System.getProperty(user.dir)
  is lower case then one is under cygwin
  
  Revision  ChangesPath
  1.19  +31 -8 
ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
  
  Index: FileUtilsTest.java
  ===
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- FileUtilsTest.java24 Jun 2003 16:07:26 -  1.18
  +++ FileUtilsTest.java28 Jun 2003 14:18:40 -  1.19
  @@ -79,7 +79,7 @@
   
   public void setUp() {
   fu = FileUtils.newFileUtils();
  -// Windows adds the drive letter in uppercase, unless you run Cygnus
  +// Windows adds the drive letter in uppercase, unless you run Cygwin
   root = new File(File.separator).getAbsolutePath().toUpperCase();
   }
   
  @@ -408,9 +408,9 @@
new File(c:\\foo\\bar)));
   assertEquals(bar, fu.removeLeadingPath(new File(c:\\foo\\),
new File(c:\\foo\\bar)));
  -assertEquals(fu.normalize(/bar).getAbsolutePath(),
  +assertEqualsIgnoreDriveCase(fu.normalize(/bar).getAbsolutePath(),
fu.removeLeadingPath(new File(/foo), new 
File(/bar)));
  -assertEquals(fu.normalize(/foobar).getAbsolutePath(),
  +
assertEqualsIgnoreDriveCase(fu.normalize(/foobar).getAbsolutePath(),
fu.removeLeadingPath(new File(/foo), new 
File(/foobar)));
   // bugzilla report 19979
   assertEquals(, fu.removeLeadingPath(new File(/foo/bar),
  @@ -436,7 +436,13 @@
   dosRoot = ;
   }
   if (Os.isFamily(dos)) {
  -assertEquals(file:///C:/foo, fu.toURI(c:\\foo));
  +assertEquals(file:///+ dosRoot + foo, fu.toURI(c:\\foo));
  +}
  +if (Os.isFamily(dos)) {
  +// this amounts to : are we under cygwin ?
  +if 
(Character.isLowerCase(System.getProperty(user.dir).charAt(0))) {
  +dosRoot = c:/;
  +}
   }
   assertEquals(file:/// + dosRoot + foo, fu.toURI(/foo));
   assertEquals(file:./foo,  fu.toURI(./foo));
  @@ -453,13 +459,13 @@
*/
   public void testFromURI() {
   if (Os.isFamily(dos)) {
  -assertEquals(C:\\foo, fu.fromURI(file:///c:/foo));
  +assertEqualsIgnoreDriveCase(C:\\foo, 
fu.fromURI(file:///c:/foo));
   }
  -assertEquals(localize(/foo), fu.fromURI(file:///foo));
  +assertEqualsIgnoreDriveCase(localize(/foo), 
fu.fromURI(file:///foo));
   assertEquals(. + File.separator + foo,
fu.fromURI(file:./foo));
  -assertEquals(localize(/foo bar), fu.fromURI(file:///foo%20bar));
  -assertEquals(localize(/foo#bar), fu.fromURI(file:///foo%23bar));
  +assertEqualsIgnoreDriveCase(localize(/foo bar), 
fu.fromURI(file:///foo%20bar));
  +assertEqualsIgnoreDriveCase(localize(/foo#bar), 
fu.fromURI(file:///foo%23bar));
   }
   
   /**
  @@ -468,5 +474,22 @@
   private String localize(String path) {
   path = root + path.substring(1);
   return path.replace('\\', File.separatorChar).replace('/', 
File.separatorChar);
  +}
  +/**
  + * convenience method
  + * normalize brings the drive in uppercase
  + * the drive letter is in lower case under cygwin
  + * calling this method allows tests where normalize is called to pass 
under cygwin
  + */
  +private void assertEqualsIgnoreDriveCase(String s1, String s2) {
  +if (Os.isFamily(dos)  s1.length()=1  s2.length()=1) {
  +StringBuffer sb1= new StringBuffer(s1);
  +StringBuffer sb2= new StringBuffer(s2);
  +sb1.setCharAt(0,Character.toUpperCase(s1.charAt(0)));
  +sb2.setCharAt(0,Character.toUpperCase(s2.charAt(0)));
  +assertEquals(sb1.toString(),sb2.toString());
  +}   else {
  +assertEquals(s1,s2);
  +}
   }
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-06-24 Thread Steve Loughran
Antoine Levy-Lambert wrote:
Hi Steve,
I am in the CET (Central European) Timezone. It has a difference of 1 hour
with GMT AFAIK. I have taken this hour of difference already into account.
Anyway the point is : trying to set the last modified time of a file to
123456 millis after the epoch does not work on my computer.
The Microsoft SDK information says that Windows files have a date/time of
last modification calculated since January 1st, 1601. So it must be some JDK
implementation problem. Not very interesting anyway.
Antoine
oh, I always find implementation differences fascinating, especially 
before they reach the stage of 'support call'.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-06-24 Thread Martin Gainty
Alright I'll ask the dumb question
What happened on Jan 1 1601???
-Martin
- Original Message -
From: Steve Loughran [EMAIL PROTECTED]
To: Ant Developers List [EMAIL PROTECTED]
Sent: Monday, June 23, 2003 9:15 PM
Subject: Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util
FileUtilsTest.java


 Antoine Levy-Lambert wrote:
  Hi Steve,
  I am in the CET (Central European) Timezone. It has a difference of 1
hour
  with GMT AFAIK. I have taken this hour of difference already into
account.
  Anyway the point is : trying to set the last modified time of a file to
  123456 millis after the epoch does not work on my computer.
  The Microsoft SDK information says that Windows files have a date/time
of
  last modification calculated since January 1st, 1601. So it must be some
JDK
  implementation problem. Not very interesting anyway.
  Antoine

 oh, I always find implementation differences fascinating, especially
 before they reach the stage of 'support call'.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-06-24 Thread Stefan Bodewig
On Mon, 23 Jun 2003, Antoine Levy-Lambert [EMAIL PROTECTED]
wrote:

 I am in the CET (Central European) Timezone. It has a difference of
 1 hour with GMT AFAIK.

Remember Daylight Saving that's currently in effect, which means GMT+2
right now.

Stefan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-06-24 Thread Steve Loughran
Martin Gainty wrote:
Alright I'll ask the dumb question
What happened on Jan 1 1601???
-Martin

probably lots of things relevant to the people at the time.
Of most interest to clocks is that by that day, the start of the 
seventeenth century, most of the western world had updated their 
calendars to adopt the no-leap-centuries-except-on-millennium rule that 
kept the wall time more in sync with astronomicial time. So if you 
ignore dates before 1601 you dont have to worry so much about when 
different countries skipped a fair few days to catch up.

Russia didnt adopt the (gregorian, right?) calendar till after the 
October Revolution, a revolution which took place in November as far as 
the rest of the world is concerned.

MS have a track record of doing odd things with date and time. Excel 
time fields used to begin at 00:00 on 1-jan-1900, but because the 
developers got the leap century rule wrong, its epoch was redeclared to 
be 00:00 on 31-dec-1899. For all dates after 1-feb-1900 these values are 
the same. Excel time fields survive as OLETIME, one of the COM datatypes 
you may still encounter.

We are nominally fortunate that they dropped OLETIME in the SOAP era, 
replacing it with xsd:dateTime. That format requires you to specify the 
timezone, yet because the .NET Date structure is like java.util.Date, a 
time_t with no timezone, they get it wrong and always assume local tz. 
so you cannot reliably send date  time across the wire using the SOAP 
datatypes, not between Java (whose Calendar class is TZ aware) and .NET.

-Steve
(trivia related to WGS-84 'gps time' and current UTC omitted)
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-06-24 Thread antoine
antoine 2003/06/24 09:07:27

  Modified:.WHATSNEW
   src/main/org/apache/tools/ant/util FileUtils.java
   src/testcases/org/apache/tools/ant/util FileUtilsTest.java
  Log:
  Use java.io.tmpdir as location for temporary files
  in FileUtils#createTempFile (when the directory parameter is null)
  
  Revision  ChangesPath
  1.447 +3 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.446
  retrieving revision 1.447
  diff -u -r1.446 -r1.447
  --- WHATSNEW  24 Jun 2003 15:08:53 -  1.446
  +++ WHATSNEW  24 Jun 2003 16:07:24 -  1.447
  @@ -445,6 +445,9 @@
   
   * checksum has two new properties: totalproperty and todir.
   
  +* FileUtils#createTempFile will now create temporary files in the 
  +  directory pointed to by the property java.io.tmpdir
  +
   Changes from Ant 1.5.2 to Ant 1.5.3
   ===
   
  
  
  
  1.43  +6 -5  ant/src/main/org/apache/tools/ant/util/FileUtils.java
  
  Index: FileUtils.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/FileUtils.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- FileUtils.java19 May 2003 15:55:22 -  1.42
  +++ FileUtils.java24 Jun 2003 16:07:24 -  1.43
  @@ -783,20 +783,21 @@
* of this method will yield a different file name./p
*
* pThis method is different to File.createTempFile of JDK 1.2
  - * as it doesn't create the file itself and doesn't use platform
  - * specific temporary directory when the parentDir attribute is
  + * as it doesn't create the file itself.
  + * It uses the location pointed to by java.io.tmpdir
  + * when the parentDir attribute is
* null./p
*
* @param parentDir Directory to create the temporary file in -
* current working directory will be assumed if this parameter is
* null.
*
  - * @since 1.8
  + * @since ant 1.5
*/
   public File createTempFile(String prefix, String suffix, File parentDir) 
{
   
   File result = null;
  -String parent = null;
  +String parent = System.getProperty(java.io.tmpdir);
   if (parentDir != null) {
   parent = parentDir.getPath();
   }
  
  
  
  1.18  +61 -60
ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
  
  Index: FileUtilsTest.java
  ===
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- FileUtilsTest.java23 Jun 2003 16:18:00 -  1.17
  +++ FileUtilsTest.java24 Jun 2003 16:07:26 -  1.18
  @@ -64,8 +64,8 @@
   /**
* Tests for org.apache.tools.ant.util.FileUtils.
*
  - * @author Stefan Bodewig 
  - * @author a href=mailto:[EMAIL PROTECTED]Jeff Tulley/a 
  + * @author Stefan Bodewig
  + * @author a href=mailto:[EMAIL PROTECTED]Jeff Tulley/a
*/
   public class FileUtilsTest extends TestCase {
   
  @@ -117,7 +117,7 @@
   // JDK 1.1
   assertEquals(modTime, secondModTime);
   }
  -
  +
   
   // number of milliseconds in a day
   final int millisperday=24 * 3600 * 1000;
  @@ -145,30 +145,30 @@
   /*
* Start with simple absolute file names.
*/
  -assertEquals(File.separator, 
  +assertEquals(File.separator,
fu.resolveFile(null, /).getPath());
  -assertEquals(File.separator, 
  +assertEquals(File.separator,
fu.resolveFile(null, \\).getPath());
   
   /*
* throw in drive letters
*/
   String driveSpec = C:;
  -assertEquals(driveSpec + \\, 
  +assertEquals(driveSpec + \\,
fu.resolveFile(null, driveSpec + /).getPath());
  -assertEquals(driveSpec + \\, 
  +assertEquals(driveSpec + \\,
fu.resolveFile(null, driveSpec + \\).getPath());
   String driveSpecLower = c:;
  -assertEquals(driveSpec + \\, 
  +assertEquals(driveSpec + \\,
fu.resolveFile(null, driveSpecLower + /).getPath());
  -assertEquals(driveSpec + \\, 
  +assertEquals(driveSpec + \\,
fu.resolveFile(null, driveSpecLower + \\).getPath());
   /*
* promised to eliminate consecutive slashes after drive letter.
*/
  -assertEquals(driveSpec + \\, 
  +assertEquals(driveSpec + \\,
fu.resolveFile(null, driveSpec + /).getPath());
  -

cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-06-23 Thread antoine
antoine 2003/06/23 09:18:00

  Modified:src/testcases/org/apache/tools/ant/util FileUtilsTest.java
  Log:
  Make FileUtilsTest pass on my machine (Windows 2000, JDK 1.4.1_02)
  2 changes :
  - there was no luck with setting the date/time of a file to 123456
  milliseconds since the epoch
  Instead, I set the date time of the file to current time + one day
  this works.
  - I changed the test toURI, specs beginning with / or \\ turn URIs
  beginning with file:///C:/
  
  Note :
  I observed an error in the date/time returned by java and what I would
  expect theoretically under Win 2000 and JDK 1.4.1_02
  of 16,344,000 (16 millions of milliseconds), slightly
  more than 4 and a half hours.
  
  Revision  ChangesPath
  1.17  +20 -7 
ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
  
  Index: FileUtilsTest.java
  ===
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- FileUtilsTest.java19 May 2003 15:55:23 -  1.16
  +++ FileUtilsTest.java23 Jun 2003 16:18:00 -  1.17
  @@ -119,7 +119,12 @@
   }
   
   
  -fu.setFileLastModified(removeThis, 123456);
  +// number of milliseconds in a day
  +final int millisperday=24 * 3600 * 1000;
  +// in a previous version, the date of the file was set to 123456
  +// milliseconds since 01.01.1970
  +// it did not work on a computer running JDK 1.4.1_02 + Windows 2000
  +fu.setFileLastModified(removeThis, secondModTime + millisperday);
   long thirdModTime = removeThis.lastModified();
   try {
   Class.forName(java.lang.ThreadLocal);
  @@ -421,17 +426,25 @@
* test toUri
*/
   public void testToURI() {
  +String dosRoot = null;
  +if (Os.isFamily(dos)) {
  +dosRoot = C:/;
  +}
  +else
  +{
  +dosRoot = ;
  +}
   if (Os.isFamily(dos)) {
   assertEquals(file:///C:/foo, fu.toURI(c:\\foo));
   }
  -assertEquals(file:///foo, fu.toURI(/foo));
  +assertEquals(file:/// + dosRoot + foo, fu.toURI(/foo));
   assertEquals(file:./foo,  fu.toURI(./foo));
  -assertEquals(file:///foo, fu.toURI(\\foo));
  +assertEquals(file:/// + dosRoot + foo, fu.toURI(\\foo));
   assertEquals(file:./foo,  fu.toURI(.\\foo));
  -assertEquals(file:///foo%20bar, fu.toURI(/foo bar));
  -assertEquals(file:///foo%20bar, fu.toURI(\\foo bar));
  -assertEquals(file:///foo%23bar, fu.toURI(/foo#bar));
  -assertEquals(file:///foo%23bar, fu.toURI(\\foo#bar));
  +assertEquals(file:/// + dosRoot + foo%20bar, fu.toURI(/foo 
bar));
  +assertEquals(file:/// + dosRoot + foo%20bar, fu.toURI(\\foo 
bar));
  +assertEquals(file:/// + dosRoot + foo%23bar, 
fu.toURI(/foo#bar));
  +assertEquals(file:/// + dosRoot + foo%23bar, 
fu.toURI(\\foo#bar));
   }
   
   /**
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-06-23 Thread Steve Loughran
[EMAIL PROTECTED] wrote:
  Note :
  I observed an error in the date/time returned by java and what I would
  expect theoretically under Win 2000 and JDK 1.4.1_02
  of 16,344,000 (16 millions of milliseconds), slightly
  more than 4 and a half hours.
really? what TZ are you in? Big deltas are usually timezone related.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-06-23 Thread Antoine Levy-Lambert
Hi Steve,
I am in the CET (Central European) Timezone. It has a difference of 1 hour
with GMT AFAIK. I have taken this hour of difference already into account.
Anyway the point is : trying to set the last modified time of a file to
123456 millis after the epoch does not work on my computer.
The Microsoft SDK information says that Windows files have a date/time of
last modification calculated since January 1st, 1601. So it must be some JDK
implementation problem. Not very interesting anyway.
Antoine
- Original Message -
From: Steve Loughran [EMAIL PROTECTED]
To: Ant Developers List [EMAIL PROTECTED]
Sent: Monday, June 23, 2003 6:38 PM
Subject: Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util
FileUtilsTest.java


 [EMAIL PROTECTED] wrote:

Note :
I observed an error in the date/time returned by java and what I would
expect theoretically under Win 2000 and JDK 1.4.1_02
of 16,344,000 (16 millions of milliseconds), slightly
more than 4 and a half hours.

 really? what TZ are you in? Big deltas are usually timezone related.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java

2003-05-19 Thread bodewig
bodewig 2003/05/19 08:55:23

  Modified:src/main/org/apache/tools/ant/util FileUtils.java
   src/testcases/org/apache/tools/ant/util FileUtilsTest.java
  Log:
  removeLeadingPath didn't work as expected when trying to remove a path
  from itself.
  PR: 19979
  
  Revision  ChangesPath
  1.42  +8 -4  ant/src/main/org/apache/tools/ant/util/FileUtils.java
  
  Index: FileUtils.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/FileUtils.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- FileUtils.java22 Apr 2003 18:23:55 -  1.41
  +++ FileUtils.java19 May 2003 15:55:22 -  1.42
  @@ -988,12 +988,16 @@
* @since Ant 1.5
*/
   public String removeLeadingPath(File leading, File path) {
  +String l = normalize(leading.getAbsolutePath()).getAbsolutePath();
  +String p = normalize(path.getAbsolutePath()).getAbsolutePath();
  +if (l.equals(p)) {
  +return ;
  +}
  +
   // if leading's path ends with a slash, it will be stripped by
   // normalize - we always add one so we never think /foo was a
   // parent directory of /foobar
  -String l = normalize(leading.getAbsolutePath()).getAbsolutePath()
  -+ File.separator;
  -String p = normalize(path.getAbsolutePath()).getAbsolutePath();
  +l += File.separator;
   if (p.startsWith(l)) {
   return p.substring(l.length());
   } else {
  
  
  
  1.16  +10 -1 
ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
  
  Index: FileUtilsTest.java
  ===
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- FileUtilsTest.java7 Mar 2003 11:23:14 -   1.15
  +++ FileUtilsTest.java19 May 2003 15:55:23 -  1.16
  @@ -1,7 +1,7 @@
   /*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -406,6 +406,15 @@
fu.removeLeadingPath(new File(/foo), new 
File(/bar)));
   assertEquals(fu.normalize(/foobar).getAbsolutePath(), 
fu.removeLeadingPath(new File(/foo), new 
File(/foobar)));
  +// bugzilla report 19979
  +assertEquals(, fu.removeLeadingPath(new File(/foo/bar), 
  +  new File(/foo/bar)));
  +assertEquals(, fu.removeLeadingPath(new File(/foo/bar), 
  +  new File(/foo/bar/)));
  +assertEquals(, fu.removeLeadingPath(new File(/foo/bar/), 
  +  new File(/foo/bar/)));
  +assertEquals(, fu.removeLeadingPath(new File(/foo/bar/), 
  +  new File(/foo/bar)));
   }
   
   /**