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

new FileOutputStream("NUL:") shows "Invalid path or file name"

    XMLWordPrintable

Details

    • b06
    • x86_64
    • windows_10

    Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 7 / 10 / JRE 8u331

      A DESCRIPTION OF THE PROBLEM :
      After updating JRE 8 version version 202, to 331, new FileOutputStream("NUL:") shows "Invalid path or file name".

      Original Method:

      static {
        NULL_FILE_CHANNEL = AccessController.doPrivileged(new PrivilegedAction < FileChannel > () {
          public FileChannel run() {
            final String osName = System.getProperty("os.name", "unknown").toLowerCase(Locale.US);
            try {
              if (osName.contains("windows")) {
                return new FileOutputStream("NUL:").getChannel();
              } else {
                return new FileOutputStream("/dev/null").getChannel();
              }
            } catch (FileNotFoundException e) {
              throw new IOError(e);
            }
          }
        });

      REGRESSION : Last worked in version 8

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      try {
        new FileOutputStream("NUL:").getChannel();
      } catch (FileNotFoundException e) {
        e.printStackTrace();
      }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      new FileOutputStream, to call method "getChannel()"
      ACTUAL -
      FileNotFoundException

      FREQUENCY : always


      Attachments

        Issue Links

          Activity

            People

              tongwan Andrew Wang
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: