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

Command line arguments with *\ combinations get repeated \ characters.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 6u17, 7u10, 7u40, 8u40, 9
    • Fix Version/s: 9
    • Component/s: tools
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_7

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_40"
      Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
      Java HotSpot(TM) Client VM (build 25.40-b25, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Window 7, and Windows XP

      A DESCRIPTION OF THE PROBLEM :
      Also occurs with jre7.

      Starting a java application with, say:

      java.exe -cp someclasspath ClassName '.\*\*\*'

      results in the relevant main() method being invoked with an argument of:

      \*\\*\\\*

      each subsequent *\ getting an additional backslash added.




      REGRESSION. Last worked in version 6u45

      ADDITIONAL REGRESSION INFORMATION:
      The bug DOES NOT occur on this platform:

      java version "1.6.0_17"
      Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
      Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Define the class given below

      compile it and run it with:

      javac -cp . Star '\*\*\*\*\*'

      and observe the outputs.

      You can experiment with various quotes and, as near as I can tell, the results are always wrong. It seems to be very specific to the *\ combination, as well.

      Try out '.\*\*\foo\*\*\*\bar' for instance. It gets interesting.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expect it to print out

      \*\*\*\*\*'
      ACTUAL -
      But instead it prints out

      \*\\*\\\*\\\\*\\\\\*'

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No errors are reported

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Star {
      public static void main(String[] args) {
      for(int i = 0; i < args.length; i++) {
      String a = args[i];
      System.out.println(a);
      }
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      I have not found anything.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ksrini Kumar Srinivasan
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: