Eliminated deprecated exception.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1206618 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2011-11-26 21:56:20 +00:00
parent d7f3fee311
commit 325e797341
1 changed files with 9 additions and 9 deletions

View File

@ -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;
}