public void afterThrowing ( Method m , Object [ ] args , Object target , ConstraintViolationException e ) { Logger log = LoggerFactory . getLogger ( target . getClass ( ) ) ; StringBuilder logText = new StringBuilder ( excMessage ( e ) ) ; if ( e . getConstraintViolations ( ) != null && e . getConstraintViolations ( ) . size ( ) > 0 ) { for ( ConstraintViolation < ? > each : e . getConstraintViolations ( ) ) { logText . append ( " : " ) . append ( each . getPropertyPath ( ) ) . append ( " " ) ; logText . append ( "'" ) . append ( each . getMessage ( ) ) . append ( "'" ) ; logText . append ( " " ) ; logText . append ( each . getPropertyPath ( ) ) . append ( "=" ) ; logText . append ( each . getInvalidValue ( ) ) ; } // TODO: find better solution logText . append ( " rootBean=" ) . append ( e . getConstraintViolations ( ) . iterator ( ) . next ( ) . getRootBean ( ) ) ; } if ( isJmsContext ( ) ) { LogMessage message = new LogMessage ( mapLogCode ( mapLogCode ( ValidationException . ERROR_CODE ) ) , logText . toString ( ) ) ; log . error ( "{}" , message ) ; } else { LogMessage message = new LogMessage ( mapLogCode ( ValidationException . ERROR_CODE ) , logText . toString ( ) ) ; log . debug ( "{}" , message ) ; } ValidationException newException = new ValidationException ( excMessage ( e ) ) ; newException . setLogged ( true ) ; newException . setConstraintViolations ( e . getConstraintViolations ( ) ) ; throw newException ; }
Handles validation exception