6652 – new java.io.File("").getCanonicalFile() throws exception (original) (raw)

Description Anthony Green 2002-05-13 14:26:00 UTC

Sun's `new java.io.File("").getCanonicalFile()' returns a File for the

current directory. libgcj currently throws an IOException.

Release: 3.1 20020508 (prerelease)

Environment: System: Linux louie 2.4.7-10smp #1 SMP Thu Sep 6 17:09:31 EDT 2001 i686 unknown Architecture: i686

host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: /louie/green/3.1/gcc/configure --prefix=/louie/green/3.1/i --enable-threads --enable-languages=c,c++,java : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured) : (reconfigured)

How-To-Repeat: Try the following...

public class foo { public static void main (String args[]) { try { System.out.println (new java.io.File("").getCanonicalFile ()); } catch (Exception e) { System.err.println (e); } } }

Comment 1 Anthony Green 2002-05-13 14:26:00 UTC

Fix: This idiom is actually used in some free software. The work-around on posixy systems is to change "" to ".".

Comment 2 Tom Tromey 2002-06-12 10:01:25 UTC

Responsible-Changed-From-To: unassigned->tromey Responsible-Changed-Why: I'm handling this.

Comment 3 Tom Tromey 2002-06-12 10:01:25 UTC

State-Changed-From-To: open->closed State-Changed-Why: I've checked in the fix.