changeset 12704:c516c24fa010

7167157: jcmd command file parsing does not respect the "stop" command Reviewed-by: alanb, dsamersoff, nloodin
author sla
date Mon, 21 May 2012 19:28:41 +0200
parents c5ebefaa2f9f
children 95f428cdf9d2 f6f9cb8f6b97
files jdk/src/share/classes/sun/tools/jcmd/JCmd.java
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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];