7167157: jcmd command file parsing does not respect the "stop" command
Reviewed-by: alanb, dsamersoff, nloodin
--- a/jdk/src/share/classes/sun/tools/jcmd/JCmd.java Mon May 21 09:40:32 2012 -0700
+++ b/jdk/src/share/classes/sun/tools/jcmd/JCmd.java Mon May 21 19:28:41 2012 +0200
@@ -142,8 +142,11 @@
// Cast to HotSpotVirtualMachine as this is an
// implementation specific method.
HotSpotVirtualMachine hvm = (HotSpotVirtualMachine) vm;
- String lines[] = command .split("\\n");
+ String lines[] = command.split("\\n");
for (String line : lines) {
+ if (line.trim().equals("stop")) {
+ break;
+ }
try (InputStream in = hvm.executeJCmd(line);) {
// read to EOF and just print output
byte b[] = new byte[256];