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:org.opencms.ade.configuration.CmsGlobalConfigurationCacheEventHandler.java

/**
 * Removes a resource from the online caches.<p>
 *
 * @param resource the resource to remove
 */// w w  w. j a  v  a  2  s  . c o m
protected void onlineCacheRemove(CmsPublishedResource resource) {

    for (CachePair cachePair : m_caches) {
        try {
            cachePair.getOnlineCache().remove(resource);
        } catch (Throwable e) {
            LOG.error(e.getLocalizedMessage());
        }
    }
}

From source file:org.opencms.ade.configuration.CmsGlobalConfigurationCacheEventHandler.java

/**
 * Updates a resource in the online caches.<p>
 *
 * @param resource the resource to update
 *///from w w  w  .j  av  a  2  s.com
protected void onlineCacheUpdate(CmsResource resource) {

    for (CachePair cachePair : m_caches) {
        try {
            cachePair.getOnlineCache().update(resource);
        } catch (Throwable e) {
            LOG.error(e.getLocalizedMessage());
        }
    }
}

From source file:com.kylinolap.job.flow.JobFlowListener.java

private 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  ww.  ja v  a2s. com*/
        JobInstance jobInstance = JobDAO.getInstance(config).getJob(jobInstanceUuid);
        jobInstance.getSteps().get(jobInstanceStepSeqId).setStatus(JobStepStatusEnum.ERROR);
        // String output =
        // jobInstance.getSteps().get(jobInstanceStepSeqId).getCmdOutput();
        // jobInstance.getSteps().get(jobInstanceStepSeqId).setCmdOutput(output
        // + "\n" + exceptionMsg);
        jobInstance.getSteps().get(jobInstanceStepSeqId).setExecEndTime(System.currentTimeMillis());
        JobDAO.getInstance(config).updateJobInstance(jobInstance);

        String output = JobDAO.getInstance(config).getJobOutput(jobInstanceUuid, jobInstanceStepSeqId)
                .getOutput();
        output = output + "\n" + exceptionMsg;
        JobDAO.getInstance(config).saveJobOutput(jobInstanceUuid, jobInstanceStepSeqId, output);
    } catch (IOException e1) {
        log.error(e1.getLocalizedMessage(), e1);
    }
}

From source file:org.opencms.ade.configuration.CmsGlobalConfigurationCacheEventHandler.java

/**
 * Updates a resource in the offline caches.<p>
 *
 * @param resource the resource to update
 *//*from  w  w w .  jav a2s .c o m*/
protected void offlineCacheUpdate(CmsPublishedResource resource) {

    for (CachePair cachePair : m_caches) {
        try {
            cachePair.getOfflineCache().update(resource);
        } catch (Throwable e) {
            LOG.error(e.getLocalizedMessage());
        }
    }

}

From source file:org.opencms.ade.configuration.CmsGlobalConfigurationCacheEventHandler.java

/**
 * Updates a resource in the offline caches.<p>
 *
 * @param resource the resource to update
 *//*from  w  w  w  .j  a va  2  s .c om*/
protected void offlineCacheUpdate(CmsResource resource) {

    for (CachePair cachePair : m_caches) {
        try {
            cachePair.getOfflineCache().update(resource);
        } catch (Throwable e) {
            LOG.error(e.getLocalizedMessage());
        }
    }

}

From source file:org.opencms.ade.configuration.CmsGlobalConfigurationCacheEventHandler.java

/**
 * Removes a resource from the online caches.<p>
 *
 * @param resource the resource to remove
 *///from   w w w. ja  v a  2s.  c o m
protected void onlineCacheRemove(CmsResource resource) {

    for (CachePair cachePair : m_caches) {
        try {
            cachePair.getOnlineCache().remove(resource);
        } catch (Throwable e) {
            LOG.error(e.getLocalizedMessage());
        }
    }

}

From source file:org.opencms.ade.configuration.CmsGlobalConfigurationCacheEventHandler.java

/**
 * Updates a resource in the online caches.<p>
 *
 * @param resource the resource to update
 *//* w  w  w . j  a va  2s.c o m*/
protected void onlineCacheUpdate(CmsPublishedResource resource) {

    for (CachePair cachePair : m_caches) {
        try {
            cachePair.getOnlineCache().update(resource);
        } catch (Throwable e) {
            LOG.error(e.getLocalizedMessage());
        }
    }

}

From source file:org.deegree.services.wms.SldStyleBuilder.java

void parse(String layerName, XMLAdapter adapter, List<SLDStyleType> styles) {
    File stylesDir = new File(workspace.getLocation(), "styles");

    for (SLDStyleType sty : styles) {
        try {//from  w w w. j  a  v a 2 s . co m
            File file = new File(adapter.resolve(sty.getFile()).toURI());

            String namedLayer = sty.getNamedLayer();
            LOG.debug("Will read styles from SLD '{}', for named layer '{}'.", file, namedLayer);
            Map<String, String> map = new HashMap<String, String>();
            Map<String, Pair<File, URL>> legends = new HashMap<String, Pair<File, URL>>();
            Map<String, Boolean> glgUrls = new HashMap<String, Boolean>();
            extractFromSld(sty, adapter, stylesDir, layerName, legends, glgUrls, map);

            if (file.getParentFile().equals(stylesDir)) {
                handleSldFromStyleStore(file, namedLayer, map, layerName, legends, glgUrls);
            }

            handleExternalSld(file, namedLayer, layerName, map, legends, glgUrls);
        } catch (Throwable e) {
            LOG.trace("Stack trace", e);
            LOG.info("Style file '{}' for layer '{}' could not be parsed: '{}'.",
                    new Object[] { sty.getFile(), layerName, e.getLocalizedMessage() });
        }
    }
}

From source file:org.opencms.loader.CmsTemplateContextManager.java

/**
 * Retrieves an instance of a template context provider given its name (optionally prefixed by the 'dynamic:' prefix).<p>
 *
 * @param providerName the name of the provider
 *
 * @return an instance of the provider class
 *///www  .ja va 2 s  .  c  o  m
public I_CmsTemplateContextProvider getTemplateContextProvider(String providerName) {

    providerName = providerName.trim();
    providerName = removePropertyPrefix(providerName);
    String providerClassName = providerName;
    String providerConfig = "";

    // get provider configuration string if available
    int separatorIndex = providerName.indexOf(",");
    if (separatorIndex > 0) {
        providerClassName = providerName.substring(0, separatorIndex);
        providerConfig = providerName.substring(separatorIndex + 1);
    }

    I_CmsTemplateContextProvider result = m_providerInstances.get(providerName);
    if (result == null) {
        try {
            Class<?> providerClass = Class.forName(providerClassName);
            if (I_CmsTemplateContextProvider.class.isAssignableFrom(providerClass)) {
                result = (I_CmsTemplateContextProvider) providerClass.newInstance();
                result.initialize(m_cms, providerConfig);
                //note: we use the provider name as a key here, which includes configuration parameters
                m_providerInstances.put(providerName, result);
            }
        } catch (Throwable t) {
            LOG.error(t.getLocalizedMessage(), t);
        }
    }
    return result;
}

From source file:org.deegree.commons.config.AbstractResourceManager.java

@Override
public void startup(DeegreeWorkspace workspace) throws ResourceInitException {

    this.workspace = workspace;
    ResourceManagerMetadata<T> md = getMetadata();
    if (md != null) {
        for (ResourceProvider p : md.getResourceProviders()) {
            ((ExtendedResourceProvider<?>) p).init(workspace);
            nsToProvider.put(p.getConfigNamespace(), (ExtendedResourceProvider<T>) p);
        }//from www .ja  va2s. c o  m

        dir = new File(workspace.getLocation(), md.getPath());
        name = md.getName();
        if (!dir.exists()) {
            LOG.info("No '{}' directory -- skipping initialization of {}.", md.getPath(), name);
            return;
        }
        LOG.info("--------------------------------------------------------------------------------");
        LOG.info("Setting up {}.", name);
        LOG.info("--------------------------------------------------------------------------------");

        List<File> files = getFiles();

        for (File configFile : files) {
            try {
                ResourceState<T> state = processResourceConfig(configFile);
                if (state == null) {
                    continue;
                }
                idToState.put(state.getId(), state);
            } catch (Throwable t) {
                LOG.error("Could not create resource: {}", t.getLocalizedMessage());
                if (t.getCause() != null) {
                    LOG.error("Cause was: {}", t.getCause().getLocalizedMessage());
                }
                LOG.trace("Stack trace:", t);
            }
        }
        LOG.info("");
    }
}