List of usage examples for org.apache.http.client ClientProtocolException getMessage
public String getMessage()
From source file:com.liato.bankdroid.banking.banks.sebkort.SEBKortBase.java
@Override public void update() throws BankException, LoginException, BankChoiceException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); }//from w ww.j a v a 2s . c o m urlopen = login(); try { UserResponse ur = mObjectMapper.readValue( urlopen.openStream(String.format("https://%s/nis/m/%s/a/user", mApiBase, mProviderPart)), UserResponse.class); BillingUnitsResponse br = mObjectMapper.readValue( urlopen.openStream( String.format("https://%s/nis/m/%s/a/billingUnits", mApiBase, mProviderPart)), BillingUnitsResponse.class); boolean multipleAccounts = br.getBody().size() > 1; for (BillingUnit bu : br.getBody()) { Account account = new Account( formatAccountName(bu.getArrangementNumber(), "Disponibelt belopp", multipleAccounts), Helpers.parseBalance(bu.getDisposableAmount()), bu.getArrangementNumber()); account.setType(Account.CCARD); account.setCurrency(currency); mBillingUnitIds.put(account, bu.getBillingUnitId()); accounts.add(account); balance = balance.add(account.getBalance()); account = new Account(formatAccountName(bu.getArrangementNumber(), "Saldo", multipleAccounts), Helpers.parseBalance(bu.getBalance()), bu.getArrangementNumber() + "_2"); account.setType(Account.OTHER); account.setAliasfor(bu.getArrangementNumber()); account.setCurrency(currency); accounts.add(account); account = new Account(formatAccountName(bu.getArrangementNumber(), "Kpgrns", multipleAccounts), Helpers.parseBalance(bu.getCreditAmountNumber()), bu.getArrangementNumber() + "_3"); account.setType(Account.OTHER); account.setAliasfor(bu.getArrangementNumber()); account.setCurrency(currency); accounts.add(account); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } } catch (ClientProtocolException e) { throw new BankException(e.getMessage()); } catch (IOException e) { throw new BankException(e.getMessage()); } finally { super.updateComplete(); } }
From source file:com.lenovo.h2000.services.LicenseServiceImpl.java
@Override public String upload(String filePath, Map<String, String> headers) throws Exception { _logger.info("calling LicenseServiceImpl.upload function"); Map<String, String> params = new HashMap<String, String>(); CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost httpPost = new HttpPost( HttpConfig.parseBaseUrl(headers) + "license/import" + "?" + TypeUtil.mapToString(params));// new HttpPost("http://localhost:3002/license/import"); String responseBody = ""; DataInputStream in = null;/*www. jav a 2s . c o m*/ try { _logger.info("filePath" + filePath); File file = new File(filePath); in = new DataInputStream(new FileInputStream(filePath)); byte[] bufferOut = new byte[(int) file.length()]; int bytes = 0; int i = 0; int len = (int) (1024 > file.length() ? file.length() : 1024); while ((bytes = in.read(bufferOut, i, len)) > 0) { if (bytes < 1024) break; else { len = (int) (file.length() - bytes); i += bytes; } } ByteArrayEntity requestEntity = new ByteArrayEntity(bufferOut); requestEntity.setContentEncoding("UTF-8"); requestEntity.setContentType("application/octet-stream"); httpPost.setEntity(requestEntity); HttpResponse response = httpClient.execute(httpPost); response.setHeader(HttpHeaders.CONTENT_TYPE, "application/json; charset=UTF-8"); HttpEntity responseEntity = response.getEntity(); responseBody = EntityUtils.toString(responseEntity); if (file.isFile() && file.exists()) { file.delete(); } } catch (ClientProtocolException e) { e.printStackTrace(); _logger.error("throwing HttpClientUtil.doPost ClientProtocolException with " + e.getMessage()); } catch (IOException e) { e.printStackTrace(); _logger.error("throwing HttpClientUtil.doPost IOException with " + e.getMessage()); } finally { httpClient.close(); if (in != null) { in.close(); } } return responseBody; }
From source file:edu.xiyou.fruits.WebCrawler.net.HttpRequest.java
@Override public Response getResponse(CrawlDatum datum) throws IllegalArgumentException { if (!checkCrawlDatum(datum)) { logger.info("datum is null"); throw new IllegalArgumentException("illegal format"); }//from w ww. j a va 2 s .c o m String url = datum.getUrl(); HttpGet httpGet = new HttpGet(url); try { Response obj = client.execute(httpGet, handler); if (obj != null) { ((Html) obj).setUrl(url); return obj; } } catch (ClientProtocolException e) { logger.info("ClientProtocolException "); e.printStackTrace(); } catch (SocketTimeoutException e) { logger.error(e.getMessage()); } catch (IOException e) { logger.info("IOException "); e.printStackTrace(); } return null; }
From source file:net.evecom.androidecssp.activity.event.EventListActivity.java
/** * //from w w w .j a v a 2 s . c om */ private void initlist() { new Thread(new Runnable() { @Override public void run() { Message message = new Message(); try { HashMap<String, String> entityMap = new HashMap<String, String>(); entityMap.put("pagesize", HttpUtil.getPageSize(instance)); if (!ifqueryallevents) { String deptid = ShareUtil.getString(instance, "PASSNAME", "orgid", ""); entityMap.put("deptid", deptid); } resutArray = connServerForResultPost("jfs/ecssp/mobile/eventCtr/getEnentList", entityMap); } catch (ClientProtocolException e) { message.what = MESSAGETYPE_02; Log.e("mars", e.getMessage()); } catch (IOException e) { message.what = MESSAGETYPE_02; Log.e("mars", e.getMessage()); } if (resutArray.length() > 0) { try { eventInfos = getObjsInfo(resutArray); if (null == eventInfos) { message.what = MESSAGETYPE_02; } else { message.what = MESSAGETYPE_01; } } catch (JSONException e) { message.what = MESSAGETYPE_02; Log.e("mars", e.getMessage()); } } else { message.what = MESSAGETYPE_02; } Log.v("mars", resutArray); eventListHandler.sendMessage(message); } }).start(); }
From source file:com.osafe.services.sagepay.SagePayTokenServices.java
public static Map<String, Object> paymentAuthorisation(DispatchContext ctx, Map<String, Object> context) { Debug.logInfo("SagePay Token - Entered paymentAuthorisation", module); // Debug.logInfo("SagePay Token - paymentAuthorisation context : " + context, module); Delegator delegator = ctx.getDelegator(); Map<String, Object> resultMap = new HashMap<String, Object>(); Map<String, String> props = buildSagePayProperties(context, delegator); String vendorTxCode = (String) context.get("vendorTxCode"); String vpsTxId = (String) context.get("vpsTxId"); String securityKey = (String) context.get("securityKey"); String txAuthNo = (String) context.get("txAuthNo"); String amount = (String) context.get("amount"); String token = (String) context.get("token"); String currency = (String) context.get("currency"); String description = (String) context.get("description"); String billingSurname = (String) context.get("billingSurname"); String billingFirstnames = (String) context.get("billingFirstnames"); String billingAddress = (String) context.get("billingAddress"); String billingAddress2 = (String) context.get("billingAddress2"); String billingCity = (String) context.get("billingCity"); String billingPostCode = (String) context.get("billingPostCode"); String billingCountry = (String) context.get("billingCountry"); String billingState = (String) context.get("billingState"); String billingPhone = (String) context.get("billingPhone"); HttpClient httpClient = SagePayUtil.getHttpClient(); HttpHost host = SagePayUtil.getHost(props); //start - authorization parameters Map<String, String> parameters = new HashMap<String, String>(); String vpsProtocol = props.get("protocolVersion"); String vendor = props.get("vendor"); String txType = props.get("authoriseTransType"); parameters.put("VPSProtocol", vpsProtocol); parameters.put("TxType", txType); parameters.put("Vendor", vendor); parameters.put("VendorTxCode", vendorTxCode); parameters.put("VPSTxId", vpsTxId); parameters.put("SecurityKey", securityKey); parameters.put("TxAuthNo", txAuthNo); parameters.put("Amount", amount); parameters.put("Token", token); parameters.put("Currency", currency); if (description != null) { parameters.put("Description", description); }// w ww . ja v a 2 s . com if (billingSurname != null) { parameters.put("BillingSurname", billingSurname); } if (billingFirstnames != null) { parameters.put("BillingFirstnames", billingFirstnames); } if (billingAddress != null) { parameters.put("BillingAddress1", billingAddress); } if (billingAddress2 != null) { parameters.put("BillingAddress2", billingAddress2); } if (billingCity != null) { parameters.put("BillingCity", billingCity); } if (billingPostCode != null) { parameters.put("BillingPostCode", billingPostCode); } if (billingCountry != null) { parameters.put("BillingCountry", billingCountry); } if (billingState != null) { parameters.put("BillingState", billingState); } if (billingPhone != null) { parameters.put("BillingPhone", billingPhone); } // Debug.logInfo("authorization parameters -> " + parameters, module); //end - authorization parameters try { String successMessage = null; HttpPost httpPost = SagePayUtil.getHttpPost(props.get("authoriseUrl"), parameters); HttpResponse response = httpClient.execute(host, httpPost); Map<String, String> responseData = SagePayUtil.getResponseData(response); String status = responseData.get("Status"); String statusDetail = responseData.get("StatusDetail"); resultMap.put("status", status); resultMap.put("statusDetail", statusDetail); //start - payment refunded if ("OK".equals(status)) { successMessage = "Payment Authorised"; } //end - payment refunded //start - refund request not formed properly or parameters missing if ("MALFORMED".equals(status)) { successMessage = "Released request not formed properly or parameters missing"; } //end - refund request not formed properly or parameters missing //start - invalid information passed in parameters if ("INVALID".equals(status)) { successMessage = "Invalid information passed in parameters"; } //end - invalid information passed in parameters //start - problem at Sagepay if ("ERROR".equals(status)) { successMessage = "Problem at SagePay"; } //end - problem at Sagepay resultMap.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); resultMap.put(ModelService.SUCCESS_MESSAGE, successMessage); } catch (UnsupportedEncodingException uee) { //exception in encoding parameters in httpPost String errorMsg = "Error occured in encoding parameters for HttpPost (" + uee.getMessage() + ")"; Debug.logError(uee, errorMsg, module); resultMap = ServiceUtil.returnError(errorMsg); } catch (ClientProtocolException cpe) { //from httpClient execute String errorMsg = "Error occured in HttpClient execute(" + cpe.getMessage() + ")"; Debug.logError(cpe, errorMsg, module); resultMap = ServiceUtil.returnError(errorMsg); } catch (IOException ioe) { //from httpClient execute or getResponsedata String errorMsg = "Error occured in HttpClient execute or getting response (" + ioe.getMessage() + ")"; Debug.logError(ioe, errorMsg, module); resultMap = ServiceUtil.returnError(errorMsg); } finally { httpClient.getConnectionManager().shutdown(); } return resultMap; }
From source file:com.osafe.services.sagepay.SagePayTokenServices.java
public static Map<String, Object> paymentVoid(DispatchContext ctx, Map<String, Object> context) { Debug.logInfo("SagePay Token - Entered paymentVoid", module); // Debug.logInfo("SagePay Token - paymentVoid context : " + context, module); Delegator delegator = ctx.getDelegator(); Map<String, Object> resultMap = new HashMap<String, Object>(); Map<String, String> props = buildSagePayProperties(context, delegator); String vendorTxCode = (String) context.get("vendorTxCode"); String vpsTxId = (String) context.get("vpsTxId"); String securityKey = (String) context.get("securityKey"); String txAuthNo = (String) context.get("txAuthNo"); String amount = (String) context.get("amount"); String token = (String) context.get("token"); String currency = (String) context.get("currency"); String description = (String) context.get("description"); String billingSurname = (String) context.get("billingSurname"); String billingFirstnames = (String) context.get("billingFirstnames"); String billingAddress = (String) context.get("billingAddress"); String billingAddress2 = (String) context.get("billingAddress2"); String billingCity = (String) context.get("billingCity"); String billingPostCode = (String) context.get("billingPostCode"); String billingCountry = (String) context.get("billingCountry"); String billingState = (String) context.get("billingState"); String billingPhone = (String) context.get("billingPhone"); HttpClient httpClient = SagePayUtil.getHttpClient(); HttpHost host = SagePayUtil.getHost(props); //start - void parameters Map<String, String> parameters = new HashMap<String, String>(); String vpsProtocol = props.get("protocolVersion"); String vendor = props.get("vendor"); String txType = props.get("voidTransType"); parameters.put("VPSProtocol", vpsProtocol); parameters.put("TxType", txType); parameters.put("Vendor", vendor); parameters.put("VendorTxCode", vendorTxCode); parameters.put("VPSTxId", vpsTxId); parameters.put("SecurityKey", securityKey); parameters.put("TxAuthNo", txAuthNo); parameters.put("Amount", amount); parameters.put("Description", description); parameters.put("Token", token); parameters.put("Currency", currency); if (description != null) { parameters.put("Description", description); }//from ww w . j av a2 s .c om if (billingSurname != null) { parameters.put("BillingSurname", billingSurname); } if (billingFirstnames != null) { parameters.put("BillingFirstnames", billingFirstnames); } if (billingAddress != null) { parameters.put("BillingAddress1", billingAddress); } if (billingAddress2 != null) { parameters.put("BillingAddress2", billingAddress2); } if (billingCity != null) { parameters.put("BillingCity", billingCity); } if (billingPostCode != null) { parameters.put("BillingPostCode", billingPostCode); } if (billingCountry != null) { parameters.put("BillingCountry", billingCountry); } if (billingState != null) { parameters.put("BillingState", billingState); } if (billingPhone != null) { parameters.put("BillingPhone", billingPhone); } //end - void parameters try { String successMessage = null; HttpPost httpPost = SagePayUtil.getHttpPost(props.get("voidUrl"), parameters); HttpResponse response = httpClient.execute(host, httpPost); Map<String, String> responseData = SagePayUtil.getResponseData(response); String status = responseData.get("Status"); String statusDetail = responseData.get("StatusDetail"); resultMap.put("status", status); resultMap.put("statusDetail", statusDetail); //start - payment void if ("OK".equals(status)) { successMessage = "Payment Voided"; } //end - payment void //start - void request not formed properly or parameters missing if ("MALFORMED".equals(status)) { successMessage = "Void request not formed properly or parameters missing"; } //end - void request not formed properly or parameters missing //start - invalid information passed in parameters if ("INVALID".equals(status)) { successMessage = "Invalid information passed in parameters"; } //end - invalid information passed in parameters //start - problem at Sagepay if ("ERROR".equals(status)) { successMessage = "Problem at SagePay"; } //end - problem at Sagepay resultMap.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); resultMap.put(ModelService.SUCCESS_MESSAGE, successMessage); } catch (UnsupportedEncodingException uee) { //exception in encoding parameters in httpPost String errorMsg = "Error occured in encoding parameters for HttpPost (" + uee.getMessage() + ")"; Debug.logError(uee, errorMsg, module); resultMap = ServiceUtil.returnError(errorMsg); } catch (ClientProtocolException cpe) { //from httpClient execute String errorMsg = "Error occured in HttpClient execute(" + cpe.getMessage() + ")"; Debug.logError(cpe, errorMsg, module); resultMap = ServiceUtil.returnError(errorMsg); } catch (IOException ioe) { //from httpClient execute or getResponsedata String errorMsg = "Error occured in HttpClient execute or getting response (" + ioe.getMessage() + ")"; Debug.logError(ioe, errorMsg, module); resultMap = ServiceUtil.returnError(errorMsg); } finally { httpClient.getConnectionManager().shutdown(); } return resultMap; }
From source file:com.liato.bankdroid.banking.banks.IkanoPartnerBase.java
@Override public void update() throws BankException, LoginException, BankChoiceException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); }// w ww . java2 s. c o m urlopen = login(); Matcher matcher; try { String creditPageUrl = null; String transactionsPageUrl = null; matcher = reCreditInfoUrl.matcher(response); if (matcher.find()) { creditPageUrl = matcher.group(1); } matcher = reTransactionsUrl.matcher(response); if (!matcher.find() && creditPageUrl == null) { throw new BankException(res.getText(R.string.unable_to_find).toString() + " transactions url."); } transactionsPageUrl = matcher.group(1); // If a url for the credit page is found we request that page first. If no url for the credit page is // found we only need to request the transactions page as all the credit info should be available on // that page. response = urlopen.open("https://partner.ikanobank.se/web/engines/" + (creditPageUrl == null ? transactionsPageUrl : creditPageUrl)); matcher = reAccounts.matcher(response); int accId = 0; while (matcher.find()) { /* * Capture groups: * GROUP EXAMPLE DATA * 1: Name Kvar att handla fr * 2: Amount 17 229,85 * 3: Currency kr * */ Account account = new Account(Html.fromHtml(matcher.group(1)).toString().trim(), Helpers.parseBalance(matcher.group(2)), Integer.toString(accId)); if (accId > 0) { account.setAliasfor("0"); } accounts.add(account); accId++; } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } // Use the amount from "Kvar att handla fr" which should be the last account in the list. this.balance = accounts.get(accounts.size() - 1).getBalance(); if (creditPageUrl != null) { response = urlopen.open("https://partner.ikanobank.se/web/engines/" + transactionsPageUrl); } ArrayList<Transaction> transactions = new ArrayList<Transaction>(); matcher = reTransactions.matcher(response); while (matcher.find()) { /* * Capture groups: * GROUP EXAMPLE DATA * 1: Date 2011-02-27 * 2: Specification Best Buy<br> * 3: Amount 143,07 kr * 4: Currency SEK * */ Transaction transaction = new Transaction(matcher.group(1).trim(), Html.fromHtml(matcher.group(2).replaceAll("<br>", " ")).toString().trim(), Helpers.parseBalance(matcher.group(3))); transactions.add(transaction); } accounts.get(0).setTransactions(transactions); } catch (ClientProtocolException e) { throw new BankException(e.getMessage()); } catch (IOException e) { throw new BankException(e.getMessage()); } finally { super.updateComplete(); } }
From source file:com.osafe.services.sagepay.SagePayTokenServices.java
public static Map<String, Object> paymentRelease(DispatchContext ctx, Map<String, Object> context) { Debug.logInfo("SagePay Token - Entered paymentRelease", module); // Debug.logInfo("SagePay Token - paymentRelease context : " + context, module); Delegator delegator = ctx.getDelegator(); Map<String, Object> resultMap = new HashMap<String, Object>(); Map<String, String> props = buildSagePayProperties(context, delegator); String vendorTxCode = (String) context.get("vendorTxCode"); String vpsTxId = (String) context.get("vpsTxId"); String securityKey = (String) context.get("securityKey"); String txAuthNo = (String) context.get("txAuthNo"); String amount = (String) context.get("amount"); String token = (String) context.get("token"); String currency = (String) context.get("currency"); String description = (String) context.get("description"); String billingSurname = (String) context.get("billingSurname"); String billingFirstnames = (String) context.get("billingFirstnames"); String billingAddress = (String) context.get("billingAddress"); String billingAddress2 = (String) context.get("billingAddress2"); String billingCity = (String) context.get("billingCity"); String billingPostCode = (String) context.get("billingPostCode"); String billingCountry = (String) context.get("billingCountry"); String billingState = (String) context.get("billingState"); String billingPhone = (String) context.get("billingPhone"); HttpClient httpClient = SagePayUtil.getHttpClient(); HttpHost host = SagePayUtil.getHost(props); //start - release parameters Map<String, String> parameters = new HashMap<String, String>(); String vpsProtocol = props.get("protocolVersion"); String vendor = props.get("vendor"); String txType = props.get("releaseTransType"); parameters.put("VPSProtocol", vpsProtocol); parameters.put("TxType", txType); parameters.put("Vendor", vendor); parameters.put("VendorTxCode", vendorTxCode); parameters.put("VPSTxId", vpsTxId); parameters.put("SecurityKey", securityKey); parameters.put("TxAuthNo", txAuthNo); parameters.put("Amount", amount); parameters.put("Description", description); parameters.put("Token", token); parameters.put("Currency", currency); if (description != null) { parameters.put("Description", description); }//from ww w .j a va2 s .com if (billingSurname != null) { parameters.put("BillingSurname", billingSurname); } if (billingFirstnames != null) { parameters.put("BillingFirstnames", billingFirstnames); } if (billingAddress != null) { parameters.put("BillingAddress1", billingAddress); } if (billingAddress2 != null) { parameters.put("BillingAddress2", billingAddress2); } if (billingCity != null) { parameters.put("BillingCity", billingCity); } if (billingPostCode != null) { parameters.put("BillingPostCode", billingPostCode); } if (billingCountry != null) { parameters.put("BillingCountry", billingCountry); } if (billingState != null) { parameters.put("BillingState", billingState); } if (billingPhone != null) { parameters.put("BillingPhone", billingPhone); } //end - release parameters try { String successMessage = null; HttpPost httpPost = SagePayUtil.getHttpPost(props.get("releaseUrl"), parameters); HttpResponse response = httpClient.execute(host, httpPost); Map<String, String> responseData = SagePayUtil.getResponseData(response); String status = responseData.get("Status"); String statusDetail = responseData.get("StatusDetail"); resultMap.put("status", status); resultMap.put("statusDetail", statusDetail); //start - payment released if ("OK".equals(status)) { successMessage = "Payment Released"; } //end - payment released //start - release request not formed properly or parameters missing if ("MALFORMED".equals(status)) { successMessage = "Release request not formed properly or parameters missing"; } //end - release request not formed properly or parameters missing //start - invalid information passed in parameters if ("INVALID".equals(status)) { successMessage = "Invalid information passed in parameters"; } //end - invalid information passed in parameters //start - problem at Sagepay if ("ERROR".equals(status)) { successMessage = "Problem at SagePay"; } //end - problem at Sagepay resultMap.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); resultMap.put(ModelService.SUCCESS_MESSAGE, successMessage); } catch (UnsupportedEncodingException uee) { //exception in encoding parameters in httpPost String errorMsg = "Error occured in encoding parameters for HttpPost (" + uee.getMessage() + ")"; Debug.logError(uee, errorMsg, module); resultMap = ServiceUtil.returnError(errorMsg); } catch (ClientProtocolException cpe) { //from httpClient execute String errorMsg = "Error occured in HttpClient execute(" + cpe.getMessage() + ")"; Debug.logError(cpe, errorMsg, module); resultMap = ServiceUtil.returnError(errorMsg); } catch (IOException ioe) { //from httpClient execute or getResponsedata String errorMsg = "Error occured in HttpClient execute or getting response (" + ioe.getMessage() + ")"; Debug.logError(ioe, errorMsg, module); resultMap = ServiceUtil.returnError(errorMsg); } finally { httpClient.getConnectionManager().shutdown(); } return resultMap; }
From source file:com.liato.bankdroid.banking.banks.DanskeBank.java
@Override public void update() throws BankException, LoginException, BankChoiceException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); }//from w w w . ja v a 2 s. co m urlopen = login(); Matcher matcher; matcher = reSessionId.matcher(response); if (matcher.find()) { mSessionId = matcher.group(1); } else { throw new BankException(res.getText(R.string.unable_to_find).toString() + " session id."); } matcher = rePersonnr.matcher(response); if (matcher.find()) { mPersonnr = matcher.group(1); } else { throw new BankException(res.getText(R.string.unable_to_find).toString() + " personnummer."); } try { response = urlopen .open(String.format("https://mobil.danskebank.se/XI?WP=XAS&WO=Konto&WA=KTList&WSES=%s&WAFT=%s", mSessionId, mPersonnr)); matcher = reAccounts.matcher(response); while (matcher.find()) { /* * Capture groups: * GROUP EXAMPLE DATA * 1: Internal acc number? 0123456789 * 2: Account name Danske Direkt Bas * 3: Account number 01234567890 * 4: Balance 1.124,56 * 5: Balance (disp.) 1.124,56 * */ String name = Html.fromHtml(matcher.group(2)).toString().trim(); Account account = new Account(name, Helpers.parseBalance(matcher.group(5)), matcher.group(1).trim()); if (name.contains("ln") || name.contains("Ln")) { account.setType(Account.LOANS); } else { balance = balance.add(Helpers.parseBalance(matcher.group(5))); } accounts.add(account); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } } catch (ClientProtocolException e) { throw new BankException(e.getMessage()); } catch (IOException e) { throw new BankException(e.getMessage()); } finally { super.updateComplete(); } }
From source file:net.evecom.androidecssp.activity.ResponseListActivity.java
/** * /* www. j ava 2 s.c o m*/ */ private void initlist() { new Thread(new Runnable() { @Override public void run() { Message message = new Message(); HashMap<String, String> hashMap = new HashMap<String, String>(); hashMap.put("taskId", taskInfo.get("id").toString()); try { resutArray = connServerForResultPost("jfs/ecssp/mobile/taskresponseCtr/getTaskResponseByTaskId", hashMap); } catch (ClientProtocolException e) { message.what = MESSAGETYPE_02; Log.e("mars", e.getMessage()); } catch (IOException e) { message.what = MESSAGETYPE_02; Log.e("mars", e.getMessage()); } if (resutArray.length() > 0) { try { taskResponseInfos = getObjsInfo(resutArray); if (null == taskResponseInfos) { message.what = MESSAGETYPE_02; } else { message.what = MESSAGETYPE_01; } } catch (JSONException e) { message.what = MESSAGETYPE_02; Log.e("mars", e.getMessage()); } } else { message.what = MESSAGETYPE_02; } Log.v("mars", resutArray); eventListHandler.sendMessage(message); } }).start(); }