From 325e79734102084ad0d80b35caefd8961c384765 Mon Sep 17 00:00:00 2001 From: Phil Steitz Date: Sat, 26 Nov 2011 21:56:20 +0000 Subject: [PATCH] Eliminated deprecated exception. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1206618 13f79535-47bb-0310-9956-ffa450edef68 --- .../descriptive/DescriptiveStatistics.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java b/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java index d2b41a205..3ad41d9cb 100644 --- a/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java +++ b/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java @@ -20,8 +20,9 @@ import java.io.Serializable; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; -import org.apache.commons.math.MathRuntimeException; +import org.apache.commons.math.exception.MathIllegalArgumentException; import org.apache.commons.math.exception.NullArgumentException; +import org.apache.commons.math.exception.MathIllegalStateException; import org.apache.commons.math.exception.util.LocalizedFormats; import org.apache.commons.math.stat.descriptive.moment.GeometricMean; import org.apache.commons.math.stat.descriptive.moment.Kurtosis; @@ -339,7 +340,7 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable { public void setWindowSize(int windowSize) { if (windowSize < 1) { if (windowSize != INFINITE_WINDOW) { - throw MathRuntimeException.createIllegalArgumentException( + throw new MathIllegalArgumentException( LocalizedFormats.NOT_POSITIVE_WINDOW_SIZE, windowSize); } } @@ -407,7 +408,6 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable { * @return An estimate for the pth percentile of the stored data * @throws IllegalStateException if percentile implementation has been * overridden and the supplied implementation does not support setQuantile - * values */ public double getPercentile(double p) { if (percentileImpl instanceof Percentile) { @@ -418,15 +418,15 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable { new Class[] {Double.TYPE}).invoke(percentileImpl, new Object[] {Double.valueOf(p)}); } catch (NoSuchMethodException e1) { // Setter guard should prevent - throw MathRuntimeException.createIllegalArgumentException( + throw new MathIllegalStateException( LocalizedFormats.PERCENTILE_IMPLEMENTATION_UNSUPPORTED_METHOD, percentileImpl.getClass().getName(), SET_QUANTILE_METHOD_NAME); } catch (IllegalAccessException e2) { - throw MathRuntimeException.createIllegalArgumentException( + throw new MathIllegalStateException( LocalizedFormats.PERCENTILE_IMPLEMENTATION_CANNOT_ACCESS_METHOD, SET_QUANTILE_METHOD_NAME, percentileImpl.getClass().getName()); } catch (InvocationTargetException e3) { - throw MathRuntimeException.createIllegalArgumentException(e3.getCause()); + throw new IllegalStateException(e3.getCause()); } } return apply(percentileImpl); @@ -601,15 +601,15 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable { new Class[] {Double.TYPE}).invoke(percentileImpl, new Object[] {Double.valueOf(50.0d)}); } catch (NoSuchMethodException e1) { - throw MathRuntimeException.createIllegalArgumentException( + throw new MathIllegalArgumentException( LocalizedFormats.PERCENTILE_IMPLEMENTATION_UNSUPPORTED_METHOD, percentileImpl.getClass().getName(), SET_QUANTILE_METHOD_NAME); } catch (IllegalAccessException e2) { - throw MathRuntimeException.createIllegalArgumentException( + throw new MathIllegalArgumentException( LocalizedFormats.PERCENTILE_IMPLEMENTATION_CANNOT_ACCESS_METHOD, SET_QUANTILE_METHOD_NAME, percentileImpl.getClass().getName()); } catch (InvocationTargetException e3) { - throw MathRuntimeException.createIllegalArgumentException(e3.getCause()); + throw new IllegalArgumentException(e3.getCause()); } this.percentileImpl = percentileImpl; }