Esempio n. 1
0
  @Override
  public void uncaughtException(Thread arg0, Throwable arg1) {
    // 把错误的堆栈信息 获取出来
    String errorInfo = getErrorInfo(arg1);
    String uuidKey = UUID.nameUUIDFromBytes(errorInfo.getBytes()).toString();

    String existsException = Utils.getSharedPreferences("uncaughtException").getString(uuidKey, "");
    if (!existsException.equals("")) {
      // -- this uncaughtException has got
      Debug.Log("Exception has got yet: " + errorInfo);
      Debug.Log("kill self() ");
      android.os.Process.killProcess(android.os.Process.myPid());
      return;
    }

    Editor editor = Utils.getSharedPreferences("uncaughtException").edit();
    editor.putString(uuidKey, "Mark");
    editor.commit();

    String content = DeviceInfo.getInfo(context).toString();
    String msg = content + "\nStack:\n" + errorInfo;

    Debug.Log("uncaughtException: " + msg);

    errorContent = msg;

    //        sendExceptionMsg();
  }
  private Document parseXmlString(String xml) {
    try {
      DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
      InputSource is = new InputSource();
      is.setCharacterStream(new StringReader(xml));
      return db.parse(is);
    } catch (Exception e) {
      Debug.Log(tag, "Document error: ", e);
    }

    return null;
  }
Esempio n. 3
0
  @Override
  protected String doInBackground(String... params) {
    String loginStatus = "";

    String url = "";

    try {
      HttpPost httppost = new HttpPost(url);
      httppost.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false);
      List<NameValuePair> parameters = new ArrayList<NameValuePair>();
      parameters.add(new BasicNameValuePair("msg", CrashHandler.errorContent));
      httppost.setEntity(new UrlEncodedFormEntity(parameters, HTTP.UTF_8));
      client.execute(httppost);
    } catch (Throwable e) {
      Debug.Log(e.toString() + "");
    }

    // 重启
    Utils.restartGame();
    return loginStatus;
  }
 public NodeList getNodes(Element element, String elementName) {
   NodeList nodes = element.getElementsByTagName(elementName);
   Debug.Log(tag, "getNodes(" + elementName + ") returning " + nodes.getLength() + " nodes.");
   return nodes;
 }