ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Danno Ferrin <shem...@yahoo.com>
Subject Re: cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java
Date Tue, 10 Dec 2002 16:49:26 GMT
I will confim that roumor, at least on 1.3 and 1.4 based JVMs.

bodewig@apache.org wrote:

>bodewig     2002/12/10 08:38:26
>
>  Modified:    .        WHATSNEW
>               src/main/org/apache/tools/ant/util FileUtils.java
>                        JAXPUtils.java
>               src/testcases/org/apache/tools/ant/util FileUtilsTest.java
>  Log:
>  Rumors say that absolute file: URLs on Windows need a third slash.
>  
>  Get rid of some code duplication.
>  
>  Revision  Changes    Path
>  1.331     +4 -0      jakarta-ant/WHATSNEW
>  
>  Index: WHATSNEW
>  ===================================================================
>  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
>  retrieving revision 1.330
>  retrieving revision 1.331
>  diff -u -r1.330 -r1.331
>  --- WHATSNEW	9 Dec 2002 12:40:37 -0000	1.330
>  +++ WHATSNEW	10 Dec 2002 16:38:25 -0000	1.331
>  @@ -65,6 +65,10 @@
>   
>   * the errorsbeginat attribute of the <http> condition didn't work.
>   
>  +* Ant will try to force loading of certain packages like com.sun.*
>  +  from the system classloader.  The packages are determined by the
>  +  version of the JVM running Ant.
>  +
>   Other changes:
>   --------------
>   * The filesetmanifest attribute of <jar> has been reenabled.
>  
>  
>  
>  1.33      +11 -1     jakarta-ant/src/main/org/apache/tools/ant/util/FileUtils.java
>  
>  Index: FileUtils.java
>  ===================================================================
>  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/util/FileUtils.java,v
>  retrieving revision 1.32
>  retrieving revision 1.33
>  diff -u -r1.32 -r1.33
>  --- FileUtils.java	4 Dec 2002 16:42:34 -0000	1.32
>  +++ FileUtils.java	10 Dec 2002 16:38:26 -0000	1.33
>  @@ -920,6 +920,11 @@
>           try {
>               path = normalize(path).getAbsolutePath();
>               sb.append("//");
>  +            // add an extra slash for filesystems with drive-specifiers
>  +            if (!path.startsWith("/")) {
>  +                sb.append("/");
>  +            }
>  +            
>           } catch (BuildException e) {
>               // relative path
>           }
>  @@ -960,6 +965,11 @@
>           }
>   
>           uri = uri.replace('/', File.separatorChar);
>  +        if (Os.isFamily("dos") && uri.startsWith("\\") && uri.length()
> 2
>  +            && Character.isLetter(uri.charAt(1)) && uri.charAt(2) ==
':') {
>  +            uri = uri.substring(1);
>  +        }
>  +
>           StringBuffer sb = new StringBuffer();
>           CharacterIterator iter = new StringCharacterIterator(uri);
>           for (char c = iter.first(); c != CharacterIterator.DONE; 
>  
>  
>  
>  1.4       +5 -11     jakarta-ant/src/main/org/apache/tools/ant/util/JAXPUtils.java
>  
>  Index: JAXPUtils.java
>  ===================================================================
>  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/util/JAXPUtils.java,v
>  retrieving revision 1.3
>  retrieving revision 1.4
>  diff -u -r1.3 -r1.4
>  --- JAXPUtils.java	31 Oct 2002 14:30:07 -0000	1.3
>  +++ JAXPUtils.java	10 Dec 2002 16:38:26 -0000	1.4
>  @@ -76,9 +76,11 @@
>   public class JAXPUtils {
>   
>       /**
>  -     * The file protocol: 'file://'
>  +     * Helper for systemId.
>  +     *
>  +     * @since Ant 1.6
>        */
>  -    private static final String FILE_PROTOCOL_PREFIX = "file://";
>  +    private static final FileUtils fu = FileUtils.newFileUtils();
>   
>       /**
>        * Parser factory to use to create parsers.
>  @@ -163,15 +165,7 @@
>        * @since Ant 1.5.2
>        */
>       public static String getSystemId(File file){
>  -        String path = file.getAbsolutePath();
>  -        path = path.replace('\\', '/');
>  -
>  -        // on Windows, use 'file:///'
>  -        if (File.separatorChar == '\\') {
>  -            return FILE_PROTOCOL_PREFIX + "/" + path;
>  -        }
>  -        // Unix, use 'file://'
>  -        return FILE_PROTOCOL_PREFIX + path;
>  +        return fu.toURI(file.getAbsolutePath());
>       }
>   
>       /**
>  
>  
>  
>  1.13      +4 -4      jakarta-ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
>  
>  Index: FileUtilsTest.java
>  ===================================================================
>  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
>  retrieving revision 1.12
>  retrieving revision 1.13
>  diff -u -r1.12 -r1.13
>  --- FileUtilsTest.java	18 Nov 2002 14:31:52 -0000	1.12
>  +++ FileUtilsTest.java	10 Dec 2002 16:38:26 -0000	1.13
>  @@ -412,8 +412,8 @@
>        * test toUri
>        */
>       public void testToURI() {
>  -        if (Os.isFamily("windows")) {
>  -            assertEquals("file://C:/foo", fu.toURI("c:\\foo"));
>  +        if (Os.isFamily("dos")) {
>  +            assertEquals("file:///C:/foo", fu.toURI("c:\\foo"));
>           }
>           assertEquals("file:///foo", fu.toURI("/foo"));
>           assertEquals("file:./foo",  fu.toURI("./foo"));
>  @@ -429,8 +429,8 @@
>        * test fromUri
>        */
>       public void testFromURI() {
>  -        if (Os.isFamily("windows")) {
>  -            assertEquals("C:\\foo", fu.fromURI("file://c:/foo"));
>  +        if (Os.isFamily("dos")) {
>  +            assertEquals("C:\\foo", fu.fromURI("file:///c:/foo"));
>           }
>           assertEquals(localize("/foo"), fu.fromURI("file:///foo"));
>           assertEquals("." + File.separator + "foo", 
>  
>  
>  
>
>--
>To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>
>
>  
>



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


Mime
View raw message