Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4123637

java.io.File.getParent() returns "/u/test" as the parent of "/u/test/"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.2.0
    • 1.1.5, 1.2.0
    • core-libs
    • 1.2beta4
    • generic, x86, sparc
    • generic, solaris_2.5.1, windows_95
    • Not verified



      Name: el35337 Date: 03/27/98


      import java.io.*;

      public class FileParentBug {

        /**
         * Demonstrate that File.getParent fails on directories with a trailing
         * File.separator.
         *
         * Tested on JDK 1.1.5 and 1.2beta2 running on Solaris 2.5.1
         */
        public static void main(String[] args) {
          File file = new File("/u/test/");
          System.out.println("The parent directory of /u/test/ should be /u (or /u/)")
      ;
          System.out.println("JDK reports it as : " + file.getParent());
        }
      }
      (Review ID: 27268)
      ======================================================================

            mr Mark Reinhold
            elarsen Erik Larsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: