/** * Factory method to create a new <code>BadRequestException</code> with the * noTarget SCIM detailed error keyword. * * @param errorMessage The error message for this SCIM exception. * @return The new <code>BadRequestException</code>. */ public static BadRequestException noTarget(final String errorMessage) { return new BadRequestException(errorMessage, NO_TARGET); }
/** * Create a new remove patch operation. * * @param path The path targeted by this patch operation. * @throws ScimException If a path is null. */ @JsonCreator private RemoveOperation( @JsonProperty(value = "path", required = true) final Path path) throws ScimException { super(path); if(path == null) { throw BadRequestException.noTarget( "path field must not be null for remove operations"); } }
/** * Throws an exception if there are schema validation errors. The exception * will contain all of the syntax errors, mutability errors or path issues * (in that order of precedence). The exception message will be the content * of baseExceptionMessage followed by a space delimited list of all of the * issues of the type (syntax, mutability, or path) being reported. * * @throws BadRequestException if issues are found during schema checking. */ public void throwSchemaExceptions() throws BadRequestException { if(syntaxIssues.size() > 0) { throw BadRequestException.invalidSyntax(getErrorString(syntaxIssues)); } if(mutabilityIssues.size() > 0) { throw BadRequestException.mutability(getErrorString(mutabilityIssues)); } if(pathIssues.size() > 0) { throw BadRequestException.invalidPath(getErrorString(pathIssues)); } if(filterIssues.size() > 0) { throw BadRequestException.invalidFilter(getErrorString(filterIssues)); } }
Assert.assertEquals(caughtException.getMessage(), expectedMsg); Assert.assertEquals(caughtException.getScimError().getScimType(), BadRequestException.INVALID_SYNTAX); } else if (!mutabilityIssues.isEmpty()) Assert.assertEquals(caughtException.getScimError().getScimType(), BadRequestException.MUTABILITY); Assert.assertEquals(caughtException.getScimError().getScimType(), BadRequestException.INVALID_PATH); } else
throw BadRequestException.invalidPath(e.getMessage()); throw BadRequestException.invalidPath(msg); "Invalid value filter: %s", be.getMessage()); throw BadRequestException.invalidPath(msg); "Invalid attribute name starting at position %d: %s", reader.mark, e.getMessage()); throw BadRequestException.invalidPath(msg);
throw BadRequestException.invalidFilter( "Unexpected end of filter string"); throw BadRequestException.invalidFilter(msg); String.format("No opening parenthesis matching closing " + "parenthesis at position %d", reader.mark); throw BadRequestException.invalidFilter(msg); final String msg = String.format( "Invalid attribute path at position %d: %s", reader.mark, e.getMessage()); throw BadRequestException.invalidFilter(msg); throw BadRequestException.invalidFilter(msg); final String msg = String.format( "Invalid attribute path at position %d: %s", reader.mark, e.getMessage()); throw BadRequestException.invalidFilter(msg); throw BadRequestException.invalidFilter(msg); throw BadRequestException.invalidFilter( "Unexpected end of filter string"); "Invalid comparison value at position %d: %s", reader.mark, e.getMessage()); throw BadRequestException.invalidFilter(msg);
/** * Create a new replace patch operation. * * @param path The path targeted by this patch operation. * @param value The value(s) to replace. * @throws ScimException If a value is not valid. */ @JsonCreator private ReplaceOperation( @JsonProperty(value = "path") final Path path, @JsonProperty(value = "value", required = true) final JsonNode value) throws ScimException { super(path); if(value == null || value.isNull() || ((value.isArray() || value.isObject()) && value.size() == 0)) { throw BadRequestException.invalidSyntax( "value field must not be null or an empty container"); } if(path == null && !value.isObject()) { throw BadRequestException.invalidSyntax( "value field must be a JSON object containing the attributes to " + "replace"); } this.value = value; }
throw BadRequestException.invalidFilter( "Unexpected end of filter string"); throw BadRequestException.invalidFilter( "Unexpected end of filter string"); throw BadRequestException.invalidFilter( "Unexpected end of filter string"); throw BadRequestException.invalidFilter( "Unexpected end of filter string");
BadRequestException.invalidSyntax(builder.toString()).getScimError();
/** * Tests the {@code fromString} method with an invalid path string. * * @param pathString The string representation of the path to fromString. * * @throws Exception If the test fails. */ @Test(dataProvider = "testInvalidPathStrings") public void testParseInvalidPath(final String pathString) throws Exception { try { Path.fromString(pathString); fail("Unexpected successful fromString of invalid path: " + pathString); } catch (BadRequestException e) { assertEquals(e.getScimError().getScimType(), BadRequestException.INVALID_PATH); } } }
((value.isArray() || value.isObject()) && value.size() == 0)) throw BadRequestException.invalidSyntax( "value field must not be null or an empty container"); throw BadRequestException.invalidSyntax( "value field must be a JSON object containing the attributes to " + "add"); throw BadRequestException.invalidPath( "path field for add operations must not include any value " + "selection filters");
throw BadRequestException.invalidValue("'" + attribute + "' is not a valid value for the attributes parameter: " + e.getMessage()); throw BadRequestException.invalidValue("'" + attribute + "' is not a valid value for the excludedAttributes parameter: " + e.getMessage());
throw BadRequestException.invalidPath( "Unexpected end of path string"); "Unexpected character '%s' at position %d for token starting at %d", (char)c, reader.pos - 1, reader.mark); throw BadRequestException.invalidPath(msg);
throw BadRequestException.invalidPath(e.getMessage()); throw BadRequestException.invalidPath(msg); "Invalid value filter: %s", be.getMessage()); throw BadRequestException.invalidPath(msg); "Invalid attribute name starting at position %d: %s", reader.mark, e.getMessage()); throw BadRequestException.invalidPath(msg);
throw BadRequestException.invalidFilter( "Unexpected end of filter string"); throw BadRequestException.invalidFilter(msg); String.format("No opening parenthesis matching closing " + "parenthesis at position %d", reader.mark); throw BadRequestException.invalidFilter(msg); final String msg = String.format( "Invalid attribute path at position %d: %s", reader.mark, e.getMessage()); throw BadRequestException.invalidFilter(msg); throw BadRequestException.invalidFilter(msg); final String msg = String.format( "Invalid attribute path at position %d: %s", reader.mark, e.getMessage()); throw BadRequestException.invalidFilter(msg); throw BadRequestException.invalidFilter(msg); throw BadRequestException.invalidFilter( "Unexpected end of filter string"); "Invalid comparison value at position %d: %s", reader.mark, e.getMessage()); throw BadRequestException.invalidFilter(msg);
/** * Create a new replace patch operation. * * @param path The path targeted by this patch operation. * @param value The value(s) to replace. * @throws ScimException If a value is not valid. */ @JsonCreator private ReplaceOperation( @JsonProperty(value = "path") final Path path, @JsonProperty(value = "value", required = true) final JsonNode value) throws ScimException { super(path); if(value == null || value.isNull() || ((value.isArray() || value.isObject()) && value.size() == 0)) { throw BadRequestException.invalidSyntax( "value field must not be null or an empty container"); } if(path == null && !value.isObject()) { throw BadRequestException.invalidSyntax( "value field must be a JSON object containing the attributes to " + "replace"); } this.value = value; }
throw BadRequestException.invalidFilter( "Unexpected end of filter string"); throw BadRequestException.invalidFilter( "Unexpected end of filter string"); throw BadRequestException.invalidFilter( "Unexpected end of filter string"); throw BadRequestException.invalidFilter( "Unexpected end of filter string");
/** * Tests the {@code fromString} method with an invalid filter string. * * @param filterString The string representation of the filter to * fromString. * * @throws Exception If the test fails. */ @Test(dataProvider = "testInvalidFilterStrings") public void testParseInvalidFilter(final String filterString) throws Exception { try { Filter.fromString(filterString); fail("Unexpected successful fromString of invalid filter: " + filterString); } catch (BadRequestException e) { assertEquals(e.getScimError().getScimType(), BadRequestException.INVALID_FILTER); } } }
((value.isArray() || value.isObject()) && value.size() == 0)) throw BadRequestException.invalidSyntax( "value field must not be null or an empty container"); throw BadRequestException.invalidSyntax( "value field must be a JSON object containing the attributes to " + "add"); throw BadRequestException.invalidPath( "path field for add operations must not include any value " + "selection filters");
throw BadRequestException.invalidValue("'" + sortByString + "' is not a valid value for the sortBy parameter: " + e.getMessage());