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

File.getCanonicalPath() throws IOException when invoked with "nul" (win)

    Details

    • Subcomponent:
    • Introduced In Version:
    • Resolved In Build:
      b105
    • CPU:
      x86
    • OS:
      windows_nt
    • Verification:
      Verified

      Backports

        Description

        ###@###.### 2003-05-05

        J2SE Version (please include all output from java -version flag):

        J:\borsotti\jtest>java -version
          java version "1.4.1_01"
          Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
          Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

          and

          java version "1.4.2-rc"
          Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-rc-b20)
          Java HotSpot(TM) Client VM (build 1.4.2-rc-b20, mixed mode)

        Does this problem occur on J2SE 1.3, 1.4 or 1.4.1? Yes / No (pick one)
         Yes on 1.4.1
         No pm 1.4 and 1.3.1

        Operating System Configuration Information (be specific):
         NT service pack 5

        Hardware Configuration Information (be specific):
         Compaq DeskPro

        Bug Description:
          java.io.IOException exception throws on getCanonicalPath method when
          a file "nul" is created on Window system.

        Steps to Reproduce (be specific):

         - Compile and run it.
         - A File for "nul" is created (i.e. for the name that is used
           in Windows to denote the null device).
         - A writer is created, successfully.
         - The getCanonicalPath() methid is invoked, which throws an exception:

          >java Fnull
        Exception in thread "main" java.io.IOException: No such file or
        directory
                at java.io.WinNTFileSystem.canonicalize(Native Method)
                at java.io.File.getCanonicalPath(File.java:513)
                at Fnull.main(Fnull.java:6)

          This should not occur because a file on which a Writer can be
          successfully created should also have a canonical name.

        Test program (Fnull.java):
        ---------------------------
          import java.io.*;
          public class Fnull {
              public static void main(String[] args) throws IOException {
                File f = new File("nul");
                FileWriter out = new FileWriter(f);
                String s = f.getCanonicalPath();
              }
           }

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  dxu Dan Xu (Inactive)
                  Reporter:
                  tyao Ting-Yun Ingrid Yao (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: