How to get only nested exception message form spring validation?

Solution for How to get only nested exception message form spring validation?
is Given Below:



I’ve prepared BigDecimalEditor class, that extends PropertyEditorSupport and it works OK – it throws NumberFormatException from overridden setAsText(String text) method.
Next I’ve prepared CustomBindingErrorProcessor, that extends DefaultBindingErrorProcessor where the method processPropertyAccessException(PropertyAccessException accessException, BindingResult bindingResult) is overridden as follows:

   public void processPropertyAccessException(PropertyAccessException accessException, 
                                           BindingResult bindingResult) {

    // overwrites NumberFormatException error message
    if(accessException.getCause() instanceof NumberFormatException){

        String fieldName = accessException.getPropertyChangeEvent().getPropertyName();
        String exceptionError = accessException.getCause().getMessage();

        FieldError fieldError = new FieldError(fieldName,
                                               fieldName + ": " + exceptionError);

        super.processPropertyAccessException(accessException, bindingResult);


and still it displays (near validated form field) such a very long message:

Failed to convert property value of type java.lang.String to required type java.math.BigDecimal for property height; nested exception is java.lang.NumberFormatException: The Number not recognized!

if text contains two commas for example.

The question is – how to get to the message of the nested exception only “The Number not recognized!”

here a link that speak about it link here

i was able to resolve it, since the adding: wrong