List of usage examples for java.lang Throwable getLocalizedMessage
public String getLocalizedMessage()
From source file:es.juntadeandalucia.panelGestion.negocio.vo.TaskVO.java
private void manageError(Throwable t) { taskEntity.getState().setStatus(Status.ERROR); taskEntity.getState()//from ww w .j ava2 s.c o m .setDescription("Error en la lnea ".concat(String.valueOf(fileProcessor.getNumCurrentEntry())) .concat(": ").concat(t.getLocalizedMessage())); // gets ticket String taskTicket = null; if (getTaskEntity() != null) { taskTicket = getTaskEntity().getTicket(); } try { saveTask(); } catch (Exception e) { log.error("Error al intentar guardar el estado de la tarea '".concat(taskTicket).concat("': ") + e.getLocalizedMessage()); } log.error("Error en la ejecucin de la tarea '".concat(taskTicket).concat("': ") .concat(t.getLocalizedMessage())); }
From source file:com.microsoft.alm.plugin.idea.git.ui.pullrequest.CreatePullRequestModel.java
/** * Create pull request on a background thread * <p/>/*from w ww. j ava2 s. c o m*/ * This method will first check to see if the local branch has a tracking branch: * yes: * push the commits to the remote tracking branch * no: * try create a remote branch matching the local branch name exactly, with the remote set to the GitRemote of * the target branch * <p/> * If push fails for whatever reason, stop and show an error message * <p/> * After we push the local branch, then create the pull request. Pull request link should be returned * in a notification bubble */ public void createPullRequest() { /* verifying branch selections */ final GitLocalBranch sourceBranch = this.getSourceBranch(); final GitRemoteBranch targetBranch = this.getTargetBranch(); if (sourceBranch == null) { // how did we get here? validation failed? notifyCreateFailedError(project, TfPluginBundle.message(TfPluginBundle.KEY_CREATE_PR_ERRORS_SOURCE_EMPTY)); return; } if (targetBranch == null) { // how did we get here? validation failed? notifyCreateFailedError(project, TfPluginBundle.message(TfPluginBundle.KEY_CREATE_PR_ERRORS_TARGET_NOT_SELECTED)); return; } if (targetBranch.equals(this.getRemoteTrackingBranch())) { // how did we get here? Didn't we filter you out? notifyCreateFailedError(project, TfPluginBundle.message(TfPluginBundle.KEY_CREATE_PR_ERRORS_TARGET_IS_LOCAL_TRACKING)); return; } //TODO Determine the correct/best way to get the remote url final String gitRemoteUrl = TfGitHelper.getTfGitRemote(gitRepository).getFirstUrl(); final CreatePullRequestModel createModel = this; /* Let's keep all server interactions to a background thread */ final Task.Backgroundable createPullRequestTask = new Task.Backgroundable(project, TfPluginBundle.message(TfPluginBundle.KEY_CREATE_PR_DIALOG_TITLE), true, PerformInBackgroundOption.DEAF) { @Override public void run(@NotNull ProgressIndicator progressIndicator) { ListenableFuture<Pair<String, GitCommandResult>> pushResult = doPushCommits(gitRepository, sourceBranch, targetBranch.getRemote(), progressIndicator); Futures.addCallback(pushResult, new FutureCallback<Pair<String, GitCommandResult>>() { @Override public void onSuccess(@Nullable Pair<String, GitCommandResult> result) { if (result != null && StringUtils.isNotEmpty(result.getFirst())) { final String title = createModel.getTitle(); final String description = createModel.getDescription(); final String branchNameOnRemoteServer = result.getFirst(); // get context from manager, we want to do this after push completes since credentials could have changed during the Git push final ServerContext context = ServerContextManager.getInstance() .getUpdatedContext(gitRemoteUrl, true); if (context == null) { notifyCreateFailedError(project, TfPluginBundle .message(TfPluginBundle.KEY_ERRORS_AUTH_NOT_SUCCESSFUL, gitRemoteUrl)); return; } doCreatePullRequest(project, context, title, description, branchNameOnRemoteServer, targetBranch); } else { // I really don't have anything else to say, push failed, the title says it all // I have no error message to be more specific notifyPushFailedError(createModel.getProject(), StringUtils.EMPTY); } } @Override public void onFailure(Throwable t) { notifyPushFailedError(createModel.getProject(), t.getLocalizedMessage()); } }); } }; createPullRequestTask.queue(); }
From source file:org.pentaho.reporting.libraries.resourceloader.ResourceManager.java
public void registerDataCache() { try {// ww w .ja v a 2s . co m final ObjectFactory objectFactory = LibLoaderBoot.getInstance().getObjectFactory(); final ResourceDataCacheProvider maybeDataCacheProvider = objectFactory .get(ResourceDataCacheProvider.class); final ResourceDataCache cache = maybeDataCacheProvider.createDataCache(); if (cache != null) { setDataCache(cache); } } catch (Throwable e) { // ok, did not work ... synchronized (failedModules) { if (failedModules.contains(ResourceDataCacheProvider.class) == false) { logger.warn("Failed to create data cache: " + e.getLocalizedMessage()); failedModules.add(ResourceDataCacheProvider.class); } } } }
From source file:org.pentaho.reporting.libraries.resourceloader.ResourceManager.java
public void registerBundleDataCache() { try {/*from w w w. j a v a 2 s.c om*/ final ObjectFactory objectFactory = LibLoaderBoot.getInstance().getObjectFactory(); final ResourceBundleDataCacheProvider maybeDataCacheProvider = objectFactory .get(ResourceBundleDataCacheProvider.class); final ResourceBundleDataCache cache = maybeDataCacheProvider.createBundleDataCache(); if (cache != null) { setBundleCache(cache); } } catch (Throwable e) { // ok, did not work ... synchronized (failedModules) { if (failedModules.contains(ResourceBundleDataCacheProvider.class) == false) { logger.warn("Failed to create data cache: " + e.getLocalizedMessage()); failedModules.add(ResourceBundleDataCacheProvider.class); } } } }
From source file:br.com.suricattus.surispring.jsf.exception.PrettyExceptionHandler.java
protected boolean handleException(Iterator<ExceptionQueuedEvent> it, Throwable t, Class<? extends Throwable> type, String message) { if (type.isAssignableFrom(t.getClass())) { try {//from w w w. j av a2 s . c o m if (!catched) { FacesContext facesContext = FacesUtils.getContext(); FacesUtils.addMsgErro(message); messagesUtils.saveMessages(facesContext, facesContext.getExternalContext().getSessionMap()); facesContext.getApplication().getNavigationHandler().handleNavigation(facesContext, null, "pretty:error"); facesContext.renderResponse(); return true; } } finally { catched = true; logger.log(Level.SEVERE, t.getLocalizedMessage(), t); it.remove(); } } return false; }
From source file:cl.gisred.android.RepartoActivity.java
public void enviarDatos() { final AtomicReference<String> resp = new AtomicReference<>(""); for (RepartoClass rep : arrayDatos) { final RepartoClass repActual = rep; Map<String, Object> objectMap = new HashMap<>(); objectMap.put("nis", rep.getNis()); objectMap.put("valor_captura", rep.getCodigo()); objectMap.put("empresa", empresa); objectMap.put("modulo", modulo); Point oUbicacion = new Point(rep.getX(), rep.getY()); Graphic newFeatureGraphic = new Graphic(oUbicacion, null, objectMap); Graphic[] adds = { newFeatureGraphic }; LyReparto.applyEdits(adds, null, null, new CallbackListener<FeatureEditResult[][]>() { @Override//from w ww .ja v a2 s . c o m public void onCallback(FeatureEditResult[][] featureEditResults) { if (featureEditResults[0] != null) { if (featureEditResults[0][0] != null && featureEditResults[0][0].isSuccess()) { runOnUiThread(new Runnable() { @Override public void run() { deleteData(repActual.getId()); } }); } } } @Override public void onError(Throwable throwable) { resp.set("Error al ingresar: " + throwable.getLocalizedMessage()); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(RepartoActivity.this, resp.get(), Toast.LENGTH_SHORT).show(); } }); } }); } }
From source file:org.wikipedia.edit.EditSectionActivity.java
private void showRetryDialog(@NonNull Throwable t) { final AlertDialog retryDialog = new AlertDialog.Builder(EditSectionActivity.this) .setTitle(R.string.dialog_message_edit_failed).setMessage(t.getLocalizedMessage()) .setPositiveButton(R.string.dialog_message_edit_failed_retry, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { getEditTokenThenSave(false); dialog.dismiss(); progressDialog.dismiss(); }/*from w w w .j a v a2s .c om*/ }) .setNegativeButton(R.string.dialog_message_edit_failed_cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); progressDialog.dismiss(); } }) .create(); retryDialog.show(); }
From source file:com.chakray.chilcano.wso2.rabbitmq.message.store.RabbitMQProducer.java
public boolean storeMessage(MessageContext synCtx) { if (synCtx == null) { return false; }/* w w w . ja v a 2 s . co m*/ if (!checkConnection()) { logger.warn(getId() + ". Ignored MessageID : " + synCtx.getMessageID()); return false; } StorableMessage message = MessageConverter.toStorableMessage(synCtx); boolean error = false; Throwable throwable = null; try { ObjectMessage objectMessage = session.createObjectMessage(message); objectMessage.setStringProperty(OriginalMessageID, synCtx.getMessageID()); setPriority(producer, objectMessage, message); producer.send(objectMessage); } catch (JMSException e) { throwable = e; error = true; isConnectionError = true; } catch (Throwable t) { throwable = t; error = true; } if (error) { String errorMsg = getId() + ". Ignored MessageID : " + synCtx.getMessageID() + ". Could not store message to store [" + store.getName() + "]. Error:" + throwable.getLocalizedMessage(); logger.error(errorMsg, throwable); store.closeWriteConnection(); connection = null; if (logger.isDebugEnabled()) { logger.debug(getId() + ". Ignored MessageID : " + synCtx.getMessageID()); } return false; } else { store.cleanup(null, session, false); } if (logger.isDebugEnabled()) { logger.debug(getId() + ". Stored MessageID : " + synCtx.getMessageID()); } store.enqueued(); return true; }
From source file:org.opencms.publish.CmsPublishEngine.java
/** * Signalizes that the publish thread finishes.<p> * // w w w . j ava 2 s. c o m * @param publishJob the finished publish job */ protected void publishJobFinished(CmsPublishJobInfoBean publishJob) { // in order to avoid not removable publish locks, unlock all assigned resources again try { unlockPublishList(publishJob); } catch (Throwable t) { // log failure, most likely a database problem LOG.error(t.getLocalizedMessage(), t); } // trigger the old event mechanism CmsDbContext dbc = m_dbContextFactory.getDbContext(publishJob.getCmsObject().getRequestContext()); try { // fire an event that a project has been published Map<String, Object> eventData = new HashMap<String, Object>(); eventData.put(I_CmsEventListener.KEY_REPORT, publishJob.getPublishReport()); eventData.put(I_CmsEventListener.KEY_PUBLISHID, publishJob.getPublishList().getPublishHistoryId().toString()); eventData.put(I_CmsEventListener.KEY_PROJECTID, dbc.currentProject().getUuid()); eventData.put(I_CmsEventListener.KEY_DBCONTEXT, dbc); CmsEvent afterPublishEvent = new CmsEvent(I_CmsEventListener.EVENT_PUBLISH_PROJECT, eventData); OpenCms.fireCmsEvent(afterPublishEvent); } catch (Throwable t) { dbc.rollback(); LOG.error(t); // catch every thing including runtime exceptions publishJob.getPublishReport().println(t); } finally { try { dbc.clear(); } catch (Throwable t) { // ignore } dbc = null; } try { // fire the publish finish event m_listeners.fireFinish(new CmsPublishJobRunning(publishJob)); } catch (Throwable t) { // log failure, most likely a database problem LOG.error(t.getLocalizedMessage(), t); } try { // finish the job publishJob.finish(); } catch (Throwable t) { // log failure, most likely a database problem LOG.error(t.getLocalizedMessage(), t); } try { // put the publish job into the history list m_publishHistory.add(publishJob); } catch (Throwable t) { // log failure, most likely a database problem LOG.error(t.getLocalizedMessage(), t); } if (Thread.currentThread() == m_currentPublishThread) { // wipe the dead thread, only if this thread has not been abandoned m_currentPublishThread = null; } // clear the published resources cache OpenCms.getMemoryMonitor().flushCache(CmsMemoryMonitor.CacheType.PUBLISHED_RESOURCES); // try to start a new publish job checkCurrentPublishJobThread(); }
From source file:org.opencms.ade.configuration.CmsADEManager.java
/** * Returns the favorite list, or creates it if not available.<p> * * @param cms the cms context//from w ww.j ava 2 s. c o m * * @return the favorite list * * @throws CmsException if something goes wrong */ public List<CmsContainerElementBean> getFavoriteList(CmsObject cms) throws CmsException { CmsUser user = cms.getRequestContext().getCurrentUser(); Object obj = user.getAdditionalInfo(ADDINFO_ADE_FAVORITE_LIST); List<CmsContainerElementBean> favList = new ArrayList<CmsContainerElementBean>(); if (obj instanceof String) { try { JSONArray array = new JSONArray((String) obj); for (int i = 0; i < array.length(); i++) { try { favList.add(elementFromJson(array.getJSONObject(i))); } catch (Throwable e) { // should never happen, catches wrong or no longer existing values LOG.warn(e.getLocalizedMessage()); } } } catch (Throwable e) { // should never happen, catches json parsing LOG.warn(e.getLocalizedMessage()); } } else { // save to be better next time saveFavoriteList(cms, favList); } return favList; }