예제 #1
0
 private void commandAttach(StringTokenizer t) {
   String portName;
   if (!t.hasMoreTokens()) {
     portName = context.getRemotePort();
     if (!portName.equals("")) {
       try {
         runtime.attach(portName);
       } catch (VMLaunchFailureException e) {
         env.failure("Attempt to attach to port \"" + portName + "\" failed.");
       }
     } else {
       env.failure("No port specifed and no current default defined.");
     }
   } else {
     portName = t.nextToken();
     try {
       runtime.attach(portName);
     } catch (VMLaunchFailureException e) {
       env.failure("Attempt to attach to port \"" + portName + "\" failed.");
     }
     context.setRemotePort(portName);
   }
 }