List of usage examples for java.lang Exception getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:com.clustercontrol.jobmanagement.session.JobRunManagementBean.java
/** * ???<BR>//www. ja va 2s . c o m /** * CreateJobSessionTaskFactory?? * */ public static void makeSession(JobSessionRequestMessage message) { String sessionId = message.getSessionId(); String jobunitId = message.getJobunitId(); String jobId = message.getJobId(); OutputBasicInfo info = message.getOutputBasicInfo(); JobTriggerInfo triggerInfo = message.getTriggerInfo(); JpaTransactionManager jtm = null; ILock lock = getLock(sessionId); try { lock.writeLock(); try { jtm = new JpaTransactionManager(); jtm.begin(); JobMstEntity job = QueryUtil.getJobMstPK(jobunitId, jobId); //JobSession? JobSessionEntity jobSessionEntity = new JobSessionEntity(sessionId); // ?? jtm.checkEntityExists(JobSessionEntity.class, jobSessionEntity.getSessionId()); jobSessionEntity.setJobunitId(jobunitId); jobSessionEntity.setJobId(job.getId().getJobId()); jobSessionEntity.setScheduleDate(HinemosTime.currentTimeMillis()); jobSessionEntity.setOperationFlg(0); jobSessionEntity.setTriggerType(triggerInfo.getTrigger_type()); jobSessionEntity.setTriggerInfo(triggerInfo.getTrigger_info()); m_log.trace("jobSessionEntity SessionId : " + jobSessionEntity.getSessionId()); m_log.trace("jobSessionEntity JobUnitId : " + jobSessionEntity.getJobunitId()); m_log.trace("jobSessionEntity JobId : " + jobSessionEntity.getJobId()); // ??? // ? JobSessionJobEntity jobSessionJobEntity = new JobSessionJobEntity(jobSessionEntity, CreateJobSession.TOP_JOBUNIT_ID, CreateJobSession.TOP_JOB_ID); // ?? jtm.checkEntityExists(JobSessionJobEntity.class, jobSessionJobEntity.getId()); jobSessionJobEntity.setStatus(StatusConstant.TYPE_WAIT); // ?(???????) CreateJobSession.createJobSessionJob(job, sessionId, info, true, triggerInfo, null, null); jtm.commit(); } catch (Exception e) { m_log.warn("makeSession() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); String[] args = { jobId }; AplLogger.put(PriorityConstant.TYPE_CRITICAL, HinemosModuleConstant.JOB, MessageConstant.MESSAGE_SYS_003_JOB, args); if (jtm != null) { jtm.rollback(); } return; } finally { if (jtm != null) { jtm.close(); } } try { jtm = new JpaTransactionManager(); jtm.begin(); // new JobSessionJobImpl().startJob(sessionId, jobunitId, jobId); jtm.commit(); } catch (Exception e) { m_log.warn("makeSession() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); String[] args = { jobId }; AplLogger.put(PriorityConstant.TYPE_CRITICAL, HinemosModuleConstant.JOB, MessageConstant.MESSAGE_SYS_003_JOB, args); if (jtm != null) { jtm.rollback(); } return; } finally { if (jtm != null) { jtm.close(); } } } finally { lock.writeUnlock(); } }
From source file:nl.ctrlaltdev.harbinger.evidence.Evidence.java
public Evidence(Evidence src, Exception ex) { this(src);//www . j av a 2s . c o m this.exceptionType = ex.getClass(); this.exceptionMessage = ex.getMessage(); }
From source file:opendap.auth.RemotePDP.java
@Override public boolean evaluate(String userId, String resourceId, String queryString, String actionId) { boolean result = false; CloseableHttpClient httpclient = HttpClients.createDefault(); try {/*from w w w . ja va 2 s. c o m*/ StringBuilder requestUrl = new StringBuilder(); requestUrl.append(_pdpServiceEndpoint); requestUrl.append("?uid=").append(userId); requestUrl.append("&resourceId=").append(resourceId); requestUrl.append("&query=").append(queryString); requestUrl.append("&action=").append(actionId); HttpGet httpget = new HttpGet(requestUrl.toString()); _log.debug("evaluate() - Executing HTTP request: " + httpget.getRequestLine()); // ----------- Create a custom response handler ---------- ResponseHandler<Boolean> responseHandler = new ResponseHandler<Boolean>() { public Boolean handleResponse(final HttpResponse response) throws IOException { int status = response.getStatusLine().getStatusCode(); if (status >= 200 && status < 300) { HttpEntity entity = response.getEntity(); _log.debug(entity != null ? EntityUtils.toString(entity) : "null"); return true; } else { return false; } } }; // ------------------------------------------------------- result = httpclient.execute(httpget, responseHandler); } catch (Exception e) { _log.error("evaluate() - Caught {} Message: {}", e.getClass().getName(), e.getMessage()); } finally { try { httpclient.close(); } catch (IOException e) { _log.error("evaluate() - Caught {} Message: {}", e.getClass().getName(), e.getMessage()); // oh well... } } return result; }
From source file:com.navercorp.arcus.controller.ArcusController.java
@ExceptionHandler(Exception.class) @ResponseBody/* w w w .j a va 2 s .co m*/ public RestMessage handleExceptions(HttpServletRequest req, Exception e) { RestMessage result = new RestMessage(); result.setStatus("error"); result.setException(e.getClass().getName()); result.setMessage(e.getMessage()); return result; }
From source file:org.easysoa.registry.dbb.rest.ServiceFinderRest.java
private String formatError(Exception e, String message) { return e.getClass().getSimpleName() + ": " + message + " (cause: " + e.getMessage() + ")"; }
From source file:com.dhenton9000.file.FileWatchers.java
/** * generate a runnable that will process a file on a thread * * @param file file to process/*from ww w . j a v a 2 s. co m*/ * @return the constructed runnable */ private Runnable getRunnable(final File file, final IReaderSink sink) { return new Runnable() { @Override public void run() { //move from inputDir to tempDir File tempFile = new File(tempDir, FilenameUtils.getBaseName(file.getAbsolutePath()) + "_tmp.txt"); String simpleName = FilenameUtils.getName(tempFile.getAbsolutePath()); try { FileUtils.copyFile(file, tempFile); FileUtils.deleteQuietly(file); } catch (IOException ex) { LOG.error("problem moving to temp " + ex.getMessage()); } LOG.info("$#$move done " + simpleName); try { LOG.info("$#$processing " + tempFile.getAbsolutePath()); FileReader in = new FileReader(tempFile); BufferedReader bRead = new BufferedReader(in); String line = bRead.readLine(); //skipping the header //output the line while (line != null) { line = bRead.readLine(); if (line != null) { LOG.debug(simpleName + " " + line.substring(0, 10) + "..."); if (sink != null) { sink.report(line); } } } // parse each file into individual events // } catch (Exception e) { LOG.error("$#$tried to process csv " + e.getClass().getName() + " " + e.getMessage()); } } }; }
From source file:com.vmware.identity.openidconnect.server.AuthenticationController.java
@RequestMapping(value = "/oidc/authorize/{tenant:.*}", method = { RequestMethod.GET, RequestMethod.POST }) public ModelAndView authenticate(Model model, Locale locale, HttpServletRequest request, HttpServletResponse response, @PathVariable("tenant") String tenant) throws IOException { ModelAndView page;/*www . ja v a 2s . co m*/ HttpResponse httpResponse; IDiagnosticsContextScope context = null; try { HttpRequest httpRequest = HttpRequest.from(request); context = DiagnosticsContextFactory.createContext(LoggerUtils.getCorrelationID(httpRequest).getValue(), tenant); AuthenticationRequestProcessor p = new AuthenticationRequestProcessor(this.idmClient, this.authzCodeManager, this.sessionManager, this.messageSource, model, locale, httpRequest, tenant); Pair<ModelAndView, HttpResponse> result = p.process(); page = result.getLeft(); httpResponse = result.getRight(); } catch (Exception e) { ErrorObject errorObject = ErrorObject .serverError(String.format("unhandled %s: %s", e.getClass().getName(), e.getMessage())); LoggerUtils.logFailedRequest(logger, errorObject, e); page = null; httpResponse = HttpResponse.createErrorResponse(errorObject); } finally { if (context != null) { context.close(); } } if (httpResponse != null) { httpResponse.applyTo(response); } return page; }
From source file:dtu.ds.warnme.ws.rest.json.AbstractRestWS.java
protected String getMessage(Exception ex, String customCode, String customMessage, Locale locale) { ExceptionResponseMessage message = new ExceptionResponseMessage(); message.setExceptionClassName(ex.getClass().getSimpleName()); message.setExceptionMessage(ex.getMessage()); message.setCustomCode(customCode);//from w w w. j a v a 2 s. c o m message.setCustomMessage(customMessage); message.setCustomMessageLocale(locale); return GsonHolder.getGson().toJson(message); }
From source file:freeipa.client.JSONRequestServlet.java
private void testRequest(final String jsonRequest, final PrintWriter writer) { writer.print(jsonRequest);// w w w .ja va2 s .com writer.println("'</p>"); URL ipaUrl; byte[] token = new byte[0]; Subject subject = new Subject(); try { ipaUrl = new URL("https://vm-144.idm.lab.eng.brq.redhat.com/ipa/json"); KerberosHttpClient ipaClient = new KerberosHttpClient(token, subject); String response = ipaClient.makeRequest(ipaUrl, httpClient, jsonRequest); writer.println(response); } catch (Exception e) { writer.println("<h5>Failed!</h5>"); writer.print("<p>"); writer.print(e.getClass().getName()); writer.print(" - "); writer.print(e.getMessage()); writer.println("</p>"); log.error("testDomain Failed", e); } }
From source file:com.qrmedia.commons.persistence.hibernate.clone.property.AbstractValueAwarePropertyCloner.java
public boolean clone(Object source, Object target, String propertyName, HibernateEntityGraphCloner entityGraphCloner) throws IllegalArgumentException { try {/* w ww.j av a 2 s. c o m*/ return cloneValue(source, target, propertyName, PropertyUtils.getSimpleProperty(source, propertyName), entityGraphCloner); } catch (Exception exception) { throw new IllegalArgumentException( "Unable to copy property '" + propertyName + "' from " + source + " to " + target + " due to " + exception.getClass().getSimpleName() + ": " + exception.getMessage()); } }