From f1d1a0e8420dd48ec6a665028ea3e00a76250842 Mon Sep 17 00:00:00 2001 From: DamonHD Date: Mon, 27 May 2024 21:43:33 +0100 Subject: [PATCH] Moar validation. --- javasrc/org/hd/d/statsHouse/feedHits/data/FeedStatus.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/javasrc/org/hd/d/statsHouse/feedHits/data/FeedStatus.java b/javasrc/org/hd/d/statsHouse/feedHits/data/FeedStatus.java index 4c4fdba..14842d8 100644 --- a/javasrc/org/hd/d/statsHouse/feedHits/data/FeedStatus.java +++ b/javasrc/org/hd/d/statsHouse/feedHits/data/FeedStatus.java @@ -42,6 +42,8 @@ *

* All integer values are non-negative, all Strings are non-null, cols is non-null. *

+ * The colTypes element count must match cols. + *

* This makes an immutable copy of the cols data to ensure record immutability. */ public record FeedStatus(int hits, int bytes, String colTypes, List cols, String index) @@ -52,6 +54,7 @@ public record FeedStatus(int hits, int bytes, String colTypes, List col if(bytes < 0) { throw new IllegalArgumentException(); } Objects.nonNull(colTypes); Objects.nonNull(cols); + for(final int c : cols) { if(c < 0) { throw new IllegalArgumentException(); } } Objects.nonNull(index); if(cols.size() != colTypes.split(":").length) { throw new IllegalArgumentException("colTypes element count must match cols"); } }