List of usage examples for java.lang Throwable getLocalizedMessage
public String getLocalizedMessage()
From source file:org.opencms.gwt.CmsGwtService.java
/** * Logs the given exception.<p>/*from w w w.j av a 2s. c o m*/ * * @param t the exception to log */ public void logError(Throwable t) { LOG.error(t.getLocalizedMessage(), t); }
From source file:org.ut.biolab.medsavant.MedSavantClient.java
private static void setExceptionHandler() { Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override/*from w ww.ja v a2 s . c o m*/ public void uncaughtException(Thread t, Throwable e) { LOG.info("Global exception handler caught: " + t.getName() + ": " + e); if (e instanceof InvocationTargetException) { e = ((InvocationTargetException) e).getCause(); } if (e instanceof SessionExpiredException) { SessionExpiredException see = (SessionExpiredException) e; MedSavantExceptionHandler.handleSessionExpiredException(see); return; } if (e instanceof LockException) { DialogUtils.displayMessage("Cannot modify database", "<html>Another process is making changes.<br/>Please try again later.</html>"); return; } e.printStackTrace(); DialogUtils.displayException("Error", e.getLocalizedMessage(), e); } }); }
From source file:com.kii.sample.hellothingif.CommandFragment.java
private void onPushMessageReceived(String commandID) { PromiseAPIWrapper api = new PromiseAPIWrapper(mAdm, mApi); mAdm.when(api.getCommand(commandID)).then(new DoneCallback<Command>() { @SuppressWarnings("unused") @Override//from w w w . ja va 2 s .com public void onDone(Command command) { if (getActivity() == null) { return; } List<ActionResult> results = command.getActionResults(); StringBuilder sbMessage = new StringBuilder(); for (ActionResult result : results) { String actionName = result.getActionName(); boolean succeeded = result.succeeded(); String errorMessage = result.getErrorMessage(); if (!succeeded) { sbMessage.append(errorMessage); } } if (sbMessage.length() == 0) { sbMessage.append("The command succeeded."); } mCommandResult.setText(sbMessage.toString()); } }).fail(new FailCallback<Throwable>() { @Override public void onFail(final Throwable tr) { showToast("Failed to receive the command result: " + tr.getLocalizedMessage()); } }); }
From source file:org.kalypso.model.wspm.tuhh.ui.wizards.CreateLengthSectionWizard.java
@Override public boolean performFinish() { final Object[] profilFeatures = m_profileChooserPage.getChoosen(); try {/* w w w. j a v a 2s . co m*/ final URL context = m_profileSelection.getWorkspace().getContext(); final IProject wspmProjekt = ResourceUtilities.findProjectFromURL(context); final IFolder parentFolder = wspmProjekt.getFolder("Lngsschnitte"); //$NON-NLS-1$ final IFile kodFile = doExport(profilFeatures, context, parentFolder); openKod(kodFile); } catch (final Throwable t) { final String message = String.format(Messages.getString("CreateLengthSectionWizard.0"), //$NON-NLS-1$ t.getLocalizedMessage()); final IStatus status = new Status(IStatus.ERROR, KalypsoModelWspmTuhhUIPlugin.getID(), message, t); KalypsoModelWspmTuhhUIPlugin.getDefault().getLog().log(status); new StatusDialog(getShell(), status, getWindowTitle()).open(); } return true; }
From source file:de.iteratec.iteraplan.presentation.dialog.History.HistoryController.java
@ExceptionHandler(IteraplanTechnicalException.class) public ModelAndView handleException(Throwable ex, HttpServletRequest req, HttpServletResponse resp) { ModelAndView mav = new ModelAndView("errorOutsideFlow"); mav.addObject(Constants.JSP_ATTRIBUTE_EXCEPTION_MESSAGE, ex.getLocalizedMessage()); LOGGER.error("During history retrieval, an error occurred", ex); IteraplanProblemReport.createFromController(ex, req); resp.setStatus(HttpServletResponse.SC_NO_CONTENT); // status code 204 return mav;/*from w ww . ja v a2s . c om*/ }
From source file:org.kalypso.model.wspm.tuhh.schema.simulation.MultipleRunoffReader.java
public void readKM() { try {//w ww . j av a2s .c o m final FileFilter kmFilter = FileFilterUtils.suffixFileFilter(".km", IOCase.INSENSITIVE); //$NON-NLS-1$ final File[] kmFiles = m_kmDir.listFiles(kmFilter); // REMARK: the way we read km/polynomial files it's bit tricky to get the slope // However this is not a problem, as we are calculating we a uniform steady slope, // which is defined in the calculation final BigDecimal startSlope = m_calculation.getStartSlope(); final BigDecimal slope = startSlope.setScale(5, RoundingMode.HALF_UP); final KMFileReader reader = new KMFileReader(kmFiles, m_log, m_intervalIndex, slope); reader.read(); } catch (final Throwable e) { m_log.log(e, Messages.getString("org.kalypso.model.wspm.tuhh.schema.simulation.KMProcessor.0"), //$NON-NLS-1$ e.getLocalizedMessage()); } }
From source file:rapture.dp.invocable.notification.steps.NotificationStep.java
@Override public String invoke(CallingContext ctx) { // Don't set STEPNAME here because we want the name of the preceding step // Can read config from a documemnt or pass as args AdminApi admin = Kernel.getAdmin(); String types = StringUtils.stripToNull(decision.getContextValue(ctx, getWorkerURI(), "NOTIFY_TYPE")); if (types == null) { decision.writeWorkflowAuditEntry(ctx, getWorkerURI(), "Problem in " + getStepName() + ": parameter NOTIFY_TYPE is not set", true); return getErrorTransition(); }/*from ww w . j a va 2 s . c om*/ StringBuffer error = new StringBuffer(); String retval = getNextTransition(); for (String type : types.split("[, ]+")) { try { if (type.equalsIgnoreCase("SLACK") && !sendSlack(ctx)) { decision.writeWorkflowAuditEntry(ctx, getWorkerURI(), "Slack notification failed", true); retval = getErrorTransition(); } } catch (Exception e) { Throwable cause = ExceptionToString.getRootCause(e); error.append("Cannot send slack notification : ").append(cause.getLocalizedMessage()).append("\n"); decision.writeWorkflowAuditEntry(ctx, getWorkerURI(), "Problem in " + getStepName() + ": slack notification failed", true); decision.writeWorkflowAuditEntry(ctx, getWorkerURI(), ExceptionToString.summary(cause), true); retval = getErrorTransition(); } try { if (type.equalsIgnoreCase("EMAIL") && !sendEmail(ctx)) { decision.writeWorkflowAuditEntry(ctx, getWorkerURI(), "Email notification failed", true); retval = getErrorTransition(); } } catch (Exception e) { Throwable cause = ExceptionToString.getRootCause(e); error.append("Cannot send email notification : ").append(cause.getLocalizedMessage()).append("\n"); decision.writeWorkflowAuditEntry(ctx, getWorkerURI(), "Problem in NotificationStep " + getStepName() + ": email notification failed", true); decision.writeWorkflowAuditEntry(ctx, getWorkerURI(), ExceptionToString.summary(cause), true); log.error(ExceptionToString.format(ExceptionToString.getRootCause(e))); retval = getErrorTransition(); } } String errMsg = error.toString(); if (!StringUtils.isEmpty(errMsg)) { log.error(errMsg); decision.setContextLiteral(ctx, getWorkerURI(), getStepName(), "Notification failure"); decision.setContextLiteral(ctx, getWorkerURI(), getErrName(), errMsg); } return retval; }
From source file:org.apache.cayenne.tools.DbImporterTask.java
@Override public void execute() { config.setFiltersConfig(new FiltersConfigBuilder(reverseEngineering).build()); validateAttributes();/*from w ww . ja v a 2 s . c o m*/ Log logger = new AntLogger(this); config.setLogger(logger); config.setSkipRelationshipsLoading(reverseEngineering.getSkipRelationshipsLoading()); config.setSkipPrimaryKeyLoading(reverseEngineering.getSkipPrimaryKeyLoading()); config.setTableTypes(reverseEngineering.getTableTypes()); Injector injector = DIBootstrap.createInjector(new DbSyncModule(), new ToolsModule(logger), new DbImportModule()); DbImportConfigurationValidator validator = new DbImportConfigurationValidator(reverseEngineering, config, injector); try { validator.validate(); } catch (Exception ex) { throw new BuildException(ex.getMessage(), ex); } try { injector.getInstance(DbImportAction.class).execute(config); } catch (Exception ex) { Throwable th = Util.unwindException(ex); String message = "Error importing database schema"; if (th.getLocalizedMessage() != null) { message += ": " + th.getLocalizedMessage(); } log(message, Project.MSG_ERR); throw new BuildException(message, th); } finally { injector.shutdown(); } }
From source file:org.pentaho.platform.repository.solution.CleanRepoPublisher.java
@Override public String publish(final IPentahoSession localSession) { try {/*from w w w.j a v a 2 s . c o m*/ HashMap<String, String> parameters = new HashMap<String, String>(); ISolutionEngine engine = SolutionHelper.execute("publisher", localSession, //$NON-NLS-1$ "admin/clean_repository.xaction", //$NON-NLS-1$ parameters, null); IRuntimeContext context = engine.getExecutionContext(); int status = context.getStatus(); if (status != IRuntimeContext.RUNTIME_STATUS_SUCCESS) { return Messages.getInstance().getString("CleanRepoPublisher.ERROR_0001_CLEAN_REPO_FAILED"); //$NON-NLS-1$ } } catch (Throwable t) { error(Messages.getInstance().getErrorString("CleanRepoPublisher.ERROR_0001_CLEAN_REPO_FAILED", //$NON-NLS-1$ t.getMessage()), t); return Messages.getInstance().getString("CleanRepoPublisher.ERROR_0001_CLEAN_REPO_FAILED", //$NON-NLS-1$ t.getLocalizedMessage()); } return Messages.getInstance().getString("CleanRepoPublisher.CLEAN_REPO_DONE"); //$NON-NLS-1$ }
From source file:cz.hobrasoft.pdfmu.operation.OperationException.java
private RpcError getRpcError() { RpcError re = new RpcError(getCode(), getLocalizedMessage()); Throwable cause = getCause(); if (cause != null || messageArguments != null) { re.data = new Data(); if (cause != null) { re.data.causeClass = cause.getClass(); re.data.causeMessage = cause.getLocalizedMessage(); }/* w ww . j a v a 2 s .c o m*/ re.data.arguments = messageArguments; } return re; }