< prev index next >

src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java

Print this page

        

@@ -169,44 +169,36 @@
                UnsupportedEncodingException {
         String liveopt = "-all";
         String filename = null;
         String parallel = null;
         String subopts[] = options.split(",");
-        boolean set_all = false;
-        boolean set_live = false;
 
         for (int i = 0; i < subopts.length; i++) {
             String subopt = subopts[i];
             if (subopt.equals("") || subopt.equals("all")) {
-                set_all = true;
-                liveopt = "-all";
+                // pass
             } else if (subopt.equals("live")) {
-                // Add '-' for compatibility.
-                set_live = true;
                 liveopt = "-live";
             } else if (subopt.startsWith("file=")) {
                 filename = parseFileName(subopt);
                 if (filename == null) {
-                    System.err.println("Fail at processing option '" + subopt +"'");
-                    usage(1); // invalid options or no filename
+                    System.err.println("Fail: invalid option or no file name '" + subopt +"'");
+                    System.exit(1);
                 }
             } else if (subopt.startsWith("parallel=")) {
                parallel = subopt.substring("parallel=".length());
                if (parallel == null) {
-                    System.err.println("Fail at processing option '" + subopt + "'");
-                    usage(1);
+                    System.err.println("Fail: no number provided in option: '" + subopt + "'");
+                    System.exit(1);
                }
             } else {
-                System.err.println("Fail at processing option '" + subopt + "'");
-                usage(1);
+                System.err.println("Fail: invalid option: '" + subopt + "'");
+                System.exit(1);
             }
         }
-        // backward compitable: if both "live" and "all" set, use "live".
-        if (set_live && set_all) {
-           liveopt = "-live";
-        }
         System.out.flush();
+
         // inspectHeap is not the same as jcmd GC.class_histogram
         executeCommandForPid(pid, "inspectheap", liveopt, filename, parallel);
     }
 
     private static void dump(String pid, String options)

@@ -225,12 +217,12 @@
                 filename = parseFileName(subopt);
             }
         }
 
         if (filename == null) {
-            System.err.println("Fail at processing option 'file'");
-            usage(1);  // invalid options or no filename
+            System.err.println("Fail: invalid option or no file name");
+            System.exit(1);
         }
 
         // dumpHeap is not the same as jcmd GC.heap_dump
         executeCommandForPid(pid, "dumpheap", filename, liveopt);
     }
< prev index next >