Example usage for java.lang IllegalAccessException getLocalizedMessage

List of usage examples for java.lang IllegalAccessException getLocalizedMessage

Introduction

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

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:org.geoserver.cluster.impl.handlers.catalog.CatalogUtils.java

public static LayerGroupInfo localizeLayerGroup(final LayerGroupInfo info, final Catalog catalog)
        throws IllegalAccessException, InvocationTargetException {
    if (info == null || catalog == null)
        throw new NullArgumentException("Arguments may never be null");

    // make sure we use the prefixed name to include the workspace
    final LayerGroupInfo localObject = catalog.getLayerGroupByName(info.prefixedName());

    if (localObject != null) {
        return localObject;
    }//from  ww w.  j a va2 s . c o m

    try {
        info.getLayers().addAll(localizeLayers(info.getLayers(), catalog));
    } catch (IllegalAccessException e) {
        if (LOGGER.isLoggable(java.util.logging.Level.SEVERE))
            LOGGER.severe(e.getLocalizedMessage());
        throw e;
    } catch (InvocationTargetException e) {
        if (LOGGER.isLoggable(java.util.logging.Level.SEVERE))
            LOGGER.severe(e.getLocalizedMessage());
        throw e;
    }

    // make sure catalog transient fields are properly initiated
    List<PublishedInfo> layers = info.getLayers();
    if (layers != null) {
        for (PublishedInfo layer : layers) {
            if (layer instanceof LayerInfo) {
                ResourceInfo resource = ((LayerInfo) layer).getResource();
                if (resource == null) {
                    continue;
                }
                StoreInfo store = resource.getStore();
                // we need the non proxy instance
                store = ModificationProxy.unwrap(store);
                if (store instanceof StoreInfoImpl) {
                    // setting the catalog
                    ((StoreInfoImpl) store).setCatalog(catalog);
                }
            }
        }
    }

    // localize layers
    info.getStyles().addAll(localizeStyles(new HashSet<StyleInfo>(info.getStyles()), catalog));

    // attach to the catalog
    final CatalogBuilder builder = new CatalogBuilder(catalog);
    builder.attach(info);
    return info;

}

From source file:org.opencms.workplace.CmsWorkplace.java

/**
 * Fills all class parameter values from the data provided in the current request.<p>
 * /*w w w . ja  v a  2s .c o m*/
 * All methods that start with "setParam" are possible candidates to be
 * automatically filled. The remaining part of the method name is converted
 * to lower case. Then a parameter of this name is searched in the request parameters.
 * If the parameter is found, the "setParam" method is automatically invoked 
 * by reflection with the value of the parameter.<p>
 * 
 * @param request the current JSP request
 */
@SuppressWarnings("unchecked")
public void fillParamValues(HttpServletRequest request) {

    m_parameterMap = null;
    // ensure a multipart request is parsed only once (for "forward" scenarios with reports)
    if (null == request.getAttribute(REQUEST_ATTRIBUTE_MULTIPART)) {
        // check if this is a multipart request 
        m_multiPartFileItems = CmsRequestUtil.readMultipartFileItems(request);
        if (m_multiPartFileItems != null) {
            // this was indeed a multipart form request
            m_parameterMap = CmsRequestUtil.readParameterMapFromMultiPart(
                    getCms().getRequestContext().getEncoding(), m_multiPartFileItems);
            request.setAttribute(REQUEST_ATTRIBUTE_MULTIPART, Boolean.TRUE);
        }
    }
    if (m_parameterMap == null) {
        // the request was a "normal" request
        m_parameterMap = request.getParameterMap();
    }

    List<Method> methods = paramSetMethods();
    Iterator<Method> i = methods.iterator();
    while (i.hasNext()) {
        Method m = i.next();
        String name = m.getName().substring(8).toLowerCase();
        String[] values = m_parameterMap.get(name);
        String value = null;
        if (values != null) {
            // get the parameter value from the map
            value = values[0];
        }
        if (CmsStringUtil.isEmpty(value)) {
            value = null;
        }

        // TODO: this is very dangerous since most of the dialogs does not send encoded data
        // and by decoding not encoded data the data will get corrupted, for instance '1+2' will become '1 2'.
        // we should ensure that we decode the data only if the data has been encoded
        value = decodeParamValue(name, value);
        try {
            if (LOG.isDebugEnabled() && (value != null)) {
                LOG.debug(Messages.get().getBundle().key(Messages.LOG_SET_PARAM_2, m.getName(), value));
            }
            m.invoke(this, new Object[] { value });
        } catch (InvocationTargetException ite) {
            // can usually be ignored
            if (LOG.isInfoEnabled()) {
                LOG.info(ite.getLocalizedMessage());
            }
        } catch (IllegalAccessException eae) {
            // can usually be ignored
            if (LOG.isInfoEnabled()) {
                LOG.info(eae.getLocalizedMessage());
            }
        }
    }
}

From source file:org.opencms.workplace.CmsWorkplace.java

/**
 * Returns the values of all parameter methods of this workplace class instance.<p>
 * /* w w  w.  ja v a  2s .c om*/
 * @return the values of all parameter methods of this workplace class instance
 */
protected Map<String, Object> paramValues() {

    List<Method> methods = paramGetMethods();
    Map<String, Object> map = new HashMap<String, Object>(methods.size());
    Iterator<Method> i = methods.iterator();
    while (i.hasNext()) {
        Method m = i.next();
        Object o = null;
        try {
            o = m.invoke(this, new Object[0]);
        } catch (InvocationTargetException ite) {
            // can usually be ignored
            if (LOG.isInfoEnabled()) {
                LOG.info(ite.getLocalizedMessage());
            }
        } catch (IllegalAccessException eae) {
            // can usually be ignored
            if (LOG.isInfoEnabled()) {
                LOG.info(eae.getLocalizedMessage());
            }
        }
        if (o != null) {
            map.put(m.getName().substring(8).toLowerCase(), o);
        }
    }
    return map;
}

From source file:org.pentaho.platform.dataaccess.client.ConnectionServiceClient.java

/**
 * Returns an object for the specified class. 
 * This is in the ObjectSupplier interface used by
 * the BeanUtil deserialize methods.//  w ww .  j a  va2 s  .co  m
 */
public Object getObject(Class clazz) throws AxisFault {

    try {
        System.out.println(clazz.getCanonicalName());
        Constructor[] cons = clazz.getConstructors();
        if (cons.length > 0) {
            return clazz.newInstance();
        }
        return null;
    } catch (IllegalAccessException e) {
        throw new AxisFault(e.getLocalizedMessage(), e);
    } catch (InstantiationException e) {
        throw new AxisFault(e.getLocalizedMessage(), e);
    }
}