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.
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.