Example usage for org.springframework.beans InvalidPropertyException getMostSpecificCause

List of usage examples for org.springframework.beans InvalidPropertyException getMostSpecificCause

Introduction

In this page you can find the example usage for org.springframework.beans InvalidPropertyException getMostSpecificCause.

Prototype

public Throwable getMostSpecificCause() 

Source Link

Document

Retrieve the most specific cause of this exception, that is, either the innermost cause (root cause) or this exception itself.

Usage

From source file:gov.nih.nci.cabig.ctms.web.WebTools.java

public static SortedMap<String, Object> requestPropertiesToMap(HttpServletRequest request) {
    BeanWrapper wrapped = new BeanWrapperImpl(request);
    SortedMap<String, Object> map = new TreeMap<String, Object>();
    for (PropertyDescriptor descriptor : wrapped.getPropertyDescriptors()) {
        String name = descriptor.getName();
        if (!EXCLUDED_REQUEST_PROPERTIES.contains(name) && descriptor.getReadMethod() != null) {
            Object propertyValue;
            try {
                propertyValue = wrapped.getPropertyValue(name);
            } catch (InvalidPropertyException e) {
                log.debug("Exception reading request property " + name, e);
                propertyValue = e.getMostSpecificCause();
            }/*from ww w  .j av a 2 s .c  o m*/
            map.put(name, propertyValue);
        }
    }
    return map;
}