Exemple #1
0
    /**
     * This method clicks into the middle of a document. It uses Accessibility to get the document
     * and query for its position and its range to calculate the middle. This values was used for
     * <CODE>Robot</CODE> Class. This Robot class is able to move the mouse and to click a mouse
     * button
     *
     * @see java.awt.Robot
     */
    private void clickIntoDoc() {
      try {
        // get the position and the range of a scroll bar

        XWindow xWindow = AccessibilityTools.getCurrentWindow(xModel);

        XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);

        XAccessibleContext xPanel =
            AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PANEL);
        XAccessibleComponent xPanelCont =
            UnoRuntime.queryInterface(XAccessibleComponent.class, xPanel);

        // the position of the panel
        Point point = xPanelCont.getLocationOnScreen();

        // the range of the panel
        Rectangle rect = xPanelCont.getBounds();

        try {
          Robot rob = new Robot();
          int x = point.X + (rect.Width / 2);
          int y = point.Y + (rect.Height / 2);
          System.out.println("try to click into the middle of the document");
          rob.mouseMove(x, y);
          rob.mousePress(InputEvent.BUTTON1_MASK);
          rob.mouseRelease(InputEvent.BUTTON1_MASK);
        } catch (java.awt.AWTException e) {
          System.out.println("couldn't press mouse button");
        }
      } catch (java.lang.Exception e) {
        System.out.println("could not click into the scroll bar: " + e.toString());
      }
    }
Exemple #2
0
  public static boolean isHelperAvailable() {
    if (!triedHelperInit) {
      try {
        System.loadLibrary("turbovnchelper");
        helperAvailable = true;
      } catch (java.lang.UnsatisfiedLinkError e) {
        vlog.info("WARNING: Could not find TurboVNC Helper JNI library.  If it is in a");
        vlog.info("  non-standard location, then add -Djava.library.path=<dir>");
        vlog.info("  to the Java command line to specify its location.");
        vlog.info("  Full-screen mode may not work correctly.");
        if (VncViewer.osEID())
          vlog.info("  Keyboard grabbing and extended input device support will be disabled.");
        else if (VncViewer.osGrab()) vlog.info("  Keyboard grabbing will be disabled.");

      } catch (java.lang.Exception e) {
        vlog.info("WARNING: Could not initialize TurboVNC Helper JNI library:");
        vlog.info("  " + e.toString());
        vlog.info("  Full-screen mode may not work correctly.");
        if (VncViewer.osEID())
          vlog.info("  Keyboard grabbing and extended input device support will be disabled.");
        else if (VncViewer.osGrab()) vlog.info("  Keyboard grabbing will be disabled.");
      }
    }
    triedHelperInit = true;
    return helperAvailable;
  }
Exemple #3
0
 boolean processExtInputEventHelper(int type) {
   boolean retval = false;
   if (isHelperAvailable() && cc.cp.supportsGII) {
     boolean isExtEvent = false;
     try {
       isExtEvent = processExtInputEvent(type);
     } catch (java.lang.UnsatisfiedLinkError e) {
       vlog.info("WARNING: Could not invoke processExtInputEvent() from TurboVNC Helper.");
       vlog.info("  Extended input device support will be disabled.");
       helperAvailable = false;
     } catch (java.lang.Exception e) {
       vlog.info("WARNING: Could not invoke processExtInputEvent() from TurboVNC Helper:");
       vlog.info("  " + e.toString());
       vlog.info("  Extended input device support may not work correctly.");
     }
     if (!isExtEvent) return false;
     if (devices == null) {
       vlog.error("ERROR: Attempted to send extended input event when no GII devices exist");
       return false;
     }
     for (Iterator<ExtInputDevice> i = devices.iterator(); i.hasNext(); ) {
       ExtInputDevice dev = (ExtInputDevice) i.next();
       if (lastEvent.deviceID == dev.id && dev.remoteID != 0) {
         if (dev.absolute && lastEvent.type == giiTypes.giiValuatorRelative)
           lastEvent.type = giiTypes.giiValuatorAbsolute;
         cc.giiSendEvent(dev, lastEvent);
         retval = true;
       }
     }
   }
   return retval;
 }
 @Override
 public int read() throws java.io.IOException {
   try {
     return _s.getBuffer().b.get();
   } catch (java.lang.Exception ex) {
     throw new java.io.IOException(ex.toString());
   }
 }
 /**
  * Converts strings (in ascii) to hexadecimal
  *
  * @param message the string to convert
  * @return the hexadecimal string
  */
 public String StringToHex(String message) {
   try {
     return String.format("%x", new BigInteger(message.getBytes("US-ASCII")));
   } catch (Exception e) {
     System.out.print(e.toString());
     return message;
   }
 }
Exemple #6
0
  private boolean validUser(HttpServletRequest request, String email, String password) {
    // Validate user
    try {
      Context initCtx = new InitialContext();
      if (initCtx == null) System.out.println("initCtx is NULL");

      Context envCtx = (Context) initCtx.lookup("java:comp/env");
      if (envCtx == null) System.out.println("envCtx is NULL");

      // Look up our data source
      DataSource ds = (DataSource) envCtx.lookup("jdbc/TestDB");

      if (ds == null) System.out.println("ds is null.");

      Connection dbcon = ds.getConnection();
      if (dbcon == null) System.out.println("dbcon is null.");

      HttpSession session = request.getSession(); // Get client session

      Statement statement = dbcon.createStatement();
      String query =
          "SELECT * FROM customers c WHERE email = '"
              + email
              + "' AND password = '******'";

      ResultSet rs = statement.executeQuery(query);
      if (rs.next()) { // IF person exists with that password
        session.setAttribute(
            "user.name", rs.getString("first_name") + " " + rs.getString("last_name"));
        session.setAttribute("user.id", rs.getString("id"));
        return true; // then log in
      }

    } catch (SQLException ex) {
      System.out.println("<HTML><HEAD><TITLE>MovieDB: Error</TITLE></HEAD><BODY>");
      while (ex != null) {
        System.out.println("SQL Exception:  " + ex.getMessage());
        ex = ex.getNextException();
      } // end while
      System.out.println("</BODY></HTML>");
    } // end catch SQLException
    catch (java.lang.Exception ex) {
      System.out.println(
          "<HTML>"
              + "<HEAD><TITLE>"
              + "MovieDB: Error"
              + "</TITLE></HEAD>\n<BODY>"
              + "<P>SQL error in doGet: "
              + ex.getMessage()
              + "<br>"
              + ex.toString()
              + "</P></BODY></HTML>");
    }

    return false;
  }
 @Override
 public int read(byte[] b, int offset, int count) throws java.io.IOException {
   try {
     _s.getBuffer().b.get(b, offset, count);
   } catch (java.lang.Exception ex) {
     throw new java.io.IOException(ex.toString());
   }
   return count;
 }
  protected String sendAndReceive(byte[] payload) throws IOException {
    ByteBuffer sbuf = ByteBuffer.wrap(payload);
    ByteBuffer rbuf = ByteBuffer.allocateDirect(256);
    CharsetDecoder rbufDecoder = Charset.forName("UTF-8").newDecoder();
    StringBuilder response = new StringBuilder();

    int ops = SelectionKey.OP_WRITE | SelectionKey.OP_READ;
    if (this.channel.isConnectionPending()) {
      ops = ops | SelectionKey.OP_CONNECT;
    }

    Selector selector = Selector.open();
    try {
      this.channel.register(selector, ops);
      while (true) {
        if (0 < selector.select(Client.POLLS_INTERVAL * 1000)) {
          Iterator keys = selector.selectedKeys().iterator();
          while (keys.hasNext()) {
            SelectionKey key = (SelectionKey) keys.next();
            SocketChannel ch = (SocketChannel) key.channel();
            if (key.isConnectable()) {
              // Just connected
              ch.finishConnect();
            }
            if (key.isReadable() && !sbuf.hasRemaining()) {
              // Receiving the response
              while (0 < ch.read(rbuf)) {
                rbuf.flip();
                response.append(rbufDecoder.decode(rbuf).toString());
              }
              if (2 <= response.length()
                  && response
                      .substring(response.length() - 2, response.length())
                      .equals(SocketClient.TERMINATOR)) {
                response.setLength(response.length() - 2);
                return response.toString();
              } else if (0 == response.length()) {
                throw new IOException("Connection lost");
              }
            }
            if (key.isWritable() && sbuf.hasRemaining()) {
              // Sending the request
              while (0 < ch.write(sbuf) && sbuf.hasRemaining()) {
                //
              }
            }
            keys.remove();
          }
        }
      }
    } catch (java.lang.Exception e) {
      throw new IOException("API communication failed: " + e.toString());
    } finally {
      selector.close();
    }
  }
  public boolean processMsg(CConnection cc) {
    is = (FdInStream) cc.getInStream();
    os = (FdOutStream) cc.getOutStream();
    client = cc;

    initGlobal();

    if (session == null) {
      if (!is.checkNoWait(1)) return false;

      if (is.readU8() == 0) {
        int result = is.readU32();
        String reason;
        if (result == Security.secResultFailed || result == Security.secResultTooMany)
          reason = is.readString();
        else reason = new String("Authentication failure (protocol error)");
        throw new AuthFailureException(reason);
      }

      setParam();
    }

    try {
      manager = new SSLEngineManager(engine, is, os);
    } catch (java.lang.Exception e) {
      throw new Exception(e.toString());
    }

    try {
      manager.doHandshake();
    } catch (java.lang.Exception e) {
      throw new Exception(e.toString());
    }

    // checkSession();

    cc.setStreams(new TLSInStream(is, manager), new TLSOutStream(os, manager));
    return true;
  }
Exemple #10
0
 public void cleanupExtInputHelper() {
   if (isHelperAvailable() && x11dpy != 0) {
     try {
       cleanupExtInput();
     } catch (java.lang.UnsatisfiedLinkError e) {
       vlog.info("WARNING: Could not invoke cleanupExtInput() from TurboVNC Helper.");
       vlog.info("  Extended input device support will be disabled.");
       helperAvailable = false;
     } catch (java.lang.Exception e) {
       vlog.info("WARNING: Could not invoke cleanupExtInput() from TurboVNC Helper:");
       vlog.info("  " + e.toString());
     }
   }
 }
Exemple #11
0
 public void setupExtInputHelper() {
   if (isHelperAvailable() && cc.cp.supportsGII && x11dpy == 0) {
     try {
       setupExtInput();
     } catch (java.lang.UnsatisfiedLinkError e) {
       vlog.info("WARNING: Could not invoke setupExtInput() from TurboVNC Helper.");
       vlog.info("  Extended input device support will be disabled.");
       helperAvailable = false;
     } catch (java.lang.Exception e) {
       vlog.info("WARNING: Could not invoke setupExtInput() from TurboVNC Helper:");
       vlog.info("  " + e.toString());
       vlog.info("  Extended input device support may not work correctly.");
     }
   }
 }
Exemple #12
0
 public void x11FullScreenHelper(boolean on) {
   if (isHelperAvailable()) {
     try {
       x11FullScreen(on);
     } catch (java.lang.UnsatisfiedLinkError e) {
       vlog.info("WARNING: Could not invoke x11FullScreen() from TurboVNC Helper.");
       vlog.info("  Full-screen mode may not work correctly.");
       helperAvailable = false;
     } catch (java.lang.Exception e) {
       vlog.info("WARNING: Could not invoke x11FullScreen() from TurboVNC Helper:");
       vlog.info("  " + e.toString());
       vlog.info("  Full-screen mode may not work correctly.");
     }
   }
 }
Exemple #13
0
  public void run() {
    CConn cc = null;
    Socket sock = null;
    if (listenMode.getValue()) {
      int port = 5500;
      ServerSocket listener = null;
      if (vncServerName.getValue() != null && Character.isDigit(vncServerName.getValue().charAt(0)))
        port = Integer.parseInt(vncServerName.getValue());

      try {
        listener = new ServerSocket(port);
      } catch (IOException e) {
        System.out.println("Could not listen on port: " + port);
        System.exit(-1);
      }

      vlog.info("Listening on port " + port);

      try {
        sock = listener.accept();
        listener.close();
      } catch (IOException e) {
        System.out.println("Accept failed: " + port);
        System.exit(-1);
      }
    }
    try {
      cc = new CConn(this, sock, vncServerName.getValue(), false);
      while (true) cc.processMsg();
    } catch (EndOfStream e) {
      vlog.info(e.toString());
    } catch (java.lang.Exception e) {
      if (cc != null) cc.deleteWindow();
      if (cc == null || !cc.shuttingDown) {
        e.printStackTrace();
        JOptionPane.showMessageDialog(
            null, e.toString(), "VNC Viewer : Error", JOptionPane.ERROR_MESSAGE);
      }
    }
    if (cc != null) cc.deleteWindow();
    nViewers--;
    if (!applet && nViewers == 0) {
      System.exit(0);
    }
  }
Exemple #14
0
 public void grabKeyboardHelper(boolean on, boolean force) {
   if (isHelperAvailable()) {
     try {
       if (cc.keyboardGrabbed == on && !force) return;
       grabKeyboard(on, VncViewer.grabPointer.getValue());
       cc.keyboardGrabbed = on;
       cc.menu.grabKeyboard.setSelected(cc.keyboardGrabbed);
     } catch (java.lang.UnsatisfiedLinkError e) {
       vlog.info("WARNING: Could not invoke grabKeyboard() from TurboVNC Helper.");
       vlog.info("  Keyboard grabbing will be disabled.");
       helperAvailable = false;
     } catch (java.lang.Exception e) {
       vlog.info("WARNING: Could not invoke grabKeyboard() from TurboVNC Helper:");
       vlog.info("  " + e.toString());
       vlog.info("  Keyboard grabbing may not work correctly.");
     }
   }
 }
 /** Override toString method to provide information on nested exceptions. */
 public synchronized String toString() {
   String s = super.toString();
   Exception n = next;
   if (n == null) return s;
   StringBuffer sb = new StringBuffer(s == null ? "" : s);
   while (n != null) {
     sb.append(";\n  nested exception is:\n\t");
     if (n instanceof MessagingException) {
       MessagingException mex = (MessagingException) n;
       sb.append(mex.superToString());
       n = mex.next;
     } else {
       sb.append(n.toString());
       n = null;
     }
   }
   return sb.toString();
 }
 public void checkServerTrusted(X509Certificate[] chain, String authType)
     throws CertificateException {
   try {
     tm.checkServerTrusted(chain, authType);
   } catch (CertificateException e) {
     Object[] answer = {"Proceed", "Exit"};
     int ret =
         JOptionPane.showOptionDialog(
             null,
             e.getCause().getLocalizedMessage() + "\n" + "Continue connecting to this host?",
             "Confirm certificate exception?",
             JOptionPane.YES_NO_OPTION,
             JOptionPane.WARNING_MESSAGE,
             null,
             answer,
             answer[0]);
     if (ret == JOptionPane.NO_OPTION) System.exit(1);
   } catch (java.lang.Exception e) {
     throw new Exception(e.toString());
   }
 }
 void printDeleteForm(String s) {
   String s1 = request.getValue("idnum");
   if (request.isPost()) {
     try {
       java.io.File file = new File(s + "note" + s1 + ".htm");
       file.delete();
       java.io.File file2 = new File(NOTE_CACHE_FILENAME);
       if (file2.exists()) {
         file2.delete();
       }
       printRefreshPage("/SiteView/cgi/go.exe/SiteView?page=developerNote", 0);
     } catch (java.lang.Exception exception) {
       printError(
           "There was a problem deleting the note.",
           exception.toString(),
           "/SiteView/cgi/go.exe/SiteView?page=developerNote");
     }
   } else {
     java.io.File file1 = new File(s + "note" + s1 + ".htm");
     HashMap hashmap = SiteViewMain.SupportNoteUtils.readNote(file1);
     outputStream.println(
         "<FONT SIZE=+1>Are you sure you want to delete developer note <B>"
             + s1
             + "</B>"
             + " regarding &quot;"
             + COM.dragonflow.Utils.TextUtils.getValue(hashmap, "title")
             + "&quot;?</FONT>"
             + "<p><FORM ACTION=/SiteView/cgi/go.exe/SiteView method=POST>"
             + "<INPUT TYPE=HIDDEN NAME=operation VALUE=\"Delete\">"
             + "<INPUT TYPE=HIDDEN NAME=page VALUE=developerNote>"
             + "<INPUT TYPE=HIDDEN NAME=idnum VALUE=\""
             + s1
             + "\">"
             + "<TABLE WIDTH=100% BORDER=0><TR>"
             + "<TD WIDTH=6%></TD><TD WIDTH=41%><input type=submit VALUE=\"Delete Developer Note\"></TD>"
             + "<TD WIDTH=6%></TD><TD ALIGN=RIGHT WIDTH=41%><A HREF=/SiteView/cgi/go.exe/SiteView?page=developerNote>Return to Developer Note List</A></TD><TD WIDTH=6%></TD>"
             + "</TR></TABLE></FORM>");
     printFooter(outputStream);
   }
 }
Exemple #18
0
  public static java.lang.String initialize(
      java.lang.String s, java.lang.String s1, java.lang.String s2) {
    java.lang.String s3 = "";
    try {
      java.lang.System.setProperty(
          "java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
      java.security.Security.addProvider(new Provider());
      com.sun.net.ssl.SSLContext sslcontext = com.sun.net.ssl.SSLContext.getInstance("SSL");
      randomGenerator = new SecureRandom();
      byte abyte0[] = new byte[20];
      for (int i = 0; i < 20; i++) {
        abyte0[i] = (byte) (int) (java.lang.Math.random() * 256D - 128D);
      }

      randomGenerator.setSeed(abyte0);
      if ((new File(s + ".pfx")).exists()) {
        s = s + ".pfx";
      }
      com.sun.net.ssl.KeyManager akeymanager[] = null;
      try {
        if ((new File(s)).exists()) {
          java.security.KeyStore keystore;
          if (s.endsWith(".pfx")) {
            keystore = java.security.KeyStore.getInstance("PKCS12");
          } else {
            keystore = java.security.KeyStore.getInstance("JKS");
          }
          com.sun.net.ssl.KeyManagerFactory keymanagerfactory =
              com.sun.net.ssl.KeyManagerFactory.getInstance("SunX509");
          java.io.FileInputStream fileinputstream = new FileInputStream(s);
          char ac[] = s1.toCharArray();
          char ac1[] = s2.toCharArray();
          keystore.load(fileinputstream, ac);
          java.util.Enumeration enumeration = keystore.aliases();
          while (enumeration.hasMoreElements()) {
            java.lang.String s4 = (java.lang.String) enumeration.nextElement();
            certificateDescription = certificateDescription + " (" + s4;
            java.security.cert.Certificate acertificate[] = keystore.getCertificateChain(s4);
            if (acertificate != null) {
              int j = 0;
              while (j < acertificate.length) {
                java.security.cert.X509Certificate x509certificate =
                    (java.security.cert.X509Certificate) acertificate[j];
                certificateDescription =
                    certificateDescription
                        + " (cert "
                        + x509certificate.getSubjectDN()
                        + ", "
                        + x509certificate.getSigAlgName()
                        + ")";
                j++;
              }
            }
          }
          s3 = s3 + "certs: " + certificateDescription + "\n";
          keymanagerfactory.init(keystore, ac1);
          akeymanager = keymanagerfactory.getKeyManagers();
        }
      } catch (java.lang.Exception exception) {
        exception.printStackTrace();
        s3 = s3 + exception.toString();
      }
      sslcontext.init(akeymanager, null, randomGenerator);
      if (akeymanager != null) {
        sslServerSocketFactory = sslcontext.getServerSocketFactory();
      }
      sslSocketFactory = sslcontext.getSocketFactory();
    } catch (java.lang.Throwable throwable) {
      throwable.printStackTrace();
      s3 = s3 + throwable.toString();
    }
    return s3;
  }
  public void doGet(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {

    Connection connection = null;
    Statement statement = null;

    String driver = null;
    String url = null;
    String userid = null;
    String pass = null;

    String error_message = null;
    boolean error_occured = false;

    String message = null;
    String tableName = null;
    String columnName = null;

    HttpSession session = req.getSession(false);

    if (session == null) {
      res.setContentType("text/html");
      PrintWriter writer = res.getWriter();

      writer.println("<HTML>");
      writer.println(
          "<BODY onLoad=\"window.parent.location.href='Login?message="
              + "Sorry Your session expired. Please Login Again.'\"");
      writer.println("</BODY>");
      writer.println("</HTML>");

      writer.close();
    } else {
      driver = session.getAttribute("driver").toString();
      url = session.getAttribute("url").toString();
      userid = session.getAttribute("userid").toString();
      pass = session.getAttribute("pass").toString();

      tableName = req.getParameter("table_name");
      columnName = req.getParameter("column_name");

      String query = "alter table " + tableName + " drop column " + columnName;

      try {
        Class.forName(driver);
        connection = DriverManager.getConnection(url, userid, pass);
        statement = connection.createStatement();
        statement.executeUpdate(query);
        message = columnName + " column deleted successfully.";
      } catch (Exception e) {
        error_occured = true;
        error_message = e.toString();
      }

      try {
        statement.close();
        connection.close();
      } catch (Exception e) {
        e.printStackTrace();
      }

      if (error_occured)
        res.sendRedirect("TabOperations?table_name=" + tableName + "&message=" + error_message);
      else res.sendRedirect("DescTab?table_name=" + tableName + "&message=" + message);
    }
  }
  /**
   * Starts the debugger. The method stops the current debugging (if any) and takes information from
   * the provided info (containing the class to start and arguments to pass it and name of class to
   * stop debugging in) and starts new debugging session.
   *
   * @param info debugger info about class to start
   * @exception DebuggerException if an error occures during the start of the debugger
   */
  public void startDebugger(DebuggerInfo info) throws DebuggerException {
    debuggerInfo = info;
    if (remoteDebugger != null) finishDebugger();
    // S ystem.out.println("startDebugger " + info); // NOI18N
    // RemoteDebugging support
    hostName = null;
    password = null;
    boolean local = true;
    if (info instanceof ReconnectDebuggerInfo) {
      ReconnectDebuggerInfo rdi = (ReconnectDebuggerInfo) info;
      hostName = rdi.getHostName();
      password = rdi.getPassword();
      local = false;
    } else if (info instanceof RemoteDebuggerInfo) {
      hostName = ((RemoteDebuggerInfo) info).getHostName();
      password = ((RemoteDebuggerInfo) info).getPassword();
      local = false;
    }
    boolean stopOnMain = info.getStopClassName() != null;
    stopOnMainFlag = stopOnMain;
    // S ystem.out.println ("ToolsDebugger.startDebugger " + info.getStopClassName ()); // NOI18N
    // T hread.dumpStack ();

    synchronizer = new RequestSynchronizer();

    // open output window ...
    super.startDebugger(info);

    // start & init remote debugger ................................................
    //    process = null;
    if (local) {
      // create process & read password for local debugging

      // create starting string & NbProcessDescriptor
      NbProcessDescriptor debugerProcess;
      if (info instanceof ProcessDebuggerInfo)
        debugerProcess = ((ProcessDebuggerInfo) info).getDebuggerProcess();
      else debugerProcess = ProcessDebuggerType.DEFAULT_DEBUGGER_PROCESS;
      HashMap map;
      if (info instanceof ToolsDebugger10Info) {
        map =
            Utils.processDebuggerInfo(
                info,
                "-debug", // NOI18N
                "sun.tools.debug.EmptyApp" // NOI18N
                );
        map.put(ToolsDebugger10Type.JAVA_HOME_SWITCH, ((ToolsDebugger10Info) info).getJavaHome());
      } else {
        if (info instanceof ToolsDebugger11Info) {
          String javaHome11 = ((ToolsDebugger11Info) info).getJavaHome();
          if ((javaHome11 == null) || (javaHome11.trim().length() == 0)) {
            finishDebugger();
            throw new DebuggerException(bundle.getString("EXC_JDK11_home_is_not_set"));
          }
          map =
              Utils.processDebuggerInfo(
                  info,
                  "-debug -nojit", // NOI18N
                  "sun.tools.debug.EmptyApp" // NOI18N
                  );
          map.put(ToolsDebugger11Type.JAVA_HOME_SWITCH, javaHome11);
        } else {
          map =
              Utils.processDebuggerInfo(
                  info,
                  "-Xdebug", // NOI18N
                  "sun.tools.agent.EmptyApp" // NOI18N
                  );
        }
      }
      MapFormat format = new MapFormat(map);
      String s =
          format.format(
              debugerProcess.getProcessName() + " " + debugerProcess.getArguments() // NOI18N
              );
      println(s, ERR_OUT);

      // start process & read password ......................................
      try {
        process = debugerProcess.exec(format);
        BufferedReader bufferedreader =
            new BufferedReader(new InputStreamReader(process.getInputStream()));
        password = bufferedreader.readLine();
        showOutput(process, ERR_OUT, ERR_OUT);
        connectInput(process);
      } catch (java.lang.Exception e) {
        finishDebugger();
        throw new DebuggerException(
            new MessageFormat(bundle.getString("EXC_While_create_debuggee"))
                .format(
                    new Object[] {format.format(debugerProcess.getProcessName()), e.toString()}),
            e);
      }
      if (password == null) {
        // no reply
        finishDebugger();
        throw new DebuggerException(
            new MessageFormat(bundle.getString("EXC_While_connect_to_debuggee"))
                .format(new Object[] {format.format(debugerProcess.getProcessName())}));
      }
      if (password.indexOf("=") < 0) { // NOI18N
        // unexpected reply
        println(bundle.getString("CTL_Unexpected_reply") + ": " + password, ERR_OUT);
        showOutput(process, ERR_OUT + STD_OUT, ERR_OUT);
        finishDebugger();
        throw new DebuggerException(
            new MessageFormat(bundle.getString("EXC_Unecpected_debugger_reply"))
                .format(new Object[] {password}));
      }
      password = password.substring(password.indexOf("=") + 1); // NOI18N
      println(bundle.getString("CTL_Password") + ": " + password, ERR_OUT);
      hostName = "127.0.0.1"; // NOI18N
    } // end of local debugging specific
    else if (info instanceof ReconnectDebuggerInfo) {
      println(bundle.getString("CTL_Reconnecting"), ERR_OUT | STD_OUT);
    } else
      println(bundle.getString("CTL_Connecting_to") + ": " + hostName + ":" + password, ERR_OUT);

    // start RemoteDebugger ...................................................
    try {
      remoteDebugger =
          new RemoteDebugger(
              hostName,
              password.length() < 1 ? null : password,
              new ToolsCallback(this),
              isShowMessages());
    } catch (java.net.ConnectException e) {
      finishDebugger();
      throw new DebuggerException(
          new MessageFormat(bundle.getString("EXC_Cannot_connect_to_debuggee"))
              .format(new Object[] {e.toString()}),
          e);
    } catch (Throwable e) {
      if (e instanceof ThreadDeath) throw (ThreadDeath) e;
      // e.printStackTrace ();
      finishDebugger();
      throw new DebuggerException(
          new MessageFormat(bundle.getString("EXC_Cannot_connect_to_debuggee"))
              .format(new Object[] {e.toString()}),
          e);
    }

    // create arguments for main class ...............................................
    mainClassName = info.getClassName();
    RemoteClass cls;
    String[] args = null;
    if ((mainClassName != null) && (mainClassName.length() > 0)) {
      String[] infoArgs = info.getArguments();
      args = new String[infoArgs.length + 1];
      args[0] = mainClassName;
      System.arraycopy(infoArgs, 0, args, 1, infoArgs.length);
      // args[0] = name of class
      // args[...] = parameters

      // find main class .........................................................
      try {
        cls = remoteDebugger.findClass(mainClassName);
      } catch (Throwable e) {
        if (e instanceof ThreadDeath) throw (ThreadDeath) e;
        finishDebugger();
        throw new DebuggerException(
            new MessageFormat(bundle.getString("EXC_Cannot_find_class"))
                .format(new Object[] {mainClassName, e.toString()}),
            e);
      }
      if (cls == null) {
        finishDebugger();
        throw new DebuggerException(
            new MessageFormat(bundle.getString("EXC_Cannot_find_class"))
                .format(new Object[] {mainClassName, new ClassNotFoundException().toString()}));
      }
    }

    // set breakpoint on stop class method ...............................................
    if (stopOnMain) {
      RemoteClass stopClass = null;
      try {
        stopClass = remoteDebugger.findClass(stopClassName = info.getStopClassName());
      } catch (Throwable e) {
        if (e instanceof ThreadDeath) throw (ThreadDeath) e;
        println(
            bundle.getString("MSG_Exc_while_finding_class") + stopClassName + '\n' + e, ERR_OUT);
      }
      if (stopClass == null) {
        println(bundle.getString("CTL_No_such_class") + ": " + stopClassName, ERR_OUT);
      } else {
        try {
          RemoteField[] rf = stopClass.getMethods();
          int i, k = rf.length;
          Type t = Type.tMethod(Type.tVoid, new Type[] {Type.tArray(Type.tString)});
          Type startT = Type.tMethod(Type.tVoid);
          RemoteField startM = null;
          RemoteField initM = null;
          RemoteField constM = null;
          for (i = 0; i < k; i++) {
            if (rf[i].getName().equals("main")
                && // NOI18N
                rf[i].getType().equals(t)) break;
            else if (rf[i].getName().equals("start")
                && // NOI18N
                rf[i].getType().equals(startT)) startM = rf[i];
            else if (rf[i].getName().equals("init")
                && // NOI18N
                rf[i].getType().equals(startT)) initM = rf[i];
            else if (rf[i].getName().equals("<init>")
                && // NOI18N
                rf[i].getType().equals(startT)) constM = rf[i];
          }
          if (i < k) // [PENDING] stop on non main too !!!!!!!!!!!!!!!!!!!!!
          stopClass.setBreakpointMethod(rf[i]); // have main
          else if (initM != null) stopClass.setBreakpointMethod(initM);
          else if (startM != null) stopClass.setBreakpointMethod(startM);
          else if (constM != null) stopClass.setBreakpointMethod(constM);

          // S ystem.out.println ("Stop: " + (i <k) + " " + initM +" " + startM +" " + constM); //
          // NOI18N
          /*          pendingBreakpoints = new RemoteField [1];
          pendingBreakpoints [0] = rf[i];
          pendingBreakpointsClass = stopClass;*/
        } catch (Throwable e) {
          if (e instanceof ThreadDeath) throw (ThreadDeath) e;
          println(bundle.getString("MSG_Exc_while_setting_breakpoint") + '\n' + e, ERR_OUT);
        }
      }
    } // stopOnMain

    setBreakpoints();
    updateWatches();
    println(bundle.getString("CTL_Debugger_running"), STL_OUT);
    setDebuggerState(DEBUGGER_RUNNING);

    // run debugged class ...............................................
    if (args != null) {
      RemoteThreadGroup rtg = null;
      try {
        rtg = remoteDebugger.run(args.length, args);
        //        threadGroup.setRemoteThreadGroup (rtg);
      } catch (Throwable e) {
        if (e instanceof ThreadDeath) throw (ThreadDeath) e;
        finishDebugger();
        throw new DebuggerException(
            new MessageFormat(bundle.getString("EXC_While_calling_run"))
                .format(new Object[] {mainClassName, e.toString()}),
            e);
      }
      if (rtg == null) {
        finishDebugger();
        throw new DebuggerException(
            new MessageFormat(bundle.getString("EXC_While_calling_run"))
                .format(
                    new Object[] {
                      mainClassName, "" // NOI18N
                    }));
      }
    }

    // start refresh thread .................................................
    if (debuggerThread != null) debuggerThread.stop();
    debuggerThread =
        new Thread(
            new Runnable() {
              public void run() {
                for (; ; ) {
                  try {
                    Thread.sleep(5000);
                  } catch (InterruptedException ex) {
                  }
                  if (getState() == DEBUGGER_RUNNING)
                    try {
                      threadGroup.threadChanged();

                    } catch (Throwable e) {
                      if (e instanceof ThreadDeath) throw (ThreadDeath) e;
                      if (e instanceof java.net.SocketException) {
                        debuggerThread = null;
                        try {
                          finishDebugger();
                        } catch (Throwable ee) {
                          if (ee instanceof ThreadDeath) throw (ThreadDeath) ee;
                        }
                        Thread.currentThread().stop();
                      }
                    }
                }
              }
            },
            "Debugger refresh thread"); // NOI18N
    debuggerThread.setPriority(Thread.MIN_PRIORITY);
    debuggerThread.start();
  }