changeset 96:e5e0d6488ec6

Command line arguments should honor multiple whitespaces. Contributed-by: Sergey Kuksenko <sergey.kuksenko@oracle.com>
author shade
date Fri, 21 Jun 2013 18:07:45 +0400
parents 9d5036308216
children ab288dc41720
files jmh-core/src/main/java/org/openjdk/jmh/runner/options/BaseOptions.java jmh-core/src/main/java/org/openjdk/jmh/runner/options/HarnessOptions.java
diffstat 2 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/options/BaseOptions.java	Fri Jun 14 22:43:17 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/options/BaseOptions.java	Fri Jun 21 18:07:45 2013 +0400
@@ -137,9 +137,7 @@
         for (Field f : fields) {
             String opImage = fieldToCommandLineImage(f);
             if (opImage != null && !opImage.isEmpty()) {
-                for (String s : opImage.split(" ")) {
-                    sb.add(s);
-                }
+                Collections.addAll(sb, opImage.split("[ ]+"));
             }
         }
         return sb.toArray(new String[sb.size()]);
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/options/HarnessOptions.java	Fri Jun 14 22:43:17 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/options/HarnessOptions.java	Fri Jun 21 18:07:45 2013 +0400
@@ -33,6 +33,7 @@
 import org.openjdk.jmh.runner.BenchmarkRecord;
 import org.openjdk.jmh.runner.CompilerHints;
 import org.openjdk.jmh.runner.options.handlers.ForkOptionHandler;
+import org.openjdk.jmh.util.internal.CollectionUtils;
 
 import java.io.File;
 import java.lang.management.ManagementFactory;
@@ -192,9 +193,9 @@
         }
 
         if (getJvmArgs() != null) { // use supplied jvm args if given in cmd line
-            command.addAll(Arrays.asList(getJvmArgs().split(" ")));
+            command.addAll(Arrays.asList(getJvmArgs().split("[ ]+")));
         } else if (annJvmArgs != null) { // use jvm args supplied in annotation which shuns implicit args
-            command.addAll(Arrays.asList(annJvmArgs.split(" ")));
+            command.addAll(Arrays.asList(annJvmArgs.split("[ ]+")));
         } else {
             // else use same jvm args given to this runner
             RuntimeMXBean RuntimemxBean = ManagementFactory.getRuntimeMXBean();