JDK-4032066 : java.io: File classes do not recognize Windows UNC filenames (win32)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.1,1.1.1,1.1.3,1.1.4,1.2.0
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1997-02-12
  • Updated: 1998-08-14
  • Resolved: 1998-08-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other Other
1.1.6 1.1.6Fixed 1.2.0Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description

Name: mc57594			Date: 02/12/97


1: Compile UNC.java and run 
    java UNC \\host\file 
where \\host\file is the UNC filename of an existing file.
The File class reports the file as not existing. This also
failed to work in 1.0.2 Also, FileInputStream fails with
UNC pathnames; I assume FileOutputStream will also
but did not try that.

import java.io.*;
public class UNC
{
  public static void main(String argv[])
  {
    for (int i = 0; i < argv.length; i++)
      {
        String fileName = argv[i];
        File file = new File(fileName);
        String exists = file.exists() ? "exists" : "does not exist.";
        System.out.println("File " + fileName + " " + exists);
      }
  }
}

company  -  SAS Institute  , email  -  ###@###.###
======================================================================
Another user reporting the same problem:

This was a bug in 1.1 and is still not fixed.  This is a big deal.  
It's a basic operating system function on win32 to be able to specify a 
file as \\computername\directory\filename.ext   You can't assume users 
have drivenames mapped...   Here's some test code:

import java.io.*;

public class UNCTest{

    public static void main(String args[]){
        try {

            File f = new File("\\\\mymachine\\download\\test.txt");
            FileOutputStream fos = new FileOutputStream (f);
            PrintWriter ps = new PrintWriter(fos);
            ps.println("This is a test");
            fos.close();
        } catch (IOException e) {
        }
   }

}

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.2beta3 generic FIXED IN: 1.1.6 1.2beta3 INTEGRATED IN: 1.1.6 1.2beta3 VERIFIED IN: 1.1.6
14-06-2004

WORK AROUND Name: mc57594 Date: 02/12/97 ======================================================================
11-06-2004

EVALUATION Fixed in JDK 1.1.6. Will also be fixed in JDK 1.2beta3. Required a complete rewrite of the win32 pathname-parsing code. -- mr@eng 1/26/1998
26-01-1998