diff --git a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/filter/Filter.java b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/filter/Filter.java index a24adc368..0d8d2d3ea 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/filter/Filter.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/filter/Filter.java @@ -39,12 +39,15 @@ public interface Filter { * @param query Query for the filter * @return Set of UUIDs this filter applies to * @throws IllegalArgumentException If the arguments are not valid. - * @throws CompleteSetException If the arguments produce a complete set. */ Set getMatchingUUIDs(SpecifiedFilterInformation query); default Result apply(SpecifiedFilterInformation query) { - return new Result(null, getKind(), getMatchingUUIDs(query)); + try { + return new Result(null, getKind(), getMatchingUUIDs(query)); + } catch (CompleteSetException allMatch) { + return new Result(null, getKind() + " (skip)", new HashSet<>()); + } } class Result { @@ -62,9 +65,13 @@ public interface Filter { } public Result apply(Filter filter, SpecifiedFilterInformation query) { - Set got = filter.getMatchingUUIDs(query); - currentUUIDs.retainAll(got); - return new Result(this, filter.getKind(), currentUUIDs); + try { + Set got = filter.getMatchingUUIDs(query); + currentUUIDs.retainAll(got); + return new Result(this, filter.getKind(), currentUUIDs); + } catch (CompleteSetException allMatch) { + return notApplied(filter); + } } public Result notApplied(Filter filter) { diff --git a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/filter/QueryFilters.java b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/filter/QueryFilters.java index 2820ce511..3c19dd242 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/filter/QueryFilters.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/filter/QueryFilters.java @@ -96,8 +96,7 @@ public class QueryFilters { String kind = specifiedFilterInformation.getKind(); Filter filter = getFilter(kind).orElseThrow(() -> new BadRequestException("Filter kind not supported: '" + kind + "'")); - current = getResult(current, filter, specifiedFilterInformation); - return current; + return getResult(current, filter, specifiedFilterInformation); } private Filter.Result getResult(Filter.Result current, Filter filter, SpecifiedFilterInformation query) { @@ -107,8 +106,6 @@ public class QueryFilters { throw new BadRequestException("Bad parameters for filter '" + filter.getKind() + "': expecting " + Arrays.asList(filter.getExpectedParameters()) + ", but was given " + query.getSetParameters()); - } catch (CompleteSetException complete) { - return current == null ? null : current.notApplied(filter); } }