7167157: jcmd command file parsing does not respect the "stop" command
authorsla
Mon, 21 May 2012 19:28:41 +0200
changeset 12704 c516c24fa010
parent 12703 c5ebefaa2f9f
child 12705 95f428cdf9d2
child 12842 f6f9cb8f6b97
7167157: jcmd command file parsing does not respect the "stop" command Reviewed-by: alanb, dsamersoff, nloodin
jdk/src/share/classes/sun/tools/jcmd/JCmd.java
--- 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];