Fix wrong documentation for exceptions in StatUtils and add missing #207
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello! I found that a couple of methods in
StatUtils
were wrongly documenting in javadoc to throwMathIllegalArgumentException
for null arrays, instead ofNullArgumentException
.I took the opportunity to add documentation and tests for
NotPositiveException
formode(double[], int, int)
.As I mentioned in #206, I'm happy to submit more pull requests with similar fixes/additions to the documentation if it's something welcomed by the project.
On another note, I found a few methods on
Variance
(called byStatUtils
) that will throwNullPointerException
(null dereference), instead ofNullArgumentException
. I'm also happy to submit a pull request fixing those. The fix is very easy but will entail other documentation modifications, and likely some test changes/additions.commons-math/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/moment/Variance.java
Lines 368 to 371 in 57dda85
commons-math/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/moment/Variance.java
Lines 452 to 454 in 57dda85