Why this matters
Prevents invalid operations and provides clear feedback to clients.
Validate presence, format, and ranges for incoming parameters before processing.
Prevents invalid operations and provides clear feedback to clients.
Side-by-side examples engineers can pattern-match during review.
process(amount, taxId);if (amount == null || amount.signum() <= 0) return badRequest("amount>0 required");
if (!isValidTaxId(taxId)) return badRequest("invalid taxId");Long.parseLong(q.get("n")) // no checksif(!NUMBER.matcher(n).matches()) return badRequest()From the same buckets as this rule.