List of usage examples for java.lang IllegalStateException printStackTrace
public void printStackTrace()
From source file:de.xirp.settings.Settings.java
private static void adSpinnerOptions(Settings settings) { SettingsPage settingsPage = settings.addPage("spinnerpage", "shortdescription", "description"); Option option = settingsPage.addOption("spinner", Option.OptionType.SPINNER); try {//from www . j ava 2 s .c o m option.addNonTranslatableNamedBooleanValue("Nicht bersetzbar", SettingsState.SELECTED); } catch (IllegalStateException e) { e.printStackTrace(); } option = settingsPage.addOption("spinner2", Option.OptionType.SPINNER); try { option.addNumberValue(30.56, SettingsState.SELECTED); } catch (IllegalStateException e) { e.printStackTrace(); } option = settingsPage.addOption("spinner3", Option.OptionType.SPINNER); try { option.addPasswordValue("somekey", "PasswordValue"); } catch (IllegalStateException e) { e.printStackTrace(); } option = settingsPage.addOption("spinner4", Option.OptionType.SPINNER); try { option.addRGBValue("somergb", 255, 255, 0); } catch (IllegalStateException e) { e.printStackTrace(); } option = settingsPage.addOption("spinner5", Option.OptionType.SPINNER); try { option.addSpinnerValue(20.5, -10, 20, 1); } catch (IllegalStateException e) { e.printStackTrace(); } option = settingsPage.addOption("spinner5a", Option.OptionType.SPINNER); try { option.addSpinnerValue(15, -10, 20, 1); } catch (IllegalStateException e) { e.printStackTrace(); } option = settingsPage.addOption("spinner6", Option.OptionType.SPINNER); try { option.addStringValue("somestrg", "Freier String"); } catch (IllegalStateException e) { e.printStackTrace(); } option = settingsPage.addOption("spinner7", Option.OptionType.SPINNER); try { option.addTranslatableNamedBooleanValue("value1", SettingsState.SELECTED, "Ein Argument"); } catch (IllegalStateException e) { e.printStackTrace(); } }
From source file:com.haoqee.chatsdk.net.Utility.java
/** * Read http requests result from response . * /*ww w . j a va 2 s . co m*/ * @param response * : http response by executing httpclient * * @return String : http response content */ public static String read(HttpResponse response) { String result = ""; HttpEntity entity = response.getEntity(); InputStream inputStream; try { inputStream = entity.getContent(); ByteArrayOutputStream content = new ByteArrayOutputStream(); Header header = response.getFirstHeader("Content-Encoding"); if (header != null && header.getValue().toLowerCase().indexOf("gzip") > -1) { inputStream = new GZIPInputStream(inputStream); } // Read response into a buffered stream int readBytes = 0; byte[] sBuffer = new byte[512]; while ((readBytes = inputStream.read(sBuffer)) != -1) { content.write(sBuffer, 0, readBytes); } // Return result from buffered stream result = new String(content.toByteArray(), "UTF-8"); return result; } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
From source file:com.ibm.team.build.internal.hjplugin.util.HttpUtils.java
/** * Print out the HTTP Response body - for debugging purposes *//*from ww w . ja va 2 s. c o m*/ @SuppressWarnings("unused") private static void printResponseBody(CloseableHttpResponse response) { if (LOGGER.isLoggable(Level.FINER)) { HttpEntity entity = response.getEntity(); if (entity == null) return; StringBuffer logMessage = new StringBuffer("Response Body:"); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(entity.getContent())); String line = reader.readLine(); while (line != null) { logMessage.append(NEW_LINE).append(line); line = reader.readLine(); } LOGGER.finer(logMessage.toString()); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { // ignore } } } } }
From source file:com.hrm.controller.RegisterController.java
/** * author qwc/*from w w w. j a v a 2s . c om*/ * 2017413?8:49:23 * @param request * @param file * @param url * @param num * @param Id * @param foldername * @return * @throws IOException * ?request.getSession().getServletContext().getRealPath("/") */ public static String SaveImg(HttpServletRequest request, MultipartFile file, String url, int num, String Id, String foldername) throws IOException { String uploadUrl = "C:/" + "HRM/" + "upload/image/" + foldername + "/"; System.out.println(":" + uploadUrl); File dir = new File(uploadUrl); if (!dir.exists()) { dir.mkdirs(); } url = Id + num + DateUtil.dateToStr(new Date(), DateUtil.DATE_TIME_NO_SLASH) + ".jpg"; File targetFile = new File(uploadUrl + url); /*url="http://localhost:8080/HRM/"+"upload/image/companyinfo"+"/"+url;*/ uploadUrl = "/HRM/upload/image/" + foldername + "/" + url; try { file.transferTo(targetFile); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } return uploadUrl; }
From source file:org.jreader.reader.Reader.java
public void start() { HttpConnector conn = new HttpConnector(uri); try {/*from w w w . j av a 2s . c o m*/ conn.start(); if (uriType == Rss) { readRss(conn.getEntity().getContent()); } } catch (ClientProtocolException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (DataSourceException e) { e.printStackTrace(); } // // String // contentType=conn.getHeader(HttpConnector.HEADER_CONTENT_TYPE).getValue(); // if(contentType.endsWith("xml")){// rss ? // // }else if(contentType.endsWith("html")){// blog // // } }
From source file:com.freshplanet.ane.GoogleCloudStorageUpload.functions.UploadVideoToServer.java
@Override public FREObject call(FREContext ctx, FREObject[] args) { Log.d(TAG, "[UploadVideoToServer] Entering call()"); String localURL = null;//from w w w . jav a2 s .co m String uploadURL = null; JSONObject uploadParamsJSON = null; double maxDuration = 30.0; try { localURL = args[0].getAsString(); uploadURL = args[1].getAsString(); uploadParamsJSON = new JSONObject(args[2].getAsString()); maxDuration = args[3].getAsDouble(); Log.d(TAG, "[UploadVideoToServer] localURL: " + localURL + " uploadURL: " + uploadURL + " uploadParamsJSON: " + uploadParamsJSON); } catch (IllegalStateException e) { e.printStackTrace(); } catch (FRETypeMismatchException e) { e.printStackTrace(); } catch (FREInvalidObjectException e) { e.printStackTrace(); } catch (FREWrongThreadException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } if (localURL != null && uploadURL != null && uploadParamsJSON != null) { new UploadToGoogleCloudStorageAsyncTask(uploadParamsJSON, localURL).setVideoMaxDuration(maxDuration) .execute(uploadURL); } Log.d(TAG, "[UploadVideoToServer] Exiting call()"); return null; }
From source file:com.chinalbs.service.impl.FileServiceImpl.java
@Override public String saveImage(MultipartFile[] multipartFile) { String webPath = null;/*from www. j a va 2 s . c o m*/ if (multipartFile == null || multipartFile.length == 0) { return null; } try { for (MultipartFile multiFile : multipartFile) { if (multiFile.getSize() > ImageMaxSize) { continue; } String uuid = UUID.randomUUID().toString(); String sourcePath = uploadPath + File.separator + "src_" + uuid + "." + FilenameUtils.getExtension(multiFile.getOriginalFilename()); // webPath = uuid + "." + DEST_EXTENSION; webPath = File.separator + "src_" + uuid + "." + FilenameUtils.getExtension(multiFile.getOriginalFilename()); String storePath = uploadPath + File.separator + uuid + "." + DEST_EXTENSION; ; File tempFile = new File(System.getProperty("java.io.tmpdir") + File.separator + "upload_" + UUID.randomUUID() + ".tmp"); if (!tempFile.getParentFile().exists()) { tempFile.getParentFile().mkdirs(); } multiFile.transferTo(tempFile); proccessImage(tempFile, sourcePath, storePath, licenseImageWidth, licenseImageHeight, true); } } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return webPath; }
From source file:org.apache.cordova.smaato.Smaato.java
/** * Get advertiser info from google play store * * @return /*from www.j ava 2 s. c om*/ */ public JSONObject getAdInfo() { AdvertisingIdClient.Info adInfo; JSONObject r = new JSONObject(); try { adInfo = AdvertisingIdClient.getAdvertisingIdInfo(this.cordova.getActivity()); r.put("googleadid", adInfo.getId()); r.put("isLimitAdTrackingEnabled", adInfo.isLimitAdTrackingEnabled()); } catch (IllegalStateException e) { e.printStackTrace(); } catch (GooglePlayServicesRepairableException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (GooglePlayServicesNotAvailableException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return r; }
From source file:info.martinmarinov.dvbservice.dialogs.ShowOneInstanceFragmentDialog.java
public void showOneInstanceOnly(FragmentManager fragmentManager, String tag, Bundle args) { // ensure only one instance is present and close existing instances FragmentTransaction ft = fragmentManager.beginTransaction(); Fragment prev = fragmentManager.findFragmentByTag(tag); if (prev != null) ft.remove(prev);//from w w w .ja va 2 s . c o m ft.addToBackStack(null); // set arguments and launch setArguments(args); try { show(ft, tag); } catch (IllegalStateException e) { // If we try to show an exception while driver is dying e.printStackTrace(); } }
From source file:com.example.topsongsapp.view.ImageDialogFragment.java
@Override public void dismiss() { try {/*w ww . java 2 s . c om*/ isDismissible = true; super.dismiss(); // Log.d(getClass().getSimpleName(), "Dialog dismissed!"); } catch (IllegalStateException ilse) { ilse.printStackTrace(); } }