< prev index next >

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

Print this page

        

*** 179,189 **** } 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.startsWith("parallel=")) { parallel = subopt.substring("parallel=".length()); if (parallel == null) { --- 179,189 ---- } 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.startsWith("parallel=")) { parallel = subopt.substring("parallel=".length()); if (parallel == null) {
*** 210,235 **** String filename = null; String liveopt = "-all"; for (int i = 0; i < subopts.length; i++) { String subopt = subopts[i]; ! if (subopt.equals("live")) { liveopt = "-live"; } else if (subopt.startsWith("file=")) { filename = parseFileName(subopt); } else if (subopt.equals("format=b")) { // ignore format (not needed at this time) } else { System.err.println("Fail: invalid option: '" + subopt + "'"); usage(1); } } ! if (filename == null) { ! System.err.println("Fail: invalid option or no file name"); ! usage(1); ! } // dumpHeap is not the same as jcmd GC.heap_dump executeCommandForPid(pid, "dumpheap", filename, liveopt); } --- 210,238 ---- String filename = null; String liveopt = "-all"; for (int i = 0; i < subopts.length; i++) { String subopt = subopts[i]; ! 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 { System.err.println("Fail: invalid option: '" + subopt + "'"); usage(1); } } ! System.out.flush(); // dumpHeap is not the same as jcmd GC.heap_dump executeCommandForPid(pid, "dumpheap", filename, liveopt); }
< prev index next >