List of usage examples for java.lang Exception getStackTrace
public StackTraceElement[] getStackTrace()
From source file:com.earldouglas.xjdl.io.LicenseLoader.java
public License loadLicense() { try {//from w w w . j a va2 s .co m return readLicense(); } catch (Exception e) { LicenseException licenseException = new LicenseInvalidException(); licenseException.setStackTrace(e.getStackTrace()); throw (licenseException); } }
From source file:com.stephengream.simplecms.authentication.SimpleCmsUserDetailsService.java
@Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { CmsUser u = userDao.loadByUsername(username); if (u == null) { throw new UsernameNotFoundException(username + " not found"); }//from w ww. j a va2 s .co m HashSet<GrantedAuthority> roles = new HashSet<>(); try { final Set<Role> userRoles = u.getRoles(); if (userRoles != null && userRoles.size() > 0) { for (Role role : userRoles) { roles.add(new SimpleGrantedAuthority(role.getRoleName())); } } } catch (Exception e) { Logger.getLogger(UserDetails.class.getName()).log(Logger.Level.INFO, e.getStackTrace()); } return new User(u.getUsername(), u.getPassHash(), roles); }
From source file:com.moss.error_reporting.server.ReportingServiceImpl.java
public List<ErrorReportSummary> listReportSummaries() { List<ErrorReportSummary> summaries = new LinkedList<ErrorReportSummary>(); String[] namesList = documentRepository.getDocumentsDirLocation().list(); for (String name : namesList) { try {//from w w w . j ava 2s .c om ReportId id = new ReportId(name); log.debug("version 0.0.3"); log.debug("found report with id: " + name); // ErrorReport report = getReport(new ReportId(name)); File file = documentRepository.path(id.getUuid()); Instant lastModified = new Instant(file.lastModified()); summaries.add(new ErrorReportSummary(id, lastModified)); } catch (Exception ex) { log.info(ex.getStackTrace()); } } return summaries; }
From source file:com.esri.geoevent.solutions.processor.geometry.RangeFanProcessorService.java
public void start() { try {/* w w w .j a v a2 s .c om*/ RangeFanProcessorDefinition rfpDef = (RangeFanProcessorDefinition) definition; rfpDef.setManager(manager); } catch (Exception e) { LOG.error("Geometry processor"); LOG.error(e.getMessage()); LOG.error(e.getStackTrace()); } }
From source file:com.stratio.qa.utils.GosecSSOUtils.java
/** * This method provide dcos and sso token to be used to generate client cookie * @return cookieToken list of token generated * @throws Exception exception/*from ww w. j a v a2 s .co m*/ */ public HashMap<String, String> ssoTokenGenerator() throws Exception { String protocol = "https://"; HashMap<String, String> cookieToken = new HashMap<>(); SSLContext sslContext = SSLContext.getInstance("SSL"); // set up a TrustManager that trusts everything sslContext.init(null, ALL_TRUSTING_TRUST_MANAGER, new SecureRandom()); HttpClientContext context = HttpClientContext.create(); HttpGet httpGet = new HttpGet(protocol + ssoHost + "/login"); HttpClient client = HttpClientBuilder.create().setSslcontext(sslContext) .setRedirectStrategy(new LaxRedirectStrategy()) .setDefaultRequestConfig(RequestConfig.custom().setCircularRedirectsAllowed(true).build()).build(); try { HttpResponse firstResponse = client.execute(httpGet, context); logger.debug(firstResponse.getStatusLine().toString()); Document doc = Jsoup.parse(getStringFromIS(firstResponse.getEntity().getContent())); Elements code = doc.select("[name=lt]"); String loginCode = code.attr("value"); String executionCode = doc.select("[name=execution]").attr("value"); for (Header oneHeader : firstResponse.getAllHeaders()) { logger.debug(oneHeader.getName() + ":" + oneHeader.getValue()); } URI redirect = context.getRedirectLocations().get(context.getRedirectLocations().size() - 1); List<NameValuePair> params = new ArrayList<>(); params.add(new BasicNameValuePair("_eventId", "submit")); params.add(new BasicNameValuePair("submit", "LOGIN")); params.add(new BasicNameValuePair("username", userName)); params.add(new BasicNameValuePair("password", passWord)); params.add(new BasicNameValuePair("lt", loginCode)); params.add(new BasicNameValuePair("execution", executionCode)); HttpPost httpPost = new HttpPost(redirect); httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse secondResponse = client.execute(httpPost, context); for (Header oneHeader : secondResponse.getAllHeaders()) { logger.debug(oneHeader.getName() + ":" + oneHeader.getValue()); } HttpGet managementGet = new HttpGet(protocol + ssoHost + managementHost); client.execute(managementGet, context); for (Cookie oneCookie : context.getCookieStore().getCookies()) { logger.debug(oneCookie.getName() + ":" + oneCookie.getValue()); cookieToken.put(oneCookie.getName(), oneCookie.getValue()); } } catch (Exception e) { e.getStackTrace(); } return cookieToken; }
From source file:com.sastix.cms.common.services.web.ExceptionHandlingController.java
@ExceptionHandler({ CommonException.class }) public void handleBadRequests(HttpServletRequest request, HttpServletResponse response, Exception e) throws IOException { LOG.error("Bad request: {} from {}, Exception: {} {}", request.getRequestURI(), request.getRemoteHost(), e.getStackTrace()[0].toString(), e.getLocalizedMessage()); response.sendError(HttpStatus.BAD_REQUEST.value(), e.getLocalizedMessage()); }
From source file:com.esri.geoevent.solutions.processor.geometry.QueryReportProcessorService.java
public void start() { QueryReportProcessorDefinition qDef = (QueryReportProcessorDefinition) definition; try {/*from w w w . ja v a 2 s .com*/ qDef.setManager(manager); qDef.setConnectionManager(connectionManager); } catch (Exception e) { LOG.error("Geometry processor"); LOG.error(e.getMessage()); LOG.error(e.getStackTrace()); } }
From source file:edu.cornell.mannlib.vitro.webapp.controller.jena.RDFUploadFormController.java
@Override public void doPost(HttpServletRequest request, HttpServletResponse response) { if (!isAuthorizedToDisplayPage(request, response, SimplePermission.USE_ADVANCED_DATA_TOOLS_PAGES.ACTION)) { return;//w w w .j a va2 s . c o m } VitroRequest vreq = new VitroRequest(request); RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP); request.setAttribute("bodyJsp", "/templates/edit/specific/upload_rdf.jsp"); request.setAttribute("title", "Ingest RDF Data"); request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + vreq.getAppBean().getThemeDir() + "css/edit.css\"/>"); 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:org.apache.kylin.job.SampleCubeSetupTest.java
@Before public void before() throws Exception { String confPaths = System.getenv("KYLIN_HBASE_CONF_PATH"); System.out.println("The conf paths is " + confPaths); if (confPaths != null) { String[] paths = confPaths.split(":"); for (String path : paths) { if (!StringUtils.isEmpty(path)) { try { ClassUtil.addClasspath(new File(path).getAbsolutePath()); } catch (Exception e) { System.out.println(e.getLocalizedMessage()); System.out.println(e.getStackTrace()); }/*from ww w . j a v a2 s. c o m*/ } } } }
From source file:app.web.AbstractController.java
@ExceptionHandler(Exception.class) public ModelMap handleAllExceptions(Exception e) { if (!ConfigurationUtils.getString("mode").startsWith("DEV")) { EmailUtils.send(e.getMessage(), Arrays.toString(e.getStackTrace()).replaceAll(", ", "\n")); }//from w ww. ja v a 2s.co m return new ModelMap("exception", e); }