List of usage examples for java.lang Exception getStackTrace
public StackTraceElement[] getStackTrace()
From source file:com.baidu.fsg.uid.utils.NamingThreadFactory.java
/** * Get the method invoker's class name/* w w w .ja v a 2 s. c o m*/ * * @param depth * @return */ private String getInvoker(int depth) { Exception e = new Exception(); StackTraceElement[] stes = e.getStackTrace(); if (stes.length > depth) { return ClassUtils.getShortClassName(stes[depth].getClassName()); } return getClass().getSimpleName(); }
From source file:com.necl.login.controller.HomeController.java
@RequestMapping(value = "/resetPassword_success", method = RequestMethod.POST) public ModelAndView resetPassword_success(@RequestParam String oldPassword, @RequestParam String newPassword, @RequestParam String confirm_newPassword) { ModelAndView model = new ModelAndView(); try {/*from w w w .j a v a2 s .c o m*/ String reset = userService.resetPassword(oldPassword, newPassword, confirm_newPassword); if (reset.equals("Password was incorrect!")) { System.out.println("Password was incorrect!"); model.addObject("message", "Password was incorrect!"); } else if (reset.equals("Your new password and confirm password do not match!")) { model.addObject("message", "Your new password and confirm password do not match!"); } else if (reset.equals("Your password has been reset successfully!")) { model.addObject("message", "Your password has been reset successfully!"); } else { model.addObject("message", "ERROR!"); } } catch (Exception ex) { ex.getStackTrace(); } model.setViewName("resetpassword"); return model; }
From source file:edu.cornell.mannlib.vitro.webapp.controller.edit.NamespacePrefixRetryController.java
public void doGet(HttpServletRequest request, HttpServletResponse response) { if (!isAuthorizedToDisplayPage(request, response, SimplePermission.USE_MISCELLANEOUS_ADMIN_PAGES.ACTION)) { return;// w w w . j a va 2s . c o m } //create an EditProcessObject for this and put it in the session EditProcessObject epo = super.createEpo(request); if (request.getParameter("prefix") != null) { epo.setAction("update"); request.setAttribute("_action", "update"); } else { epo.setAction("insert"); request.setAttribute("_action", "insert"); } RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP); request.setAttribute("editAction", "namespacePrefixOp"); request.setAttribute("bodyJsp", "/templates/edit/formBasic.jsp"); request.setAttribute("scripts", "/templates/edit/formBasic.js"); request.setAttribute("formJsp", "/templates/edit/specific/namespacePrefix_retry.jsp"); request.setAttribute("title", "Edit Namespace Prefix Mapping"); setRequestAttributes(request, epo); try { rd.forward(request, response); } catch (Exception e) { log.error(this.getClass().getName() + " could not forward to view."); log.error(e.getMessage()); log.error(e.getStackTrace()); } }
From source file:se.inera.intyg.intygstjanst.web.integration.GetCertificateResponderImpl.java
protected void setCertificateBody(CertificateHolder certificate, GetCertificateResponseType response) { try {//from ww w. ja v a 2s . co m RegisterCertificateType jaxbObject = JAXB.unmarshal( new StringReader(certificate.getOriginalCertificate()), RegisterCertificateType.class); response.setIntyg(jaxbObject.getIntyg()); response.getIntyg().getStatus() .addAll(CertificateStateHolderConverter.toIntygsStatusType(certificate.getCertificateStates())); } catch (Exception e) { LOGGER.error("Error while converting in GetCertificate for id: {} with stacktrace: {}", certificate.getId(), e.getStackTrace()); Throwables.propagate(e); } }
From source file:com.esri.geoevent.solutions.processor.geometry.PolygonProcessor.java
@Override public GeoEvent process(GeoEvent evt) { try {// w w w . j ava2 s.c om int inwkid = (Integer) properties.get("wkidin").getValue(); int outwkid = (Integer) properties.get("wkidout").getValue(); //int bufferwkid = (Integer) properties.get("wkidbuffer").getValue(); srIn = SpatialReference.create(inwkid); //srBuffer = SpatialReference.create(bufferwkid); srOut = SpatialReference.create(outwkid); String eventfld = properties.get("polyfld").getValue().toString(); String[] arr = eventfld.split(":"); String geostring = (String) evt.getField(arr[1]); String format = properties.get("polyformat").getValue().toString(); com.esri.ges.spatial.Geometry geo = null; if (format.equals("Json")) { geo = constructJsonGeometry(geostring); } else if (format.equals("CAP")) { geo = constructCAPGeometry(geostring); } evt.setGeometry(geo); return evt; } catch (Exception ex) { LOG.error(ex.getMessage()); LOG.error(ex.getStackTrace()); return null; } }
From source file:com.joshdrummond.webpasswordsafe.android.GetCurrentPassword.java
private String parseResponse(String responseSOAP) { String response = ""; try {/*from w w w . ja v a 2 s . c o m*/ SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); GetCurrentPasswordHandler handler = new GetCurrentPasswordHandler(); xr.setContentHandler(handler); xr.parse(new InputSource(new StringReader(responseSOAP))); response = handler.getParsedData(); } catch (Exception e) { response = "ERROR parsing: " + Arrays.deepToString(e.getStackTrace()); } return response; }
From source file:com.netcetera.vlab.VLabProcessor.java
@Override public void process(ProgressMonitor pm) throws ProcessorException { try {//from ww w.j a va 2 s . c om delegate.process(pm, getRequest()); } catch (Exception e) { throw new ProcessorException( e.getMessage() + "\n__________\n" + StringUtils.join(e.getStackTrace(), "\n")); } }
From source file:fi.csc.emrex.ncp.JsonController.java
@RequestMapping(value = "/api/fullelmo", method = RequestMethod.GET) @ResponseBody//www. j av a 2s.c o m public String getFullElmoJSON() { log.info("getting FullELmo"); try { ElmoParser parser = (ElmoParser) context.getSession().getAttribute("elmo"); String xmlString; xmlString = parser.getCourseData(); log.debug(xmlString); JSONObject json = XML.toJSONObject(xmlString); return json.toString(); } catch (Exception e) { log.error(e.getMessage()); StackTraceElement elements[] = e.getStackTrace(); Map<String, Object> error = new HashMap<String, Object>(); Map<String, Object> log = new HashMap<String, Object>(); error.put("message", e.getMessage()); for (int i = 0, n = elements.length; i < n; i++) { log.put(elements[i].getFileName() + " " + elements[i].getLineNumber(), elements[i].getMethodName()); } error.put("stack", log); return new JSONObject(error).toString(); } }
From source file:com.netcetera.vlab.VLabProcessor.java
public VLabProcessor() { auxdataInstallDir = super.getDefaultAuxdataInstallDir(); _logger.info("instantiating VLabProcessor delegate..."); try {// w w w . ja v a 2 s. co m installAuxdata(); delegate = (IVLabProcessor) VLabJythonFactory.getJythonObject(JYTHON_PROC_ICLASSNAME, new File(auxdataInstallDir, JYTHON_IMPL_CLASSNAME + ".py").getAbsolutePath(), JYTHON_IMPL_CLASSNAME); } catch (Exception e) { throw new RuntimeException( e.getMessage() + "\n__________\n" + StringUtils.join(e.getStackTrace(), "\n")); } _progressBarDepth = 3; setDefaultHelpId(HELP_ID); }
From source file:inn.eatery.server.ServerHandler.java
FullHttpResponse handleRequest(ChannelHandlerContext ctx, FullHttpRequest req) { QueryStringDecoder resource = new QueryStringDecoder(req.uri()); String contentStr = req.content().toString(CharsetUtil.UTF_8); if (resource.path().equals("/login")) { JSONObject content = new JSONObject(contentStr); userId = content.getString("userId"); authorized = true;//w w w .j a v a 2s . c om } if (!authorized) { return unauthAccess; } try { dbMgr = MongoDBManager.getInstance(); } catch (Exception e) { l.error("Could not get DB Manager {} {}", e.getStackTrace(), e.getMessage()); } if (resource.path().equals("/events")) { if (req.method() == HttpMethod.POST) { JSONArray events = new JSONArray(contentStr); for (int i = 0, size = events.length(); i < size; i++) { dbMgr.insertEvent(events.getJSONObject(i)); l.info("Handled event publish !! {}", events.getJSONObject(i)); } } else { // get events JSONObject dbquery = new JSONObject(contentStr); } } return null; }