Ejemplo n.º 1
0
 private void sendExceptionMsg(int what, Exception e) {
   e.printStackTrace();
   Message msg = Message.obtain();
   msg.obj = e;
   msg.what = what;
   queryHandler.sendMessage(msg);
 }
Ejemplo n.º 2
0
  public void run() {
    OfxRequest req = session.newRequest();
    AccountInfoMsgReq acctReq = new AccountInfoMsgReq();
    acctReq.acctListAge = session.profile.acctListAge;
    req.addRequest(acctReq);

    List<OfxMessageResp> response;
    try {
      response = req.submit(this);

      for (OfxMessageResp resp : response) {
        if (resp instanceof AccountInfoMsgResp) {
          AccountInfoMsgResp acctResp = (AccountInfoMsgResp) resp;
          session.profile.acctListAge = acctResp.acctListAge;
          accountList = acctResp.accounts;
        }
      }
    } catch (HttpResponseException e) {
      sendExceptionMsg(QH_ERR_STATUS, e);
    } catch (OfxError e) {
      sendExceptionMsg(QH_ERR_OFX, e);
    } catch (XmlPullParserException e) {
      sendExceptionMsg(QH_ERR_PARSE, e);
    } catch (SSLPeerUnverifiedException e) {
      sendExceptionMsg(QH_ERR_SSL_VERIFY, e);
    } catch (ClientProtocolException e) {
      sendExceptionMsg(QH_ERR_HTTP, e);
    } catch (ConnectException e) {
      sendExceptionMsg(QH_ERR_TIMEOUT, e);
    } catch (SocketException e) {
      sendExceptionMsg(QH_ERR_CONN, e);
    } catch (SSLException e) {
      sendExceptionMsg(QH_ERR_SSL, e);
    } catch (Exception e) {
      sendExceptionMsg(QH_ERR, e);
    }

    ProfileTable db = new ProfileTable(this);
    try {
      db.openWritable();
      db.syncAccounts(session, accountList);
    } catch (SQLiteException e) {
      sendExceptionMsg(QH_ERR, e);
    } finally {
      db.close();
    }

    queryHandler.sendEmptyMessage(QH_OK);
  }