changeset 5415:0a1ef7e07e01

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 f109feb13698
children b88fc3359dc7 a2fc04c2dfc8
files src/share/classes/sun/tools/jcmd/JCmd.java
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/tools/jcmd/JCmd.java	Mon May 21 09:40:32 2012 -0700
+++ b/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];