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); }
private void loadContext(int sessionId) { DialogInterface.OnClickListener dismissOnOk = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { cancel(); } }; ProfileTable db = new ProfileTable(this); try { db.openReadable(); try { session = db.getSession(sessionId); } catch (SQLiteException e) { AlertDialog dlg = Utilities.buildAlert( this, e, "Unable to retrieve profile", "Internal Error", dismissOnOk); dlg.show(); return; } if (session == null) { AlertDialog dlg = Utilities.buildAlert( this, null, "Could not find login session", "Internal Error", dismissOnOk); dlg.show(); return; } try { accountList = db.getAccountsBySession(sessionId); } catch (SQLiteException e) { AlertDialog dlg = Utilities.buildAlert( this, e, "Unable to retrieve accounts", "Internal Error", dismissOnOk); dlg.show(); return; } } finally { db.close(); } if (accountList == null) { requestAccountList(); } else { buildView(); } }