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

cannot open file "NUL:"

XMLWordPrintable

    • behavioral
    • minimal
    • This restores behavior to that which obtained prior to the property recently being added which should restore compatibility.
    • Java API
    • Implementation

      Summary

      Change the default value of the Windows-specific property jdk.io.File.enableADS from false to true thereby permitting by default certain characters in Windows file paths in java.io.

      Problem

      The default value of the jdk.io.File.enableADS system property is currently false which breaks some applications which depend on being able to use certain characters in Windows file paths.

      Solution

      Change the default value of the jdk.io.File.enableADS system property from false to true.

      Specification

      There is no visible specification change.

      --- a/src/java.base/windows/classes/java/io/WinNTFileSystem.java
      +++ b/src/java.base/windows/classes/java/io/WinNTFileSystem.java
      @@ -48,16 +48,15 @@ class WinNTFileSystem extends FileSystem {
      
           // Whether to enable alternative data streams (ADS) by suppressing
           // checking the path for invalid characters, in particular ":".
      -    // ADS support will be enabled if and only if the property is set and
      -    // is the empty string or is equal, ignoring case, to the string "true".
      -    // By default ADS support is disabled.
      +    // By default, ADS support is enabled and will be disabled if and
      +    // only if the property is set, ignoring case, to the string "false".
           private static final boolean ENABLE_ADS;
           static {
               String enableADS = GetPropertyAction.privilegedGetProperty("jdk.io.File.enableADS");
               if (enableADS != null) {
      -            ENABLE_ADS = "".equals(enableADS) || Boolean.parseBoolean(enableADS);
      +            ENABLE_ADS = !enableADS.equalsIgnoreCase(Boolean.FALSE.toString());
               } else {
      -            ENABLE_ADS = false;
      +            ENABLE_ADS = true;
               }
           }

            bpb Brian Burkhalter
            webbuggrp Webbug Group
            Joe Darcy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: