List of usage examples for java.lang IllegalStateException printStackTrace
public void printStackTrace()
From source file:th.co.geniustree.osgi.prototype.authen.impl.AuthenStoreImpl.java
private HttpSession validateSession(HttpSession session) { String sessionId = session.getId(); try {// w w w.java 2 s .c om session.getCreationTime(); } catch (IllegalStateException ex) { // it's invalid store.removeSession(sessionId); session = null; ex.printStackTrace(); } return session; }
From source file:com.jaxio.celerio.aspects.ForbiddenWhenBuildingAspect.java
public void checkNotForbidden() { if (isBuilding) { IllegalStateException ise = new IllegalStateException( "Called a " + ForbiddenWhenBuilding.class.getSimpleName() + " method while building"); ise.printStackTrace(); throw ise; }/*from ww w .ja v a 2 s . com*/ }
From source file:com.crimelab.controller.UploadController.java
@RequestMapping(value = "/uploadFile", method = RequestMethod.POST) public ModelAndView showCompositeDetails(Model model, @RequestParam(value = "file") CommonsMultipartFile uploadedFile, @RequestParam(value = "description", required = false) String fileDescription, @RequestParam(value = "sococase", required = false) String soco_case) throws IOException { Calendar currentTimeDate = Calendar.getInstance(); File filePath = new File(fileUploadService.getFileUploadPath() + "\\Files\\"); ModelAndView mv = new ModelAndView("redirect:FileUpload"); if (!filePath.exists()) { filePath.mkdir();// ww w. j av a 2 s .co m } String status = "success"; try { uploadedFile.transferTo(new File(filePath + "\\" + uploadedFile.getOriginalFilename())); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); status = "failure"; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); status = "iofailure"; } int file_type; String fileType = uploadedFile.getContentType(); String getFile = uploadedFile.getOriginalFilename(); String[] fileExtension = getFile.split("\\.", 2); if (fileExtension[1].contains("doc") || fileExtension[1].contains("pdf") || fileExtension[1].contains("xls")) { file_type = 0; } else { file_type = 1; } Files input = new Files(); input.setFile_type(file_type); input.setOrig_file_name(uploadedFile.getOriginalFilename()); input.setFile_name(uploadedFile.getOriginalFilename()); input.setFile_extension(fileExtension[1]); input.setFile_path(filePath.toString() + "\\" + uploadedFile.getOriginalFilename()); input.setDate(currentTimeDate.getTime()); input.setDescription(fileDescription); input.setSoco_case(soco_case); input.setFolder_id(1); // Related field fileUploadService.uploadFile(input); //site settings for fileLocation, to edit mv.addObject("status", status); return mv; }
From source file:com.mingsoft.util.proxy.Result.java
/** * ?gzip?//from w ww . j ava2 s . c om * * @param charSet * ? * @return InputStreamReade; */ public String getContentForGzip(String charset) { if (httpEntity.getContentEncoding().getValue().indexOf("gzip") > -1) { try { GZIPInputStream gzipis = new GZIPInputStream(httpEntity.getContent()); InputStreamReader isr = new InputStreamReader(gzipis, charset); // ????? java.io.BufferedReader br = new java.io.BufferedReader(isr); String tempbf; StringBuffer sb = new StringBuffer(); while ((tempbf = br.readLine()) != null) { sb.append(tempbf); sb.append("\r\n"); } gzipis.close(); isr.close(); return sb.toString(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } return null; }
From source file:im.ene.lab.toro.ext.youtube.YoutubeVideosAdapter.java
/** * Restore and setup state of a Video to current video player *///from ww w.j a v a 2 s . co m @Override public void restoreVideoState(String videoId) { if (mPlayer == null) { return; } Long position = mVideoStates.get(videoId); if (position == null) { position = 0L; } // See {@link android.media.MediaPlayer#seekTo(int)} try { mPlayer.seekTo(position); } catch (IllegalStateException er) { er.printStackTrace(); } }
From source file:edu.pdx.cecs.orcycle.Uploader.java
private boolean uploadOneSegment(long currentNoteId) { boolean result = false; final String postUrl = mCtx.getResources().getString(R.string.post_url); try {//from www.java 2 s .c om URL url = new URL(postUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); // Allow Inputs conn.setDoOutput(true); // Allow Outputs conn.setUseCaches(false); // Don't use a Cached Copy conn.setRequestMethod("POST"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("ENCTYPE", "multipart/form-data"); conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); conn.setRequestProperty("Cycleatl-Protocol-Version", "4"); SegmentData segmentData = SegmentData.fetchSegment(mCtx, currentNoteId); JSONObject json = segmentData.getJSON(); String deviceId = userId; DataOutputStream stream = new DataOutputStream(conn.getOutputStream()); stream.writeBytes(makeContentField("ratesegment", json.toString())); stream.writeBytes(makeContentField("version", String.valueOf(kSaveNoteProtocolVersion))); stream.writeBytes(makeContentField("device", deviceId)); stream.writeBytes(contentFieldPrefix); stream.flush(); stream.close(); int serverResponseCode = conn.getResponseCode(); String serverResponseMessage = conn.getResponseMessage(); Log.v(MODULE_TAG, "HTTP Response is : " + serverResponseMessage + ": " + serverResponseCode); if (serverResponseCode == 201 || serverResponseCode == 202) { segmentData.updateSegmentStatus(SegmentData.STATUS_SENT); result = true; } } catch (IllegalStateException e) { e.printStackTrace(); return false; } catch (IOException e) { e.printStackTrace(); return false; } catch (JSONException e) { e.printStackTrace(); return false; } return result; }
From source file:org.devgateway.toolkit.persistence.spring.DatabaseConfiguration.java
/** * This bean creates the JNDI tree and registers the * {@link javax.sql.DataSource} to this tree. This allows Pentaho Classic * Engine to use a {@link javax.sql.DataSource} ,in our case backed by a * connection pool instead of always opening up JDBC connections. Should * significantly improve performance of all classic reports. In PRD use * connection type=JNDI and name toolkitDS. To use it in PRD you need to add * the configuration to the local PRD. Edit * ~/.pentaho/simple-jndi/default.properties and add the following: * toolkitDS/type=javax.sql.DataSource//from w w w . java 2 s .co m * toolkitDS/driver=org.apache.derby.jdbc.ClientDriver toolkitDS/user=app * toolkitDS/password=app * toolkitDS/url=jdbc:derby://localhost//derby/toolkit * * @return */ @Bean public SimpleNamingContextBuilder jndiBuilder() { SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder(); builder.bind(datasourceJndiName, dataSource()); try { builder.activate(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NamingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return builder; }
From source file:com.sishuok.chapter4.web.servlet.UploadServlet.java
@Override protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { try {//from w w w . ja v a2 s .com //servlet?Partnull //9.0.4.v20130625 ?? System.out.println(req.getParameter("name")); //?Part System.out.println("\n\n==========file1"); Part file1Part = req.getPart("file1"); //?? ?Part InputStream file1PartInputStream = file1Part.getInputStream(); System.out.println(IOUtils.toString(file1PartInputStream)); file1PartInputStream.close(); // ?? System.out.println("\n\n==========file2"); Part file2Part = req.getPart("file2"); InputStream file2PartInputStream = file2Part.getInputStream(); System.out.println(IOUtils.toString(file2PartInputStream)); file2PartInputStream.close(); System.out.println("\n\n==========parameter name"); //???? System.out.println(IOUtils.toString(req.getPart("name").getInputStream())); //Part??? jettyparameters?? System.out.println(req.getParameter("name")); //?? ? req.getInputStream(); ?? System.out.println("\n\n=============all part"); for (Part part : req.getParts()) { System.out.println("\n\n=========name:::" + part.getName()); System.out.println("=========size:::" + part.getSize()); System.out.println("=========content-type:::" + part.getContentType()); System.out .println("=========header content-disposition:::" + part.getHeader("content-disposition")); System.out.println("=========file name:::" + getFileName(part)); InputStream partInputStream = part.getInputStream(); System.out.println("=========value:::" + IOUtils.toString(partInputStream)); // partInputStream.close(); // ? ? ? part.delete(); } } catch (IllegalStateException ise) { // ise.printStackTrace(); String errorMsg = ise.getMessage(); if (errorMsg.contains("Request exceeds maxRequestSize")) { //? } else if (errorMsg.contains("Multipart Mime part file1 exceeds max filesize")) { //? ?? } else { // } } }
From source file:com.popdeem.sdk.core.location.PDLocationManager.java
public void stop() { setState(STATE_STOPPED);/*from ww w. j a v a 2 s . co m*/ if (mGoogleApiClient != null && (mGoogleApiClient.isConnected() || mGoogleApiClient.isConnecting())) { try { LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, mLocationListener); } catch (IllegalStateException e) { e.printStackTrace(); } mGoogleApiClient.disconnect(); } }
From source file:com.inovex.zabbixmobile.activities.fragments.BaseSeverityFilterListPage.java
/** * Updates the list view position using the current position saved in the * list adapter./* ww w. j av a 2 s . c o m*/ */ public void refreshItemSelection() { if (mListAdapter == null) return; int position = mListAdapter.getCurrentPosition(); try { if (getListView() != null) { getListView().setItemChecked(position, true); getListView().setSelection(position); } } catch (IllegalStateException e) { e.printStackTrace(); } }