JDK-4208417 : java.io.File.getAbsolutePath with null path does not return trailing slash
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.2.0
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.6
  • CPU: sparc
  • Submitted: 1999-02-03
  • Updated: 1999-02-05
  • Resolved: 1999-02-05
Related Reports
Duplicate :  
Relates :  
Description
The following code returns the current working directory with a trailing
slash on JDK 1.1.6 but does not return a path with a trailing slash
on 1.2 FCS.

This functionality is used in the Spec benchmark application.

import java.io.*;

// Test of File Open
class FileOpen {
        public static void main (String args[]) {

            System.out.println( (new File("")).getAbsolutePath() );
    }
}

Comments
EVALUATION The java.io.File class was totally reworked in JDK 1.2 (see 4131169) to fix a number of longstanding problems. The root cause of many of these bugs was that the File class was originally specified in terms of string concatenation, which just doesn't fly on platforms like Win32. Unfortunately this meant introducing a small number of binary incompatibilities in certain corner-case situations. The situation described here is an instance of a more general incompatibility, namely that the File class no longer preserves trailing separator characters. A similar incompatibility is that duplicate separator characters are no longer preserved either. The new File class was introduced in 1.2beta4, and in the course of testing we found that very few programs actually depended upon these behaviors. The SPECjvm suite was one of them, and the keepers of the SPECjvm code have already agreed to fix it appropriately. -- mr@eng 1999/2/5
02-07-0171