classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] Patch: File.getParent fixlet


From: Wolfgang Baer
Subject: Re: [cp-patches] Patch: File.getParent fixlet
Date: Sun, 06 Nov 2005 21:25:25 +0100
User-agent: Debian Thunderbird 1.0.7 (X11/20051017)

Mark Wielaard wrote:
Hi Wolfgang,

On Sun, 2005-11-06 at 19:06 +0100, Wolfgang Baer wrote:

These are the fixlets needed to make java.io.File pass the submitted
mauve tests for an empty file ( new File("") ).

2005-11-06  Wolfgang Baer  <address@hidden>

        * java/io/File.java
          (getParent): If pathname is "" return null.
          (toURI): Also append separatorChar if path equals "".
          (getAbsolutePath): If path equals "" only return the value
           of the user.dir system property.


OK, so File("") is almost like File(".").

The method names in a ChangeLog entry are not indented extra, just one
tab. So please write it as:

2005-11-06  Wolfgang Baer  <address@hidden>

        * java/io/File.java
        (getParent): If pathname is "" return null.
        (toURI): Also append separatorChar if path equals "".
        (getAbsolutePath): If path equals "" only return the value
        of the user.dir system property.


Everything is indented the same (2 spaces):

        else if (path.equals(""))
          return System.getProperty ("user.dir");
        else
          return System.getProperty ("user.dir") + separatorChar + path;

Please commit with those changes.

OK committing as below.

2005-11-06  Wolfgang Baer  <address@hidden>

        * java/io/File.java
        (getParent): If pathname is "" return null.
        (toURI): Also append separatorChar if path equals "".
        (getAbsolutePath): If path equals "" only return the value
        of the user.dir system property.

Thanks,
Wolfgang
Index: java/io/File.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/File.java,v
retrieving revision 1.58
diff -u -r1.58 File.java
--- java/io/File.java   24 Oct 2005 06:44:19 -0000      1.58
+++ java/io/File.java   6 Nov 2005 20:22:12 -0000
@@ -457,6 +457,8 @@
         else
           return drvDir;
       }
+    else if (path.equals(""))
+      return System.getProperty ("user.dir");
     else
       return System.getProperty ("user.dir") + separatorChar + path;
   }
@@ -543,6 +545,9 @@
   {
     String prefix = null;
     int nameSeqIndex = 0;
+    
+    if (path.equals(""))
+      return null;
 
     // The "prefix", if present, is the leading "/" on UNIX and 
     // either the drive specifier (e.g. "C:") or the leading "\\"
@@ -954,8 +959,8 @@
   public URI toURI()
   {
     String abspath = getAbsolutePath();
-
-    if (isDirectory())
+       
+    if (isDirectory() || path.equals(""))
       abspath = abspath + separatorChar;
 
     if (separatorChar == '\\')


reply via email to

[Prev in Thread] Current Thread [Next in Thread]