code: private BadRequestException getBadRequestException(Exception ex) {
  	    return (BadRequestException) ExceptionUtils
  	            .getThrowables(ex)[ExceptionUtils.indexOfThrowable(ex, BadRequestException.class)];
  	}
docs: Get BadRequestException from the exception
  
  @param ex the exception
  @return BadRequestException