private static void validate(final CharSequence jsonKey, final JsonValue jsonValue) { checkNotNull(jsonKey, "JSON key"); checkNotNull(jsonValue, "JSON value"); final String msgTemplate = "Expected for Authorization Subject ''{0}'' a JSON object containing all of {1}" + " but got <{2}>!"; final Supplier<String> descriptionSupplier = () -> MessageFormat.format(msgTemplate, jsonKey, Permission.allToString(), jsonValue); if (!jsonValue.isObject()) { throw new DittoJsonException(JsonParseException.newBuilder() // .description(descriptionSupplier) // .build()); } final JsonObject permissionsJsonObject = jsonValue.asObject(); if (permissionsJsonObject.isEmpty()) { throw AclEntryInvalidException.newBuilder() // .description(descriptionSupplier) // .build(); } }
private static void validate(final CharSequence jsonKey, final JsonValue jsonValue) { checkNotNull(jsonKey, "JSON key"); checkNotNull(jsonValue, "JSON value"); final String msgTemplate = "Expected for Authorization Subject ''{0}'' a JSON object containing all of {1}" + " but got <{2}>!"; final Supplier<String> descriptionSupplier = () -> MessageFormat.format(msgTemplate, jsonKey, Permission.allToString(), jsonValue); if (!jsonValue.isObject()) { throw new DittoJsonException(JsonParseException.newBuilder() // .description(descriptionSupplier) // .build()); } final JsonObject permissionsJsonObject = jsonValue.asObject(); if (permissionsJsonObject.isEmpty()) { throw AclEntryInvalidException.newBuilder() // .description(descriptionSupplier) // .build(); } }
private Builder() { super(ERROR_CODE); description(DEFAULT_DESCRIPTION); }
private Builder() { super(ERROR_CODE); description(DEFAULT_DESCRIPTION); }