You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2011/11/26 22:56:22 UTC

svn commit: r1206618 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java

Author: psteitz
Date: Sat Nov 26 21:56:20 2011
New Revision: 1206618

URL: http://svn.apache.org/viewvc?rev=1206618&view=rev
Log:
Eliminated deprecated exception.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java?rev=1206618&r1=1206617&r2=1206618&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java Sat Nov 26 21:56:20 2011
@@ -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 imple
     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 imple
      * @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 imple
                         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 imple
                     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;
     }