List of usage examples for java.lang IllegalStateException printStackTrace
public void printStackTrace()
From source file:com.wso2.rfid.apicalls.HttpClient.java
public String getResponsePayload(HttpResponse response) throws IOException { StringBuilder buffer = new StringBuilder(); InputStream in = null;/* www. j a va2s . co m*/ try { if (response.getEntity() != null) { in = response.getEntity().getContent(); int length; byte[] tmp = new byte[2048]; while ((length = in.read(tmp)) != -1) { buffer.append(new String(tmp, 0, length)); } } } catch (IllegalStateException e) { e.printStackTrace(); } finally { if (in != null) { in.close(); } } return buffer.toString(); }
From source file:de.htwg_konstanz.in.uce.hp.parallel.integration_test.TargetMock.java
public TargetMock(SocketAddress mediatorAddress, String regKey) throws IOException { target = new HolePunchingTarget(mediatorAddress, regKey); try {/*w w w.j a v a2s.co m*/ target.start(); } catch (IllegalStateException e) { logger.error("IllegalStateException: {}", e); e.printStackTrace(); throw e; } catch (IOException e) { logger.error("IOException: {}", e); e.printStackTrace(); throw e; } }
From source file:com.freshplanet.inapppurchase.RemovePurchaseFromQueuePurchase.java
@Override public FREObject call(FREContext arg0, FREObject[] arg1) { Log.d(TAG, "starting confirming purchases"); String purchaseStr = null;// w w w.j a v a 2s.c o m try { purchaseStr = arg1[0].getAsString(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (FRETypeMismatchException e) { e.printStackTrace(); } catch (FREInvalidObjectException e) { e.printStackTrace(); } catch (FREWrongThreadException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } Log.d(TAG, "purchase id : " + purchaseStr); String token = null; try { token = arg1[1].getAsString(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (FRETypeMismatchException e) { e.printStackTrace(); } catch (FREInvalidObjectException e) { e.printStackTrace(); } catch (FREWrongThreadException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } IabHelper mHIabHelper = ExtensionContext.mHelper; if (mHIabHelper == null) { Log.e(TAG, "iabHelper is not init"); return null; } Purchase p = new Purchase(purchaseStr, token); mHIabHelper.consumeAsync(p, mConsumeFinishedListener); return null; }
From source file:com.snippet.app.DialogActivity.java
public void dismissDialogFragment() { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); DialogFragment prev = (DialogFragment) getSupportFragmentManager().findFragmentByTag(DIALOG_TAG); if (prev != null) { try {/* w w w. j a v a 2 s .c o m*/ prev.dismiss(); } catch (IllegalStateException e) { // Just ignore this exception e.printStackTrace(); } ft.remove(prev); ft.commitAllowingStateLoss(); } }
From source file:com.example.dailyphoto.oath.EasyHttpClient.java
public String get(String url) { HttpGet getReq = new HttpGet(url); InputStream content = null;/*from ww w . j av a 2s . c om*/ try { content = execute(getReq).getEntity().getContent(); ByteArrayOutputStream bout = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int len; while ((len = content.read(buf)) > 0) { bout.write(buf, 0, len); } content.close(); return bout.toString(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
From source file:de.incoherent.suseconferenceclient.tasks.GetConferencesTask.java
@Override protected ArrayList<Conference> doInBackground(Void... params) { JSONObject reply = null;/*from w w w . java2s.com*/ ArrayList<Conference> ret = new ArrayList<Conference>(); try { reply = HTTPWrapper.get(mUrl); JSONArray conferences = reply.getJSONArray("conferences"); int len = conferences.length(); for (int i = 0; i < len; i++) { JSONObject jsonCon = conferences.getJSONObject(i); Conference newCon = new Conference(); newCon.setGuid(jsonCon.getString("guid")); newCon.setName(jsonCon.getString("name")); newCon.setDescription(jsonCon.getString("description")); newCon.setYear(jsonCon.getInt("year")); newCon.setName(jsonCon.getString("name")); newCon.setDateRange(jsonCon.getString("date_range")); newCon.setUrl(jsonCon.getString("url")); newCon.setSocialTag(jsonCon.getString("socialtag")); newCon.setIsCached(false); long sqlId = mDb.getConferenceIdFromGuid(newCon.getGuid()); if (sqlId == -1) { sqlId = mDb.addConference(newCon); if (jsonCon.has("revision")) mDb.setLastUpdateValue(sqlId, jsonCon.getInt("revision")); } newCon.setSqlId(sqlId); ret.add(newCon); } } catch (IllegalStateException e) { e.printStackTrace(); } catch (SocketException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } try { Thread.sleep(13000); } catch (Exception e) { } ; return ret; }
From source file:com.freshplanet.ane.GoogleCloudStorageUpload.functions.UploadBinaryFileToServer.java
@Override public FREObject call(FREContext ctx, FREObject[] args) { Log.d(TAG, "[UploadImageToServer] Entering call()"); String localURL = null;/* w w w. jav a2 s.c o m*/ String uploadURL = null; JSONObject uploadParamsJSON = null; Log.d(TAG, "[UploadImageToServer] try catch()"); try { localURL = args[0].getAsString(); uploadURL = args[1].getAsString(); uploadParamsJSON = new JSONObject(args[2].getAsString()); Log.d(TAG, "[UploadImageToServer] localURL: " + localURL + " uploadURL: " + uploadURL + " uploadParamsJSON: " + uploadParamsJSON); } catch (IllegalStateException e) { Log.e(TAG, e.toString()); e.printStackTrace(); } catch (FRETypeMismatchException e) { Log.e(TAG, e.toString()); e.printStackTrace(); } catch (FREInvalidObjectException e) { Log.e(TAG, e.toString()); e.printStackTrace(); } catch (FREWrongThreadException e) { Log.e(TAG, e.toString()); e.printStackTrace(); } catch (JSONException e) { Log.e(TAG, e.toString()); e.printStackTrace(); } catch (Exception e) { Log.e(TAG, e.toString()); e.printStackTrace(); } if (localURL != null && uploadURL != null && uploadParamsJSON != null) { new UploadToGoogleCloudStorageAsyncTask(uploadParamsJSON, localURL).execute(uploadURL); } Log.d(TAG, "[UploadImageToServer] Exiting call()"); return null; }
From source file:com.freshplanet.ane.GoogleCloudStorageUpload.functions.UploadImageToServer.java
@Override public FREObject call(FREContext ctx, FREObject[] args) { Log.d(TAG, "[UploadImageToServer] Entering call()"); String localURL = null;/* w w w . j av a 2s. c om*/ String uploadURL = null; JSONObject uploadParamsJSON = null; int maxWidth = -1; int maxHeight = -1; Log.d(TAG, "[UploadImageToServer] try catch()"); try { localURL = args[0].getAsString(); uploadURL = args[1].getAsString(); uploadParamsJSON = new JSONObject(args[2].getAsString()); maxWidth = args[3].getAsInt(); maxHeight = args[4].getAsInt(); Log.d(TAG, "[UploadImageToServer] localURL: " + localURL + " uploadURL: " + uploadURL + " uploadParamsJSON: " + uploadParamsJSON); } catch (IllegalStateException e) { Log.e(TAG, e.toString()); e.printStackTrace(); } catch (FRETypeMismatchException e) { Log.e(TAG, e.toString()); e.printStackTrace(); } catch (FREInvalidObjectException e) { Log.e(TAG, e.toString()); e.printStackTrace(); } catch (FREWrongThreadException e) { Log.e(TAG, e.toString()); e.printStackTrace(); } catch (JSONException e) { Log.e(TAG, e.toString()); e.printStackTrace(); } catch (Exception e) { Log.e(TAG, e.toString()); e.printStackTrace(); } if (localURL != null && uploadURL != null && uploadParamsJSON != null) { new UploadToGoogleCloudStorageAsyncTask(uploadParamsJSON, localURL).setMaxImageSize(maxWidth, maxHeight) .execute(uploadURL); } Log.d(TAG, "[UploadImageToServer] Exiting call()"); return null; }
From source file:com.google.resting.component.impl.ServiceResponse.java
public ServiceResponse(HttpResponse response, EncodingTypes charset) { assert response != null : "HttpResponse should not be null"; InputStream inputStream = null; try {// w w w .j a va 2s .c o m if (response != null) { this.statusCode = response.getStatusLine().getStatusCode(); this.responseHeaders = response.getAllHeaders(); inputStream = response.getEntity().getContent(); this.contentData = IOUtils.writeToContentData(inputStream, charset); } //if(response) else { throw new NullPointerException( "HTTP response is null. Please check availability of endpoint service."); } } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(inputStream); } //try }
From source file:com.javielinux.api.APILoader.java
public void execute(BaseRequest baseRequest) { this.baseRequest = baseRequest; try {// w w w . j a va2 s. co m if (loaderManager.getLoader(baseRequest.hashCode()) == null) { Log.d(Utils.TAG, "initLoader: " + baseRequest.getClass().getName() + ": " + baseRequest.hashCode()); loaderManager.initLoader(baseRequest.hashCode(), null, this); } else { Log.d(Utils.TAG, "restartLoader: " + baseRequest.getClass().getName() + ": " + baseRequest.hashCode()); loaderManager.restartLoader(baseRequest.hashCode(), null, this); } } catch (IllegalStateException e) { e.printStackTrace(); } catch (RejectedExecutionException e) { e.printStackTrace(); } }