-
Notifications
You must be signed in to change notification settings - Fork 21k
Open
Labels
awaiting triageAwaiting triage from a maintainerAwaiting triage from a maintainer
Description
What would you like to share?
There is a typo and clarity issue in the error message used for radius validation in
Area.java.
Current code
private static final String POSITIVE_RADIUS = "Must be a positive radius";
public static double surfaceAreaCircle(final double radius) {
if (radius <= 0) {
throw new IllegalArgumentException(POSITIVE_RADIUS);
}
return Math.PI * radius * radius;
}Problem
The error message "Must be a positive radius" is grammatically incorrect and does not clearly reflect the validation condition (radius <= 0).
It sounds redundant and does not explicitly indicate that zero is an invalid value.
Suggested improvement
Update the error message to better describe the constraint:
private static final String POSITIVE_RADIUS = "Radius must be greater than 0";
Additional information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
awaiting triageAwaiting triage from a maintainerAwaiting triage from a maintainer