Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7901406

jtreg splits by spaces command-line string argument in quotes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • jt4.1
    • tools
    • None

      jtreg version 4.1 splits command-line arguments by spaces despite they are in quotes.

      Please, see next code of Test.java

      /*
       * @test
       *
       * @run main Test "Argument with spaces"
       */
       
       public class Test
       {
           public static void main(String... args)
      {
                  throw new RuntimeException("Args length " + args.length);
      }
       }

      If I run this program stand-alone like:

      java Test "Argument with spaces"

      Log will be
      Exception in thread "main" java.lang.RuntimeException: Args length 1
      That is expected behavior because arguments in quotes recognized by java as one argument.

      If I run the same test with jtreg it will be
      Execution failed: `main' threw exception: java.lang.RuntimeException: Args length 3

      Seems like in this case quotes are ignored and argument is split by spaces.
       

            Unassigned Unassigned
            snikandrova Svetlana Nikandrova (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: