List of usage examples for android.net ParseException getMessage
public String getMessage()
From source file:watch.oms.omswatch.actioncenter.helpers.WatchPostAsyncTaskHelper.java
/** * @param clientTableName//from w ww.ja v a 2 s. co m * @param postResponse * @return */ private String processHttpURLConnectionPostResponse(String clientTableName, String postResponse) { String response = null; String jsonString = null; JSONObject responseJSONObject = null; try { //jsonString = EntityUtils.toString(httpEntity); JSONObject responseWebServiceJSON = new JSONObject(postResponse); responseJSONObject = responseWebServiceJSON.getJSONObject(OMSMessages.RESPONSE_STRING.getValue()); String dbProcessDuration = responseWebServiceJSON.getString("dbprocessduration"); String serverProcessDuration = responseWebServiceJSON.getString("serverprocessduration"); if (!TextUtils.isEmpty(dbProcessDuration)) { OMSApplication.getInstance().setDatabaseProcessDuration(dbProcessDuration); } if (!TextUtils.isEmpty(serverProcessDuration)) { OMSApplication.getInstance().setServerProcessDuration(serverProcessDuration); } /* "dbprocessduration": 297, "serverprocessduration": 297 String d*/ } catch (JSONException jex) { if (jex != null && jex.getMessage().contains("No value for " + (OMSMessages.RESPONSE_STRING.getValue()))) { Log.d(TAG, "response key is not present. Assuming json response contains data set"); // This changes are for Oasis Project. # Start DataParser dataParser = new DataParser(context); // This changes are for Oasis Project. # End dataParser.parseAndUpdate(jsonString); response = "BLPostSuccess"; } else { Log.e(TAG, "Exception occurred while reading the json response. Error is:" + jex.getMessage()); } return response = OMSMessages.ACTION_CENTER_FAILURE.getValue(); } catch (ParseException e) { Log.e(TAG, "Exception occurred while parsing the json response. Error is:" + e.getMessage()); } try { String code = responseJSONObject.getString(OMSMessages.CODE.getValue()); if (code.equals(OMSMessages.DEFAULT_JSON_CODE.getValue())) { Log.i(TAG, "Response Message :" + responseJSONObject.getString(OMSMessages.MESSAGE.getValue())); double processedModifiedDate = responseJSONObject.getDouble(OMSMessages.PROCESSED_DATE.getValue()); parseJSONObject(jsonPayLoad.toString(), OMSDatabaseConstants.STATUS_TYPE_FINISHED, processedModifiedDate); progressString = context.getResources().getString(R.string.post_success); response = "BLPostSuccess"; } else { Log.e(TAG, "Response Message :" + responseJSONObject.getString(OMSMessages.MESSAGE.getValue())); try { Log.e(TAG, "Response Message Additional:" + responseJSONObject.getString(OMSMessages.ERROR_ADDITIONAL_MESSAGE.getValue())); } catch (JSONException je) { // ignore if field is not available } response = OMSMessages.ACTION_CENTER_FAILURE.getValue(); ContentValues contentValues = new ContentValues(); contentValues.put(OMSDatabaseConstants.TRANSACTION_QUEUE_STATUS, OMSDatabaseConstants.ACTION_STATUS_TRIED); contentValues.put(OMSDatabaseConstants.TRANSACTION_QUEUE_SERVER_URL, serviceUrl); contentValues.put(OMSDatabaseConstants.TRANSACTION_QUEUE_DATA_TABLE_NAME, tableName); contentValues.put(OMSDatabaseConstants.TRANSACTION_QUEUE_TYPE, OMSDatabaseConstants.POST_TYPE_REQUEST); contentValues.put(OMSDatabaseConstants.BL_SCHEMA_NAME, schemaName); actionCenterHelper.insertOrUpdateTransactionFailQueue(contentValues, uniqueRowId, configAppId); } } catch (JSONException e) { Log.e(TAG, "Exception occurred while updating the Action Queue status." + e.getMessage()); e.printStackTrace(); } catch (IllegalFormatConversionException e) { Log.e(TAG, "Exception occurred while updating the Action Queue status." + e.getMessage()); e.printStackTrace(); } return response; }