@Override public String getMessage() { StringWriter sw = new StringWriter(); sw.append(super.getMessage()); if (getValidationResponse() != null) { if (getValidationResponse().getValidationErrors().size() > 0) { sw.append("\nValidation errors follows:\n"); for (ValidationMessage error : getValidationResponse().getValidationErrors()) { sw.append(error.toString()); } sw.append("\n"); } if (getValidationResponse().getValidationWarnings().size() > 0) { sw.append("\nValidation warnings follows:\n"); for (ValidationMessage warning : getValidationResponse().getValidationWarnings()) { sw.append(warning.toString()); } sw.append("\n"); } } return sw.toString(); }
public String getMessage() { StringWriter sw = new StringWriter(); sw.append( super.getMessage() ); if ( getValidationResponse() != null ) { if ( getValidationResponse().getValidationErrors().size() > 0 ) { sw.append( "\nValidation errors follows:\n" ); for ( ValidationMessage error : getValidationResponse().getValidationErrors() ) { sw.append( error.toString() ); } sw.append( "\n" ); } if ( getValidationResponse().getValidationWarnings().size() > 0 ) { sw.append( "\nValidation warnings follows:\n" ); for ( ValidationMessage warning : getValidationResponse().getValidationWarnings() ) { sw.append( warning.toString() ); } sw.append( "\n" ); } } return sw.toString(); }
protected void handleConfigurationException(InvalidConfigurationException e) throws PlexusResourceException { getLogger().debug("Configuration error!", e); ErrorResponse nexusErrorResponse = new ErrorResponse(); ValidationResponse vr = ((InvalidConfigurationException) e).getValidationResponse(); if (vr != null && vr.getValidationErrors().size() > 0) { for (ValidationMessage vm : vr.getValidationErrors()) { nexusErrorResponse.addError(createNexusError(vm.getKey(), vm.getShortMessage())); } } else { nexusErrorResponse.addError(createNexusError("*", e.getMessage())); } throw new PlexusResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Configuration error.", nexusErrorResponse); }
protected void handleConfigurationException( InvalidConfigurationException e ) throws PlexusResourceException { getLogger().warn( "Configuration error!", e ); ErrorResponse nexusErrorResponse = new ErrorResponse(); ValidationResponse vr = ( (InvalidConfigurationException) e ).getValidationResponse(); if ( vr != null && vr.getValidationErrors().size() > 0 ) { for ( ValidationMessage vm : vr.getValidationErrors() ) { nexusErrorResponse.addError( createNexusError( vm.getKey(), vm.getShortMessage() ) ); } } else { nexusErrorResponse.addError( createNexusError( "*", e.getMessage() ) ); } throw new PlexusResourceException( Status.CLIENT_ERROR_BAD_REQUEST, "Configuration error.", nexusErrorResponse ); }