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

java.io: File classes do not recognize Windows UNC filenames (win32)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 1.1, 1.1.1, 1.1.3, 1.1.4, 1.2.0
    • Fix Version/s: 1.1.6
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      1.1.6
    • CPU:
      x86
    • OS:
      windows_nt
    • Verification:
      Verified

      Backports

        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) {
                }
           }

        }

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                mr Mark Reinhold
                Reporter:
                mchamnessunw Mark Chamness (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: