comparison agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java @ 12932:7fe6ef09d242

8025638: jmap returns 0 instead of 1 when it fails. Summary: Re-factored some code handling return values and fails/errors during tool execution. Reviewed-by: sla, kevinw Contributed-by: fredrik.arvidsson@oracle.com
author farvidsson
date Wed, 16 Oct 2013 09:20:23 +0200
parents 38ea2efa32a7
children
comparison
equal deleted inserted replaced
12859:f509b8f4699b 12932:7fe6ef09d242
134 mode = MODE_HEAP_GRAPH_HPROF_BIN; 134 mode = MODE_HEAP_GRAPH_HPROF_BIN;
135 } else if (format.equals("x")) { 135 } else if (format.equals("x")) {
136 mode = MODE_HEAP_GRAPH_GXL; 136 mode = MODE_HEAP_GRAPH_GXL;
137 } else { 137 } else {
138 System.err.println("unknown heap format:" + format); 138 System.err.println("unknown heap format:" + format);
139 return; 139
140 // Exit with error status
141 System.exit(1);
140 } 142 }
141 } else { 143 } else {
142 copyArgs = false; 144 copyArgs = false;
143 } 145 }
144 } 146 }
151 args = newArgs; 153 args = newArgs;
152 } 154 }
153 } 155 }
154 156
155 JMap jmap = new JMap(mode); 157 JMap jmap = new JMap(mode);
156 jmap.start(args); 158 jmap.execute(args);
157 jmap.stop();
158 } 159 }
159 160
160 public boolean writeHeapHprofBin(String fileName) { 161 public boolean writeHeapHprofBin(String fileName) {
161 try { 162 try {
162 HeapGraphWriter hgw = new HeapHprofBinWriter(); 163 HeapGraphWriter hgw = new HeapHprofBinWriter();