List of usage examples for java.lang Throwable getLocalizedMessage
public String getLocalizedMessage()
From source file:facebook.TiRequestListener.java
private KrollDict buildEventArgs(boolean success, Throwable t) { KrollDict d = buildEventArgs(success); d.put(FacebookModule.PROPERTY_ERROR, t.getLocalizedMessage()); return d;// w w w . j a v a2s . c o m }
From source file:com.kylinolap.job.flow.JobFlowNode.java
protected void handleException(String jobInstanceUuid, int jobInstanceStepSeqId, KylinConfig config, Throwable t) { log.error(t.getLocalizedMessage(), t); String exceptionMsg = "Failed with Exception:" + ExceptionUtils.getFullStackTrace(t); try {/*from w w w.java 2 s . c om*/ JobDAO dao = JobDAO.getInstance(config); JobInstance jobInstance = dao.getJob(jobInstanceUuid); JobStep jobStep = jobInstance.getSteps().get(jobInstanceStepSeqId); jobStep.setStatus(JobStepStatusEnum.ERROR); jobStep.setExecEndTime(System.currentTimeMillis()); dao.updateJobInstance(jobInstance); String output = dao.getJobOutput(jobInstanceUuid, jobInstanceStepSeqId).getOutput(); output = output + "\n" + exceptionMsg; dao.saveJobOutput(jobInstanceUuid, jobInstanceStepSeqId, output); } catch (IOException e1) { log.error(e1.getLocalizedMessage(), e1); } }
From source file:org.opencms.workplace.threads.CmsExternalLinksValidatorThread.java
/** * The run method which starts the import process.<p> *///from w w w .j a v a 2 s . co m public void run() { try { // do the validation m_externLinkValidator.validateLinks(m_cms); } catch (Throwable e) { getReport().println(e); if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage()); } } }
From source file:ar.com.zauber.labs.kraken.providers.wikipedia.apps.administrative.ArgentinaDepartmentsSync.java
/** * Entrada de la tabla. 3 columnas: departamento, cabecera, partido. * /*ww w. j a va 2s . c o m*/ * [[Departamento Alberdi]] / [[Campo Gallo]] / * [[Provincia de Santiago del Estero|Santiago del Estero]] */ public final void parseTableLine(final String l) { Validate.notNull(l); if (l.trim().length() != 0) { final String[] rows = l.split("/"); if (rows.length == 3) { try { parseTableLine(nullify(rows[0].trim()), nullify(rows[1].trim()), nullify(rows[2].trim())); } catch (final Throwable t) { logger.error("Procesing line " + lineNumber + ": " + t.getLocalizedMessage(), t); } } else { final StringBuilder sb = new StringBuilder(); new Formatter(sb).format("Procesing line %d: Expected 3 columns. Got %d. `%s'", lineNumber, rows.length, l); throw new IllegalArgumentException(sb.toString()); } } }
From source file:com.anrisoftware.prefdialog.miscswing.actions.AbstractAppActionRunner.java
@Override public final void run() { notNull(getStatusBar(), "statusBar"); notNull(getLogWindowDock(), "logWindowDock"); try {//from ww w . j a v a 2s . c om doRun(); } catch (Throwable e) { log.logException(e, application_error_description, CAUSE_MESSAGE_ARG, e.getLocalizedMessage()); } }
From source file:it.geosolutions.geobatch.imagemosaic.ImageMosaicUpdater.java
/** * Removes from the passed addFileList already present (into the passed * dataStore) features /*from w w w .j ava 2s . com*/ * * TODO this can be skipped to perform update (instead * of perform remove+update) */ private static boolean purgeAddFileList(List<File> addFileList, DataStore dataStore, String store, final String locationKey, final File baseDir, boolean absolute) { if (addFileList.isEmpty()) { if (LOGGER.isInfoEnabled()) { LOGGER.info("Add list is empty"); } // we're not expecting empty list here return false; } Filter addFilter = null; // calculate the query try { addFilter = getQuery(addFileList, absolute, locationKey); if (addFilter == null) { // if (LOGGER.isInfoEnabled()) { LOGGER.info("The ADD query is null. Should not happen"); } return false; } } catch (IllegalArgumentException e) { if (LOGGER.isWarnEnabled()) { LOGGER.warn(e.getLocalizedMessage()); } } catch (CQLException e) { if (LOGGER.isErrorEnabled()) { LOGGER.error("Unable to build a query. Message: " + e, e); } return false; } final String handle = "ImageMosaic:" + Thread.currentThread().getId(); final Transaction transaction = new DefaultTransaction(handle); /* * CHECK IF ADD FILES ARE ALREADY INTO THE LAYER */ FeatureReader<SimpleFeatureType, SimpleFeature> fr = null; try { // get the schema if this feature final SimpleFeatureType schema = dataStore.getSchema(store); /* * TODO to save time we could use the store name which should be the * same */ final Query q = new Query(schema.getTypeName(), addFilter); fr = dataStore.getFeatureReader(q, transaction); if (fr == null) { if (LOGGER.isErrorEnabled()) { LOGGER.error("The FeatureReader is null, it's impossible to get a reader on the dataStore: " + dataStore.toString()); } return false; } while (fr.hasNext()) { SimpleFeature feature = fr.next(); if (feature != null) { String path = (String) feature.getAttribute(locationKey); // remove from the list the image which is already // into the layer if (absolute) { File added = new File(baseDir, path); addFileList.remove(added); if (LOGGER.isWarnEnabled()) { LOGGER.warn("The file: " + path + " is removed from the addFiles list because it is already present into the layer"); } } else { // check relative paths Iterator<File> it = addFileList.iterator(); while (it.hasNext()) { File file = it.next(); if (file.getName().equals(path)) { it.remove(); if (LOGGER.isWarnEnabled()) { LOGGER.warn("The file: " + path + " is removed from the addFiles list because it is already present into the layer"); } } } } } else { if (LOGGER.isErrorEnabled()) { LOGGER.error("Problem getting the next feature: it is null!"); } } } //commit transaction.commit(); } catch (Exception e) { if (LOGGER.isErrorEnabled()) { LOGGER.error(e.getLocalizedMessage(), e); } try { transaction.rollback(); } catch (IOException ioe) { if (LOGGER.isErrorEnabled()) { LOGGER.error(ioe.getLocalizedMessage(), ioe); } } return false; } finally { try { transaction.close(); } catch (Throwable t) { if (LOGGER.isWarnEnabled()) { LOGGER.warn("problem closing transaction: " + t.getLocalizedMessage(), t); } } try { if (fr != null) { fr.close(); fr = null; } } catch (Throwable t) { if (LOGGER.isWarnEnabled()) { LOGGER.warn("problem closing transaction: " + t.getLocalizedMessage(), t); } } } return true; }
From source file:org.musicrecital.webapp.pages.PasswordRecoveryToken.java
Object onActivate(EventContext ctx) { // ensure that the username has been set if (ctx == null || ctx.getCount() == 0) { logger.warn("Username not specified, notifying user that it's a required field."); alertManager.alert(Duration.TRANSIENT, Severity.ERROR, messages.format("errors.required", messages.get("user.username"))); return Login.class; }/* ww w . ja va 2 s .c om*/ // Expect username is the first item in the context int userIdx = 0; this.username = ctx.get(String.class, userIdx).trim(); logger.debug("Sending recovery token for username: " + username); try { userManager.sendPasswordRecoveryEmail(username, RequestUtil.getAppURL(request) + getLink()); } catch (final UsernameNotFoundException ignored) { // lets ignore this Throwable exceptionToLog = ignored.getCause() != null ? ignored.getCause() : ignored; logger.error(exceptionToLog.getLocalizedMessage()); } alertManager.alert(Duration.TRANSIENT, Severity.INFO, messages.get("updatePassword.recoveryToken.sent")); return Login.class; }
From source file:com.adito.extensions.actions.GetExtensionDescriptorAction.java
protected void processApplicationRequest(ExtensionDescriptor app, String ticket, HttpServletRequest request, HttpServletResponse response, Properties properties) throws JDOMException, Exception { try {//from w w w. j a v a 2 s. co m SessionInfo session = LogonControllerFactory.getInstance().getSessionInfo(request); if (session == null) { throw new ExtensionException(ExtensionException.INTERNAL_ERROR, "No session."); } sendApplicationDescriptor(app, request, response, session, properties); } catch (CoreException coreException) { String message = coreException.getLocalizedMessage(request.getSession()); log.error(message, coreException); sendError(message, response); } catch (Throwable t) { log.error("Failed to process request for application.", t); sendError(t.getLocalizedMessage() == null ? "<null>" : t.getLocalizedMessage(), response); } }
From source file:org.polymap.core.runtime.PolymapJobExecutor.java
@Override public <T> Future<T> submit(final Callable<T> task) { Job job = new Job("ExecutorJob") { protected IStatus run(IProgressMonitor monitor) { try { T resultValue = task.call(); setProperty(FutureJobAdapter.RESULT_VALUE_NAME, resultValue); return Status.OK_STATUS; } catch (Throwable e) { return new Status(IStatus.ERROR, CorePlugin.ID, e.getLocalizedMessage(), e); }/*from ww w. j av a 2 s . co m*/ } }; job.setSystem(true); job.setPriority(UIJob.DEFAULT_PRIORITY); job.schedule(); return new FutureJobAdapter(job); }
From source file:org.polymap.core.runtime.PolymapJobExecutor.java
@Override public <T> Future<T> submit(final Runnable task, T result) { Job job = new Job("ExecutorJob") { protected IStatus run(IProgressMonitor monitor) { try { task.run();//from w w w . j a v a2 s .c om return Status.OK_STATUS; } catch (Throwable e) { return new Status(IStatus.ERROR, CorePlugin.ID, e.getLocalizedMessage(), e); } } }; job.setProperty(FutureJobAdapter.RESULT_VALUE_NAME, result); job.setSystem(true); job.setPriority(UIJob.DEFAULT_PRIORITY); job.schedule(); return new FutureJobAdapter(job); }