This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-math.git
commit df117c1e463497f22819849eb1ddb86bffdf70e6 Author: aherbert <aherb...@apache.org> AuthorDate: Wed Jun 9 16:41:20 2021 +0100 Fix null argument check. Fix javadoc error. --- .../commons/math4/legacy/stat/descriptive/rank/Percentile.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/rank/Percentile.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/rank/Percentile.java index 777fce6..4527931 100644 --- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/rank/Percentile.java +++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/rank/Percentile.java @@ -290,7 +290,7 @@ public class Percentile extends AbstractUnivariateStatistic implements Serializa * If weights have been set, it will compute weighted percentile. * <p> * The stored array is the one which was set by previous calls to - * {@link #setData(double[])} or {@link #setData(double[], double[] sampleWeights, int begin, int length)} + * {@link #setData(double[])} or {@link #setData(double[], double[], int, int)} * </p> * @param p the percentile value to compute * @return the value of the statistic applied to the stored data @@ -484,14 +484,14 @@ public class Percentile extends AbstractUnivariateStatistic implements Serializa */ public double evaluate(final double[] values, final double[] sampleWeights, final int begin, final int length, final double p) { + if (values == null || sampleWeights == null) { + throw new MathIllegalArgumentException(LocalizedFormats.NULL_NOT_ALLOWED); + } /** Check length */ if (values.length != sampleWeights.length) { throw new MathIllegalArgumentException(LocalizedFormats.LENGTH, values, sampleWeights); } - if (values == null || sampleWeights == null) { - throw new MathIllegalArgumentException(LocalizedFormats.NULL_NOT_ALLOWED); - } MathArrays.verifyValues(values, begin, length); MathArrays.verifyValues(sampleWeights, begin, length); MathArrays.checkPositive(sampleWeights);