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

Runtime.exec is unable to deal with paramters containing more than two blanks

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 6u24
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_7

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_24"
      Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
      Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      64 Bit

      A DESCRIPTION OF THE PROBLEM :
      Runtime.exec() is unable to deal with parameters containing more than one blank. Either exec() must keep its hands off of rewriting parameters, or it must be able to deal with more than one blank, as on Windows it is allowed to have as many blanks in sequence as you like.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Runtime.getRuntime().exec("NOTEPAD.EXE " + File.createTempFile("abc def", null)); // TWO blanks between abc and def


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Must open NOTEPAD.
      NOTEPAD must load the empty temp file.
      ACTUAL -
      Opens NOTEPAD.
      NOTEPAD complains about missing file.

      As soon as you reduce the number of blanks between abc and def from two to one or zero, NOTEPAD is able to find the file.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Called EXEs are unable to find files, as JRE is reducing the number of blanks from any to one.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Runtime.getRuntime().exec("NOTEPAD.EXE " + File.createTempFile("abc def", null)); // TWO blanks between abc and def

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Copy file to a folder that has no blanks in its name, and rename it to a name that has no blanks.

      Actually this is nearly impossible, as on Windows 7 you are very limited in the folders where you have write access. You can only write to some particular folders like TEMP and USERPROFILE etc., but all those folders MAY contain more than one temp.

      So there is no real solution.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: