Example usage for java.text ParseException getLocalizedMessage

List of usage examples for java.text ParseException getLocalizedMessage

Introduction

In this page you can find the example usage for java.text ParseException getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:org.openestate.io.idx.IdxRecord.java

@Deprecated
public Calendar getPublishUntil() {
    try {/*  w  w  w  . j  a  va 2 s .c  om*/
        return IdxFormat.parseDateAsCalendar(this.get(FIELD_PUBLISH_UNTIL));
    } catch (ParseException ex) {
        LOGGER.warn("Can't read publish until date!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.openestate.io.idx.IdxRecord.java

public Calendar getLastModified() {
    try {/*from   w  w  w.j  a  v  a  2s.  c  o  m*/
        return IdxFormat.parseDateTimeAsCalendar(this.get(FIELD_LAST_MODIFIED));
    } catch (ParseException ex) {
        LOGGER.warn("Can't read last modification date!");
        LOGGER.warn("> " + ex.getLocalizedMessage(), ex);
        return null;
    }
}

From source file:org.dd4t.core.factories.impl.ComponentPresentationFactoryImpl.java

/**
 * Get the component by the component uri and template uri.
 * but NO CT rendering (so from the Dynamic Template Tab) should take place,
 * as this is done in a View/*from   w  ww .ja  v  a  2s.  com*/
 * <p/>
 * Null values should be handled in the controller
 * <p/>
 * The Content Service should use ComponentPresentationFactory.getComponentPresentation(int publicationId, int componentId, int templateId)
 * OR
 * ComponentPresentationAssembler.getContent(int componentId, int componentTemplateId)
 * if we want to use REL linking. :)
 * Metadata should be added into the DD4T stack @ publishtime
 * Rendered output is cached in output cache
 *
 * @return the component
 * @throws org.dd4t.core.exceptions.FactoryException if no item found NotAuthorizedException if the user is not authorized to get the component
 */
@Override
public ComponentPresentation getComponentPresentation(String componentURI, String templateURI)
        throws FactoryException {
    LOG.debug("Enter getComponentPresentation with componentURI: {} and templateURI: {}", componentURI,
            templateURI);

    if (StringUtils.isEmpty(templateURI)) {
        throw new ItemNotFoundException("Provide a CT view or TCMURI");
    }

    final TCMURI componentTcmUri;
    final TCMURI templateTcmUri;
    try {
        componentTcmUri = new TCMURI(componentURI);
        templateTcmUri = new TCMURI(templateURI);
    } catch (ParseException e) {
        throw new ItemNotFoundException(e);
    }
    componentURI = componentTcmUri.toString();
    int publicationId = componentTcmUri.getPublicationId();
    int componentId = componentTcmUri.getItemId();
    int templateId = templateTcmUri.getItemId();

    String key = getKey(publicationId, componentId, templateId);
    CacheElement<ComponentPresentation> cacheElement = cacheProvider.loadPayloadFromLocalCache(key);

    ComponentPresentation componentPresentation;

    if (cacheElement.isExpired()) {
        synchronized (cacheElement) {
            if (cacheElement.isExpired()) {
                cacheElement.setExpired(false);
                componentPresentation = componentPresentationProvider
                        .getDynamicComponentPresentation(componentId, templateId, publicationId);

                if (componentPresentation == null) {

                    cacheElement.setPayload(null);
                    cacheProvider.storeInItemCache(key, cacheElement);
                    throw new ItemNotFoundException(
                            String.format("Could not find DCP with componentURI: %s and templateURI: %s",
                                    componentURI, templateURI));
                }

                // Building STMs here.
                componentPresentation = DataBindFactory.buildDynamicComponentPresentation(componentPresentation,
                        ComponentImpl.class);

                LOG.debug("Running pre caching processors");
                this.executeProcessors(componentPresentation.getComponent(), RunPhase.BEFORE_CACHING,
                        getRequestContext());
                cacheElement.setPayload(componentPresentation);
                cacheProvider.storeInItemCache(key, cacheElement, publicationId, componentId);
                LOG.debug("Added component with uri: {} and template: {} to cache", componentURI, templateURI);

            } else {
                LOG.debug("Return component for componentURI: {} and templateURI: {} from cache", componentURI,
                        templateURI);
                componentPresentation = cacheElement.getPayload();
            }
        }
    } else {
        LOG.debug("Return component for componentURI: {} and templateURI: {} from cache", componentURI,
                templateURI);
        componentPresentation = cacheElement.getPayload();
    }

    if (componentPresentation != null) {
        LOG.debug("Running Post caching Processors");
        try {
            this.executeProcessors(componentPresentation.getComponent(), RunPhase.AFTER_CACHING,
                    getRequestContext());
        } catch (ProcessorException e) {
            LOG.error(e.getLocalizedMessage(), e);
        }
    }

    LOG.debug("Exit getComponentPresentation");
    return componentPresentation;
}