< prev index next >

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

Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()
Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad


 132         HotSpotVirtualMachine hvm = (HotSpotVirtualMachine) vm;
 133         try (InputStream in = hvm.executeCommand(command, args)) {
 134           // read to EOF and just print output
 135           byte b[] = new byte[256];
 136           int n;
 137           do {
 138               n = in.read(b);
 139               if (n > 0) {
 140                   String s = new String(b, 0, n, "UTF-8");
 141                   System.out.print(s);
 142               }
 143           } while (n > 0);
 144         }
 145         vm.detach();
 146     }
 147 
 148     private static void histo(String pid, String options)
 149         throws AttachNotSupportedException, IOException,
 150                UnsupportedEncodingException {
 151         String liveopt = "-all";
 152         if (options.equals("") || options.equals("all")) {
 153             //  pass
 154         }
 155         else if (options.equals("live")) {
 156             liveopt = "-live";
 157         }
 158         else {
 159             usage(1);
 160         }
 161 
 162         // inspectHeap is not the same as jcmd GC.class_histogram
 163         executeCommandForPid(pid, "inspectheap", liveopt);
 164     }
 165 
 166     private static void dump(String pid, String options)
 167         throws AttachNotSupportedException, IOException,
 168                UnsupportedEncodingException {
 169 
 170         String subopts[] = options.split(",");
 171         String filename = null;
 172         String liveopt = "-all";




 132         HotSpotVirtualMachine hvm = (HotSpotVirtualMachine) vm;
 133         try (InputStream in = hvm.executeCommand(command, args)) {
 134           // read to EOF and just print output
 135           byte b[] = new byte[256];
 136           int n;
 137           do {
 138               n = in.read(b);
 139               if (n > 0) {
 140                   String s = new String(b, 0, n, "UTF-8");
 141                   System.out.print(s);
 142               }
 143           } while (n > 0);
 144         }
 145         vm.detach();
 146     }
 147 
 148     private static void histo(String pid, String options)
 149         throws AttachNotSupportedException, IOException,
 150                UnsupportedEncodingException {
 151         String liveopt = "-all";
 152         if (options.isEmpty() || options.equals("all")) {
 153             //  pass
 154         }
 155         else if (options.equals("live")) {
 156             liveopt = "-live";
 157         }
 158         else {
 159             usage(1);
 160         }
 161 
 162         // inspectHeap is not the same as jcmd GC.class_histogram
 163         executeCommandForPid(pid, "inspectheap", liveopt);
 164     }
 165 
 166     private static void dump(String pid, String options)
 167         throws AttachNotSupportedException, IOException,
 168                UnsupportedEncodingException {
 169 
 170         String subopts[] = options.split(",");
 171         String filename = null;
 172         String liveopt = "-all";


< prev index next >