List of usage examples for org.springframework.beans PropertyBatchUpdateException PropertyBatchUpdateException
public PropertyBatchUpdateException(PropertyAccessException[] propertyAccessExceptions)
From source file:org.nextframework.controller.ExtendedBeanWrapper.java
public void setPropertyValues(PropertyValues propertyValues, boolean ignoreUnknown) throws BeansException { List propertyAccessExceptions = new ArrayList(); PropertyValue[] pvs = propertyValues.getPropertyValues(); for (int i = 0; i < pvs.length; i++) { try {/* w w w .j a v a 2s . c o m*/ // This method may throw any BeansException, which won't be caught // here, if there is a critical failure such as no matching field. // We can attempt to deal only with less serious exceptions. setPropertyValue(pvs[i]); } catch (NotWritablePropertyException ex) { if (!ignoreUnknown) { throw ex; } // Otherwise, just ignore it and continue... } catch (PropertyAccessException ex) { propertyAccessExceptions.add(ex); } } // If we encountered individual exceptions, throw the composite exception. if (!propertyAccessExceptions.isEmpty()) { Object[] paeArray = propertyAccessExceptions .toArray(new PropertyAccessException[propertyAccessExceptions.size()]); throw new PropertyBatchUpdateException((PropertyAccessException[]) paeArray); } }