Example usage for java.lang IllegalAccessException getMessage

List of usage examples for java.lang IllegalAccessException getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:info.donsun.core.utils.Reflections.java

/**
 * ?, private/protected, ??getter./*from ww w.j  a v a2  s.c o m*/
 */
public static Object getFieldValue(final Object obj, final String fieldName) {
    Field field = getAccessibleField(obj, fieldName);

    if (field == null) {
        throw new IllegalArgumentException("Could not find field [" + fieldName + "] on target [" + obj + "]");
    }

    Object result = null;
    try {
        result = field.get(obj);
    } catch (IllegalAccessException e) {
        logger.error("getFieldValue:{}", e.getMessage());
    }
    return result;
}

From source file:org.apache.xml.security.algorithms.SignatureAlgorithm.java

/**
 * Get a SignatureAlgorithmSpi object corresponding to the algorithmURI argument
 *///w ww  .  ja va2s .c o  m
private static SignatureAlgorithmSpi getSignatureAlgorithmSpi(String algorithmURI)
        throws XMLSignatureException {
    try {
        Class<? extends SignatureAlgorithmSpi> implementingClass = algorithmHash.get(algorithmURI);
        if (log.isDebugEnabled()) {
            log.debug("Create URI \"" + algorithmURI + "\" class \"" + implementingClass + "\"");
        }
        return implementingClass.newInstance();
    } catch (IllegalAccessException ex) {
        Object exArgs[] = { algorithmURI, ex.getMessage() };
        throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs, ex);
    } catch (InstantiationException ex) {
        Object exArgs[] = { algorithmURI, ex.getMessage() };
        throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs, ex);
    } catch (NullPointerException ex) {
        Object exArgs[] = { algorithmURI, ex.getMessage() };
        throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs, ex);
    }
}

From source file:com.wineaccess.winelicensedetail.WineLicenseDetailAdapterHelper.java

/**
 * This method is used to view the detail of wine license
 * /*from   w ww  .j a va 2 s.co  m*/
 * @param wineLicenseDetailViewPO
 *            is used to take input in this PO
 * @return output map containing response
 */
public static Map<String, Object> viewWineLicenseDetail(final WineLicenseDetailViewPO wineLicenseDetailViewPO) {

    logger.info("start viewWineLicenseDetail method");

    final Map<String, Object> output = new ConcurrentHashMap<String, Object>();

    Response response = null;
    WineLicenseDetailModel wineLicenseDetailModel = null;
    ProductItemModel productModel = ProductItemRepository
            .getProductItemById(Long.parseLong(wineLicenseDetailViewPO.getProductId()));
    if (productModel == null) {
        response = ApplicationUtils.errorMessageGenerate(

                SystemErrorCode.VIEW_WINE_LICENSE_INVALID_PRODUCT,
                SystemErrorCode.VIEW_WINE_LICENSE_INVALID_PRODUCT_TEXT, SUCCESS_CODE);

        logger.error("productId not exist");
    }

    WineModel wine = null;
    if (response == null) {
        wine = WineRepository.getWineById(productModel.getItemId());
        if (wine == null) {
            // wine not exist
            response = ApplicationUtils.errorMessageGenerate(

                    SystemErrorCode.VIEW_WINE_LICENSE_INVALID_WINE,
                    SystemErrorCode.VIEW_WINE_LICENSE_INVALID_WINE_TEXT, SUCCESS_CODE);

            logger.error("wine not exist");
        }
    }

    if (response == null) {

        wineLicenseDetailModel = WineLicenseDetailRepository.getWineLicenseDetailByWine(wine);

        if (wineLicenseDetailModel == null) {

            WineryLicenseDetailModel wineryLicenseDetailModel = WineryLicenseDetailRepository
                    .getWineryLicenseDetailByWinery(wine.getWineryId());

            if (wineryLicenseDetailModel == null) {
                // WineLicenseDetail not exist
                response = ApplicationUtils.errorMessageGenerate(

                        SystemErrorCode.NO_ENTITY_FOUND, SystemErrorCode.NO_ENTITY_FOUND_TEXT, SUCCESS_CODE);

                logger.error("Wine License detail not exist");
            } else {
                wineLicenseDetailModel = new WineLicenseDetailModel();

                wineLicenseDetailModel.setCaLicenseType(wineryLicenseDetailModel.getCaLicenseType());
                wineLicenseDetailModel.setWine(wine);
                wineLicenseDetailModel.setContractExecuted(wineryLicenseDetailModel.getContractExecuted());
                wineLicenseDetailModel.setShipCompliant(wineryLicenseDetailModel.getShipCompliant());
                wineLicenseDetailModel.setShipEscrowNo(wineryLicenseDetailModel.getShipEscrowNo());

                WineLicenseDetailRepository.save(wineLicenseDetailModel);
            }
        }
    }

    if (response == null) {

        WineLicenseDetailViewVO wineLicenseDetailViewVO = new WineLicenseDetailViewVO();

        try {
            BeanUtils.copyProperties(wineLicenseDetailViewVO, wineLicenseDetailModel);
            wineLicenseDetailViewVO.setProductId(productModel.getId());
        } catch (IllegalAccessException e) {
            logger.error("Error in copying value using bean util " + e.getMessage(), e);
        } catch (InvocationTargetException e) {
            logger.error("Error in copying value using bean util " + e.getMessage(), e);
        }

        wineLicenseDetailViewVO.setWineId(wineLicenseDetailModel.getWine().getId());

        if (wineLicenseDetailModel.getCaLicenseType() != null) {
            wineLicenseDetailViewVO.setCaLicenseTypeId(wineLicenseDetailModel.getCaLicenseType().getId());
        }

        response = new com.wineaccess.response.SuccessResponse(wineLicenseDetailViewVO, SUCCESS_CODE);

    }

    output.put(OUPUT_PARAM_KEY, response);

    logger.info("exit viewWineLicenseDetail method");

    return output;
}

From source file:com.mh.commons.utils.Reflections.java

/**
 * , private/protected, ??setter.// w  ww.  j av  a  2  s .c o m
 */
public static void setFieldValue(final Object object, final String fieldName, final Object value) {
    Field field = getDeclaredField(object, fieldName);

    if (field == null) {
        throw new IllegalArgumentException(
                "Could not find field [" + fieldName + "] on target [" + object + "]");
    }

    makeAccessible(field);

    try {
        field.set(object, value);
    } catch (IllegalAccessException e) {
        if (logger.isDebugEnabled()) {
            logger.error("" + e.getMessage() + ", [ReflectionUtils.setFieldValue]",
                    e);
        }
    }
}

From source file:com.cloud.consoleproxy.ConsoleProxy.java

public static void ensureRoute(String address) {
    if (ensureRouteMethod != null) {
        try {/*w w  w .  java  2  s.  c om*/
            ensureRouteMethod.invoke(ConsoleProxy.context, address);
        } catch (IllegalAccessException e) {
            s_logger.error("Unable to invoke ensureRoute due to " + e.getMessage());
        } catch (InvocationTargetException e) {
            s_logger.error("Unable to invoke ensureRoute due to " + e.getMessage());
        }
    } else {
        s_logger.warn("Unable to find ensureRoute method, console proxy agent is not up to date");
    }
}

From source file:com.sammyun.util.SettingUtils.java

/**
 * ?//from   w ww. j a  v  a2s  .  c o  m
 * 
 * @return 
 */
public static Setting get() {
    Ehcache cache = cacheManager.getEhcache(Setting.CACHE_NAME);
    net.sf.ehcache.Element cacheElement = cache.get(Setting.CACHE_KEY);
    Setting setting;
    if (cacheElement != null) {
        setting = (Setting) cacheElement.getObjectValue();
    } else {
        setting = new Setting();
        try {
            File preschoolEduXmlFile = new ClassPathResource(CommonAttributes.PRESCHOOLEDU_XML_PATH).getFile();
            Document document = new SAXReader().read(preschoolEduXmlFile);
            List<Element> elements = document.selectNodes("/preschoolEdu/setting");
            for (Element element : elements) {
                String name = element.attributeValue("name");
                String value = element.attributeValue("value");
                try {
                    beanUtils.setProperty(setting, name, value);
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            logger.error(e.getMessage());
        }
        cache.put(new net.sf.ehcache.Element(Setting.CACHE_KEY, setting));
    }
    return setting;
}

From source file:org.apache.fop.render.afp.AFPFontConfig.java

private static Typeface getTypeFace(String base14Name) throws ClassNotFoundException {
    try {/* w  ww  .j a va  2 s  .  c  o m*/
        Class<? extends Typeface> clazz = Class.forName("org.apache.fop.fonts.base14." + base14Name)
                .asSubclass(Typeface.class);
        return clazz.newInstance();
    } catch (IllegalAccessException iae) {
        LOG.error(iae.getMessage());
    } catch (ClassNotFoundException cnfe) {
        LOG.error(cnfe.getMessage());
    } catch (InstantiationException ie) {
        LOG.error(ie.getMessage());
    }
    throw new ClassNotFoundException("Couldn't load file for AFP font with base14 name: " + base14Name);
}

From source file:com.cloud.consoleproxy.ConsoleProxy.java

public static void reportLoadInfo(String gsonLoadInfo) {
    if (reportMethod != null) {
        try {//from w  w  w  . ja v a 2  s. c  o m
            reportMethod.invoke(ConsoleProxy.context, gsonLoadInfo);
        } catch (IllegalAccessException e) {
            s_logger.error("Unable to invoke reportLoadInfo due to " + e.getMessage());
        } catch (InvocationTargetException e) {
            s_logger.error("Unable to invoke reportLoadInfo due to " + e.getMessage());
        }
    } else {
        s_logger.warn(
                "Private channel towards management server is not setup. Switch to offline mode and ignore load report");
    }
}

From source file:me.andpay.ti.util.BeanUtils.java

/**
 * <p>Copy property values from the origin bean to the destination bean
 * for all cases where the property names are the same.</p>
 *
 * <p>For more details see <code>BeanUtilsBean</code>.</p>
 *
 * @param dest Destination bean whose properties are modified
 * @param orig Origin bean whose properties are retrieved
 *
 * @exception IllegalAccessException if the caller does not have
 *  access to the property accessor method
 * @exception IllegalArgumentException if the <code>dest</code> or
 *  <code>orig</code> argument is null or if the <code>dest</code> 
 *  property type is different from the source type and the relevant
 *  converter has not been registered.//from w w w. ja  v a  2s.co  m
 * @exception InvocationTargetException if the property accessor method
 *  throws an exception
 * @see BeanUtilsBean#copyProperties
 */
public static void copyProperties(Object dest, Object orig) {
    try {
        org.apache.commons.beanutils.BeanUtils.copyProperties(dest, orig);
    } catch (IllegalAccessException e) {
        throw new RuntimeException(e.getMessage(), e);
    } catch (InvocationTargetException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}

From source file:me.andpay.ti.util.BeanUtils.java

/**
 * <p>Copy the specified property value to the specified destination bean,
 * performing any type conversion that is required.</p>    
 *
 * <p>For more details see <code>BeanUtilsBean</code>.</p>
 *
 * @param bean Bean on which setting is to be performed
 * @param name Property name (can be nested/indexed/mapped/combo)
 * @param value Value to be set//from  w  w  w  .  ja  v a2s .  c  om
 *
 * @exception IllegalAccessException if the caller does not have
 *  access to the property accessor method
 * @exception InvocationTargetException if the property accessor method
 *  throws an exception
 * @see BeanUtilsBean#copyProperty     
 */
public static void copyProperty(Object bean, String name, Object value) {
    try {
        org.apache.commons.beanutils.BeanUtils.copyProperty(bean, name, value);
    } catch (IllegalAccessException e) {
        throw new RuntimeException(e.getMessage(), e);
    } catch (InvocationTargetException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}