JDK-8143640 : Showing incorrect result while passing specific argument in the Java launcher tools
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 8,9
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: windows
  • CPU: x86_64
  • Submitted: 2015-09-19
  • Updated: 2016-10-13
  • Resolved: 2016-06-28
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.
JDK 8 JDK 9
8u112Fixed 9 b126Fixed
Related Reports
Duplicate :  
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.10240]

A DESCRIPTION OF THE PROBLEM :
This is an error in the "java" launcher tool -- I couldn't find a category for that.
Command line arguments, quoted and containing the 2 adjacent characters "\\*", adds extra "\\" characters to the argument. Really odd. Examples:
    Argument           Character in arg received by process (raw, no escapes)
    "a\*\b"                 a\*\\b
    "a\*\*\b"               a\*\\*\\\b
    "a\*\*\*\b"            a\*\\*\\\*\\\\b
This has been demonstrated on Windows 10 and Vista, using Java 8-60. I haven't test with older releases. I don't think it's a windows shell problem, as I get expected results using Python, Ruby, Go,
and a batch script. I suspect the "java" tool is doing something to the args.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run my little included program with arguments from my description.
E.g.
   java Arg0 "a\*\b"

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
a\*\b"
ACTUAL -
a\*\\b

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Arg0.java

class Arg0 {
    public static void main(String[] args) {
        System.out.println(args[0]);
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
None yet


Comments
the parser http://hg.openjdk.java.net/jdk9/dev/jdk/file/7f644a5d554a/src/java.base/windows/native/libjli/cmdtoargs.c is adding extra back-slashes.
09-12-2015

This issue is specific to *Windows*.
25-11-2015

Test Result: ########## OS : Windows 7-64 bit ################## JDK ***** 6u111 b08- Pass 6u45 b06 - Pass 7u0 b147- Pass 7u01 b08 - Pass 7u05 b06 - Pass 7u07 b10 - Pass 7u09 b05 - Pass 7u10 b18 - Fail 7u13 b20 - Fail 7u80 b15 - Fail 8u0 b132- Fail 8u65 b17 - Fail 9ea b64 - Fail 7u10,7u13,7u80,8,8u65,9ea ************************************ c:\Abhijit\tools>javac Arg0.java c:\Abhijit\tools>java Arg0 "a\*\b" a\*\\b c:\Abhijit\tools>
23-11-2015