diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java index 0058d60a627deb..f627e85b23aaf1 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java @@ -440,7 +440,11 @@ private static Artifact createWindowsExeLauncher( "classpath", ";", Iterables.transform(classpath, Artifact.ROOT_RELATIVE_PATH_STRING)) - .addJoinedValues("jvm_flags", " ", jvmFlags) + // TODO(laszlocsomor): Change the Launcher to accept multiple jvm_flags entries. As of + // 2019-02-13 the Launcher accepts just one jvm_flags entry, which contains all the + // flags, joined by TAB characters. The Launcher splits up the string to get the + // individual jvm_flags. This approach breaks with flags that contain a TAB character. + .addJoinedValues("jvm_flags", "\t", jvmFlags) .build(); LauncherFileWriteAction.createAndRegister(ruleContext, javaLauncher, launchInfo); diff --git a/src/tools/launcher/java_launcher.cc b/src/tools/launcher/java_launcher.cc index e02d0ea1ff588b..d653dfe298bc51 100644 --- a/src/tools/launcher/java_launcher.cc +++ b/src/tools/launcher/java_launcher.cc @@ -359,7 +359,7 @@ ExitCode JavaBinaryLauncher::Launch() { jvm_flags.push_back(flag); } wstringstream jvm_flags_launch_info_ss(this->GetLaunchInfoByKey(JVM_FLAGS)); - while (getline(jvm_flags_launch_info_ss, flag, L' ')) { + while (getline(jvm_flags_launch_info_ss, flag, L'\t')) { jvm_flags.push_back(flag); }