--- old/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java 2020-08-14 07:05:05.000000000 -0700 +++ new/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java 2020-08-14 07:05:05.000000000 -0700 @@ -181,7 +181,7 @@ } else if (subopt.startsWith("file=")) { filename = parseFileName(subopt); if (filename == null) { - System.err.println("Fail: invalid option or no file name '" + subopt +"'"); + System.err.println("Fail: invalid option or no file name '" + subopt + "'"); usage(1); } } else if (subopt.startsWith("parallel=")) { @@ -212,10 +212,16 @@ for (int i = 0; i < subopts.length; i++) { String subopt = subopts[i]; - if (subopt.equals("live")) { + if (subopt.equals("") || subopt.equals("all")) { + // pass + } else if (subopt.equals("live")) { liveopt = "-live"; } else if (subopt.startsWith("file=")) { filename = parseFileName(subopt); + if (filename == null) { + System.err.println("Fail: invalid option or no file name '" + subopt + "'"); + usage(1); + } } else if (subopt.equals("format=b")) { // ignore format (not needed at this time) } else { @@ -224,10 +230,7 @@ } } - if (filename == null) { - System.err.println("Fail: invalid option or no file name"); - usage(1); - } + System.out.flush(); // dumpHeap is not the same as jcmd GC.heap_dump executeCommandForPid(pid, "dumpheap", filename, liveopt);