Example usage for java.lang Throwable getLocalizedMessage

List of usage examples for java.lang Throwable getLocalizedMessage

Introduction

In this page you can find the example usage for java.lang Throwable getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:com.runwaysdk.logging.RunwayLog.java

public void error(Object arg0, Throwable arg1) {
    try {// w  ww . j  a v  a2s .c  o  m
        addSessionIdInfo();
        logger.error(arg0, arg1);
        removeSessionIdInfo();
    } catch (Throwable e) {
        System.err.println(e.getLocalizedMessage());
        System.err.println(e.getStackTrace());
    }
}

From source file:com.runwaysdk.logging.RunwayLog.java

public void fatal(Object arg0) {
    try {/*from w w  w. ja va2  s.  c om*/
        addSessionIdInfo();
        logger.fatal(arg0);
        removeSessionIdInfo();
    } catch (Throwable e) {
        System.err.println(e.getLocalizedMessage());
        System.err.println(e.getStackTrace());
    }
}

From source file:com.runwaysdk.logging.RunwayLog.java

public void fatal(Object arg0, Throwable arg1) {
    try {/* w  w  w  . j ava2  s  . c om*/
        addSessionIdInfo();
        logger.fatal(arg0, arg1);
        removeSessionIdInfo();
    } catch (Throwable e) {
        System.err.println(e.getLocalizedMessage());
        System.err.println(e.getStackTrace());
    }
}

From source file:org.pentaho.platform.engine.core.system.SettingsPublisher.java

@Override
public String publish(final IPentahoSession localSession) {
    try {//from w ww.j av a2 s .c  o m
        PentahoSystem.refreshSettings();
    } catch (Throwable t) {
        error(Messages.getInstance().getErrorString("SettingsPublisher.ERROR_0001_PUBLISH_FAILED"), t); //$NON-NLS-1$
        return Messages.getInstance().getString("SettingsPublisher.USER_ERROR_PUBLISH_FAILED") //$NON-NLS-1$
                + t.getLocalizedMessage();
    }
    return Messages.getInstance().getString("SettingsPublisher.USER_SYSTEM_SETTINGS_UPDATED"); //$NON-NLS-1$
}

From source file:org.kalypso.model.wspm.tuhh.core.wspwin.WspWinExportProjectOperation.java

@Override
public IStatus execute(final IProgressMonitor monitor) throws CoreException {
    final IProject[] projects = m_data.getSelectedProjects();

    monitor.beginTask(Messages.getString("org.kalypso.model.wspm.tuhh.core.wspwin.WspWinExporter.0"), //$NON-NLS-1$
            projects.length);//from  ww w.j a v a  2  s  .c  o m

    monitor.subTask(Messages.getString("org.kalypso.model.wspm.tuhh.core.wspwin.WspWinExporter.1")); //$NON-NLS-1$

    for (final IProject project : projects) {
        try {
            exportProject(project, new SubProgressMonitor(monitor, 1));
        } catch (final CoreException e) {
            throw e;
        } catch (final Throwable t) {
            final String message = String.format(Messages.getString("WspWinExporter.0"), //$NON-NLS-1$
                    t.getLocalizedMessage());
            return new Status(IStatus.ERROR, KalypsoModelWspmTuhhCorePlugin.PLUGIN_ID, message, t);
        } finally {
            // clean up
            monitor.done();
        }
    }
    return Status.OK_STATUS;
}

From source file:io.mapzone.controller.ops.VmOperation.java

@Override
protected final IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
    try (UnitOfWork nested = vmUow.get().newUnitOfWork();) {
        monitor = monitor != null ? monitor : new NullProgressMonitor();
        monitor.beginTask(getLabel(), IProgressMonitor.UNKNOWN);

        doWithException(monitor, nested);
        onSuccess(monitor, nested);/*from  w  ww. j a v a2 s  .  c  o m*/
        return monitor != null && monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;
    } catch (Throwable e) {
        log.warn("Error while doWithException() or onSuccess().", e);
        onError(monitor, e);
        return new Status(IStatus.ERROR, ControllerPlugin.ID, e.getLocalizedMessage(), e);
    } finally {
        monitor.done();
    }
}

From source file:org.pentaho.di.ui.repository.pur.PurRepositoryDialog.java

public RepositoryMeta open(final MODE mode) {
    try {// www  . j av  a  2  s .  c  o  m
        SwtXulLoader swtLoader = new SwtXulLoader();
        swtLoader.setOuterContext(parent);
        swtLoader.registerClassLoader(getClass().getClassLoader());
        container = swtLoader.loadXul("org/pentaho/di/ui/repository/pur/xul/pur-repository-config-dialog.xul", //$NON-NLS-1$
                resourceBundle);
        final XulRunner runner = new SwtXulRunner();
        runner.addContainer(container);
        parent.addDisposeListener(new DisposeListener() {

            public void widgetDisposed(DisposeEvent arg0) {
                hide();
            }

        });
        repositoryConfigController.setMessages(resourceBundle);
        repositoryConfigController.setRepositoryMeta(repositoryMeta);
        repositoryConfigController.setCallback(new IRepositoryConfigDialogCallback() {

            public void onSuccess(PurRepositoryMeta meta) {
                // If repository does not have a name then send back a null repository meta
                if (meta.getName() != null) {
                    // If MODE is ADD then check if the repository name does not exist in the repository list then close this
                    // dialog
                    // If MODE is EDIT then check if the repository name is the same as before if not check if the new name does
                    // not exist in the repository. Otherwise return true to this method, which will mean that repository
                    // already exist
                    if (mode == MODE.ADD) {
                        if (masterRepositoriesMeta.searchRepository(meta.getName()) == null) {
                            repositoryMeta = meta;
                            hide();
                        } else {
                            displayRepositoryAlreadyExistMessage(meta.getName());
                        }
                    } else {
                        if (masterRepositoryName.equals(meta.getName())) {
                            repositoryMeta = meta;
                            hide();
                        } else if (masterRepositoriesMeta.searchRepository(meta.getName()) == null) {
                            repositoryMeta = meta;
                            hide();
                        } else {
                            displayRepositoryAlreadyExistMessage(meta.getName());
                        }
                    }
                }
            }

            public void onError(Throwable t) {
                SpoonFactory.getInstance().messageBox(t.getLocalizedMessage(),
                        resourceBundle.getString("RepositoryConfigDialog.InitializationFailed"), false, //$NON-NLS-1$
                        Const.ERROR);
                log.error(resourceBundle.getString("RepositoryConfigDialog.ErrorStartingXulApplication"), t);//$NON-NLS-1$
            }

            public void onCancel() {
                repositoryMeta = null;
                hide();
            }
        });
        container.addEventHandler(repositoryConfigController);

        try {
            runner.initialize();
            show();
        } catch (XulException e) {
            SpoonFactory.getInstance().messageBox(e.getLocalizedMessage(),
                    resourceBundle.getString("RepositoryConfigDialog.InitializationFailed"), false, //$NON-NLS-1$
                    Const.ERROR);
            log.error(resourceBundle.getString("RepositoryConfigDialog.ErrorStartingXulApplication"), e);//$NON-NLS-1$
        }
    } catch (XulException e) {
        log.error(resourceBundle.getString("RepositoryConfigDialog.ErrorStartingXulApplication"), e);//$NON-NLS-1$
    }
    return repositoryMeta;
}

From source file:org.pentaho.platform.engine.core.system.GlobalListsPublisher.java

@Override
public String publish(final IPentahoSession localSession) {
    try {/*from www.  java2s  . co m*/
        PentahoSystem.clearGlobals();
        PentahoSystem.globalStartup(localSession);
    } catch (Throwable t) {
        error(Messages.getInstance().getErrorString("GlobalListsPublisher.ERROR_0001_PUBLISH_FAILED"), t); //$NON-NLS-1$
        return Messages.getInstance().getString("GlobalListsPublisher.USER_ERROR_PUBLISH_FAILED") //$NON-NLS-1$
                + t.getLocalizedMessage();
    }
    return Messages.getInstance().getString("GlobalListsPublisher.USER_SYSTEM_SETTINGS_UPDATED"); //$NON-NLS-1$
}

From source file:com.consol.citrus.admin.process.listener.WebSocketProcessListener.java

@Override
public void onProcessFail(String processId, Throwable e) {
    messagingTemplate.convertAndSend(TOPIC_LOG_OUTPUT,
            SocketEvent.createEvent(processId, SocketEvent.PROCESS_FAILED,
                    "process failed with exception " + e.getLocalizedMessage() + System.lineSeparator()));
}

From source file:org.deegree.maven.WorkspaceMojo.java

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    Log log = getLog();/*from ww  w . j  a  v a 2  s. co  m*/
    File dir = determineWorkspaceDirectory();
    ZipOutputStream out = null;
    try {
        Set<?> artifacts = getDependencyArtifacts(project, artifactResolver, artifactFactory, metadataSource,
                localRepository, "deegree-workspace", true);
        List<Artifact> workspaces = new ArrayList<Artifact>();
        for (Object o : artifacts) {
            workspaces.add((Artifact) o);
        }
        reverse(workspaces);

        Set<?> jarDeps = getDependencyArtifacts(project, artifactResolver, artifactFactory, metadataSource,
                localRepository, "jar", false);

        File target = new File(project.getBasedir(), "target");
        if (!target.exists() && !target.mkdirs()) {
            throw new MojoFailureException("Could not create target directory!");
        }
        File workspaceFile = new File(project.getBasedir(),
                "target/" + project.getArtifactId() + "-" + project.getVersion() + ".deegree-workspace");
        OutputStream os = new FileOutputStream(workspaceFile);
        out = new ZipOutputStream(os);

        HashSet<String> visitedFiles = new HashSet<String>();
        ZipUtils.zip(dir, out, dir.getAbsoluteFile().toURI(), visitedFiles);

        ZipUtils.zipModules(jarDeps, visitedFiles, out);
        ZipUtils.zipJarDependencies(jarDeps, log, visitedFiles, out);

        ZipUtils.integrateWorkspaces(workspaces, log, target, out, visitedFiles);

        attachArtifact(log, workspaceFile);
    } catch (Throwable e) {
        log.debug(e);
        throw new MojoFailureException("Could not create workspace zip artifact: " + e.getLocalizedMessage(),
                e);
    } finally {
        closeQuietly(out);
    }
}