List of usage examples for java.lang Throwable toString
public String toString()
From source file:com.cloud.cluster.ClusterServiceServletHttpHandler.java
@Override public void handle(HttpRequest request, HttpResponse response, HttpContext context) throws HttpException, IOException { try {/* ww w . j a va2 s . co m*/ if (s_logger.isTraceEnabled()) { s_logger.trace("Start Handling cluster HTTP request"); } parseRequest(request); handleRequest(request, response); if (s_logger.isTraceEnabled()) { s_logger.trace("Handle cluster HTTP request done"); } } catch (Throwable e) { if (s_logger.isDebugEnabled()) { s_logger.debug("Exception " + e.toString()); } try { writeResponse(response, HttpStatus.SC_INTERNAL_SERVER_ERROR, null); } catch (Throwable e2) { if (s_logger.isDebugEnabled()) { s_logger.debug("Exception " + e2.toString()); } } } }
From source file:com.haulmont.cuba.security.auth.AuthenticationServiceBean.java
@Nonnull @Override/* w ww.j ava 2s . c om*/ public UserSession substituteUser(User substitutedUser) { try { UserSession currentSession = userSessionSource.getUserSession(); SessionLogEntry logEntry = userSessionLog.updateSessionLogRecord(currentSession, SessionAction.SUBSTITUTION); UserSession substitutionSession = authenticationManager.substituteUser(substitutedUser); Map<String, Object> logParams = emptyMap(); if (logEntry != null && logEntry.getClientType() != null) { logParams = ParamsMap.of(ClientType.class.getName(), logEntry.getClientType().name()); } userSessionLog.createSessionLogRecord(substitutionSession, SessionAction.LOGIN, currentSession, logParams); return substitutionSession; } catch (Throwable e) { log.error("Substitution error", e); throw new RuntimeException("Substitution error: " + e.toString()); } }
From source file:com.jkoolcloud.tnt4j.repository.FileTokenRepository.java
@Override public void open() throws IOException { if (isOpen() || (configName == null)) return;//w w w . j a v a 2 s . com try { initConfig(); if (refDelay > 0) { FileChangedReloadingStrategy reloadConfig = new FileChangedReloadingStrategy(); reloadConfig.setRefreshDelay(refDelay); config.setReloadingStrategy(reloadConfig); } } catch (Throwable e) { IOException ioe = new IOException(e.toString()); ioe.initCause(e); throw ioe; } }
From source file:com.googlecode.flyway.maven.AbstractFlywayMojo.java
public final void execute() throws MojoExecutionException, MojoFailureException { MavenLogAppender.startPluginLog(this); try {/*w w w . ja v a 2s. co m*/ loadCredentialsFromSettings(); Flyway flyway = new Flyway(); flyway.setDataSource(createDataSource()); if (schemas != null) { flyway.setSchemas(StringUtils.tokenizeToStringArray(schemas, ",")); } if (table != null) { flyway.setTable(table); } doExecute(flyway); } catch (Exception e) { LOG.error(e.toString()); Throwable rootCause = ExceptionUtils.getRootCause(e); if (rootCause != null) { LOG.error("Caused by " + rootCause.toString()); } throw new MojoExecutionException("Flyway Error: " + e.toString(), e); } finally { MavenLogAppender.endPluginLog(this); } }
From source file:com.haulmont.cuba.gui.exception.UniqueConstraintViolationHandler.java
protected boolean doHandle(Throwable throwable, WindowManager windowManager) { Pattern pattern = clientConfig.getUniqueConstraintViolationPattern(); String constraintName = ""; Matcher matcher = pattern.matcher(throwable.toString()); if (matcher.find()) { if (matcher.groupCount() == 1) { constraintName = matcher.group(1); } else {// ww w . ja v a2 s . c om for (int i = 1; i > matcher.groupCount(); i++) { if (StringUtils.isNotBlank(matcher.group(i))) { constraintName = matcher.group(i); break; } } } String msg = ""; if (StringUtils.isNotBlank(constraintName)) { msg = messages.getMainMessage(constraintName.toUpperCase()); } if (msg.equalsIgnoreCase(constraintName)) { msg = messages.getMainMessage("uniqueConstraintViolation.message"); if (StringUtils.isNotBlank(constraintName)) { msg = msg + " (" + constraintName + ")"; } } windowManager.showNotification(msg, Frame.NotificationType.ERROR); return true; } return false; }
From source file:com.google.cloud.hadoop.util.LogUtil.java
/** * Logs an informational message.//w w w . ja v a2 s .co m * * @param message Message to log. * @param t Throwable to log. */ public synchronized void info(String message, Throwable t) { if (log.isInfoEnabled()) { info("%s\n%s\n%s", message, t.toString(), Throwables.getStackTraceAsString(t)); } }
From source file:com.google.cloud.hadoop.util.LogUtil.java
/** * Logs a warning message./*from w ww . jav a 2 s. co m*/ * * @param message Message to log. * @param t Throwable to log. */ public synchronized void warn(String message, Throwable t) { if (log.isWarnEnabled()) { warn("%s\n%s\n%s", message, t.toString(), Throwables.getStackTraceAsString(t)); } }
From source file:org.bpmscript.integration.spring.correlation.SpringConversationCorrelator.java
/** * Creates a generic message and embeds the conversation return address, conversationId * and payload inside it.// w w w . jav a 2 s .c o m * * @see org.bpmscript.correlation.IConversationCorrelator#call(java.lang.String, long, java.lang.Object) */ @SuppressWarnings("unchecked") public Object call(String toCorrelationId, long timeout, Object in) throws Exception { String id = UUID.randomUUID().toString(); try { syncChannel.expect(id); GenericMessage<Object> invocationMessage = new GenericMessage(in); invocationMessage.getHeader().setReturnAddress(returnAddress); invocationMessage.getHeader().setCorrelationId(id); invocationMessage.getHeader().setAttribute("conversationReturnAddress", address); invocationMessage.getHeader().setAttribute("conversationId", toCorrelationId); sender.send(correlatorAddress, returnAddressSupport.setSerializeableReturnAddress(invocationMessage)); // this is all duplicate code... from where? Message<Object> result = (Message<Object>) syncChannel.get(id, timeout); if (result == null) { log.debug("sync service timed out for " + in); return null; } Object payload = result.getPayload(); if (payload instanceof Throwable) { Throwable error = (Throwable) payload; if (error instanceof Exception) { throw (Exception) error; } else { throw new RuntimeException(error.toString()); } } else { return payload; } } finally { syncChannel.close(id); } }
From source file:com.devbury.mkremote.server.QuickLaunchServiceImpl.java
protected void handleOpenError(final File file, final Throwable t) { boolean error = true; logger.debug(t.toString()); if (isWindows()) { try {/*from ww w . ja v a 2s . co m*/ runOnWindows(file); error = false; } catch (Throwable w) { logger.debug(w.toString()); } } if (error) { new Thread() { @Override public void run() { JOptionPane.showMessageDialog(null, t.getMessage(), "Error Launching " + file.getAbsolutePath(), JOptionPane.ERROR_MESSAGE); } }.start(); } }
From source file:com.streamsets.datacollector.lineage.LineagePublisherTaskImpl.java
private void createAndInitializeRuntime(LineagePublisherDefinition def, String name) { LineagePublisher publisher = instantiateLineagePublisher(def); this.publisherRuntime = new LineagePublisherRuntime(def, publisher); LineagePublisherContext context = new LineagePublisherContext(name, configuration); List<LineagePublisher.ConfigIssue> issues; try {//from ww w .j a v a 2 s .c o m issues = publisherRuntime.init(context); } catch (Throwable t) { LOG.error("Failed initializing lineage publisher: {}", t.toString(), t); throw new RuntimeException("Failed initializing lineage publisher", t); } // If the issues aren't empty, terminate the execution if (!issues.isEmpty()) { for (LineagePublisher.ConfigIssue issue : issues) { LOG.error("Lineage init issue: {}", issue); } throw new RuntimeException( Utils.format("Can't initialize lineage publisher ({} issues)", issues.size())); } }