Retrieving causes from InvalidValueException

Hi,

I’m trying to validate an inputform at once, without using the fieldvalidation possibilities. I’m doing this by overriding de validate() method of the form. In this method I put all the validations. For every validationerror I add an InvalidValueException to an array. Finally this array is added as causes to a new InvalidValueException which is thrown to a screen (VerticalLayout object). In the screen I want to retrieve all the InvalidValueException added in the array. How do I retrieve this InvalidValueException from the causes. As far as I can see, the causes are a final field in the without any possibilities to retrieve it.

My code on the form is:
public void validate() throws InvalidValueException {
super.validate();
InvalidValueException failureException = new InvalidValueException[100]
;
ArrayList failures = new ArrayList();
// validate mandatory fields
if (StringUtils.isEmpty(getCollectionCountryCode())){
failures.add(new InvalidValueException(“Collection country code is empty”));
}
if (StringUtils.isEmpty(getCollectionProvince()) && StringUtils.isEmpty(getCollectionLocation())){
failures.add(new InvalidValueException(“Either province or location should be entered”));
}
if (!failures.isEmpty()){
throw new InvalidValueException("Messages: ", failures.toArray((InvalidValueException) failureException));
}
}

I want to retrieve the object in “failures”. Any suggestions are welcome.

Thanks in advance,
Jolanda

Hi, you should try out a 6.4 nightly. InvalidValueException.getCauses() was added there some time ago (http://dev.vaadin.com/ticket/2228).