commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r1132432 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/analysis/polynomials/ main/java/org/apache/commons/math/complex/ main/java/org/apache/commons/math/exception/ main/java/org/apache/commons/math/fraction/ main/j...
Date Sun, 05 Jun 2011 14:59:31 GMT
Author: luc
Date: Sun Jun  5 14:59:29 2011
New Revision: 1132432

URL: http://svn.apache.org/viewvc?rev=1132432&view=rev
Log:
Replaced NullPointerException by NullArgumentException

JIRA: MATH-403

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NullArgumentException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFraction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockRealMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/EmpiricalDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SynchronizedDescriptiveStatistics.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SynchronizedSummaryStatistics.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/FourthMoment.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Mean.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/SecondMoment.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/SemiVariance.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Skewness.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/StandardDeviation.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/ThirdMoment.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Variance.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/rank/Max.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/rank/Min.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/Product.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/Sum.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/SumOfLogs.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/SumOfSquares.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/ResizableDoubleArray.java
    commons/proper/math/trunk/src/site/xdoc/changes.xml
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SparseRealMatrixTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/EmpiricalDistributionTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java Sun Jun  5 14:59:29 2011
@@ -21,10 +21,12 @@ import java.util.Arrays;
 
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.exception.NoDataException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.analysis.DifferentiableUnivariateRealFunction;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.analysis.ParametricUnivariateRealFunction;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Immutable representation of a real polynomial function with real coefficients.
@@ -57,11 +59,13 @@ public class PolynomialFunction implemen
      * the coefficients property.</p>
      *
      * @param c Polynomial coefficients.
-     * @throws NullPointerException if {@code c} is {@code null}.
+     * @throws NullArgumentException if {@code c} is {@code null}.
      * @throws NoDataException if {@code c} is empty.
      */
-    public PolynomialFunction(double c[]) {
+    public PolynomialFunction(double c[])
+        throws NullArgumentException, NoDataException {
         super();
+        MathUtils.checkNotNull(c);
         int n = c.length;
         if (n == 0) {
             throw new NoDataException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
@@ -117,9 +121,11 @@ public class PolynomialFunction implemen
      * @param argument Input value.
      * @return the value of the polynomial.
      * @throws NoDataException if {@code coefficients} is empty.
-     * @throws NullPointerException if {@code coefficients} is {@code null}.
+     * @throws NullArgumentException if {@code coefficients} is {@code null}.
      */
-    protected static double evaluate(double[] coefficients, double argument) {
+    protected static double evaluate(double[] coefficients, double argument)
+        throws NullArgumentException, NoDataException {
+        MathUtils.checkNotNull(coefficients);
         int n = coefficients.length;
         if (n == 0) {
             throw new NoDataException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
@@ -224,9 +230,11 @@ public class PolynomialFunction implemen
      * @param coefficients Coefficients of the polynomial to differentiate.
      * @return the coefficients of the derivative or {@code null} if coefficients has length 1.
      * @throws NoDataException if {@code coefficients} is empty.
-     * @throws NullPointerException if {@code coefficients} is {@code null}.
+     * @throws NullArgumentException if {@code coefficients} is {@code null}.
      */
-    protected static double[] differentiate(double[] coefficients) {
+    protected static double[] differentiate(double[] coefficients)
+        throws NullArgumentException, NoDataException {
+        MathUtils.checkNotNull(coefficients);
         int n = coefficients.length;
         if (n == 0) {
             throw new NoDataException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java Sun Jun  5 14:59:29 2011
@@ -23,6 +23,7 @@ import java.util.List;
 
 import org.apache.commons.math.FieldElement;
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 import org.apache.commons.math.util.FastMath;
@@ -144,9 +145,11 @@ public class Complex implements FieldEle
      *
      * @param rhs the other complex number
      * @return the complex number sum
-     * @throws NullPointerException if <code>rhs</code> is null
+     * @throws NullArgumentException if <code>rhs</code> is null
      */
-    public Complex add(Complex rhs) {
+    public Complex add(Complex rhs)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(rhs);
         return createComplex(real + rhs.getReal(),
             imaginary + rhs.getImaginary());
     }
@@ -205,9 +208,11 @@ public class Complex implements FieldEle
      *
      * @param rhs the other complex number
      * @return the complex number quotient
-     * @throws NullPointerException if <code>rhs</code> is null
+     * @throws NullArgumentException if <code>rhs</code> is null
      */
-    public Complex divide(Complex rhs) {
+    public Complex divide(Complex rhs)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(rhs);
         if (isNaN() || rhs.isNaN()) {
             return NaN;
         }
@@ -352,9 +357,11 @@ public class Complex implements FieldEle
      *
      * @param rhs the other complex number
      * @return the complex number product
-     * @throws NullPointerException if <code>rhs</code> is null
+     * @throws NullArgumentException if <code>rhs</code> is null
      */
-    public Complex multiply(Complex rhs) {
+    public Complex multiply(Complex rhs)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(rhs);
         if (isNaN() || rhs.isNaN()) {
             return NaN;
         }
@@ -437,9 +444,11 @@ public class Complex implements FieldEle
      *
      * @param rhs the other complex number
      * @return the complex number difference
-     * @throws NullPointerException if <code>rhs</code> is null
+     * @throws NullArgumentException if <code>rhs</code> is null
      */
-    public Complex subtract(Complex rhs) {
+    public Complex subtract(Complex rhs)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(rhs);
         if (isNaN() || rhs.isNaN()) {
             return NaN;
         }
@@ -673,13 +682,12 @@ public class Complex implements FieldEle
      *
      * @param x the exponent.
      * @return <code>this</code><sup><code>x</code></sup>
-     * @throws NullPointerException if x is null
+     * @throws NullArgumentException if x is null
      * @since 1.2
      */
-    public Complex pow(Complex x) {
-        if (x == null) {
-            throw new NullPointerException();
-        }
+    public Complex pow(Complex x)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(x);
         return this.log().multiply(x).exp();
     }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NullArgumentException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NullArgumentException.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NullArgumentException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NullArgumentException.java Sun Jun  5 14:59:29 2011
@@ -24,7 +24,7 @@ import org.apache.commons.math.exception
  * this exception.
  * This class is meant to signal a precondition violation ("null is an illegal
  * argument") and so does not extend the standard {@code NullPointerException}.
- * Proagation of {@code NullPointerException} from within Commons-Math is
+ * Propagation of {@code NullPointerException} from within Commons-Math is
  * construed to be a bug.
  *
  * @since 2.2

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFraction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFraction.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFraction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFraction.java Sun Jun  5 14:59:29 2011
@@ -458,10 +458,11 @@ public class BigFraction
      * @param bg
      *            the {@link BigInteger} to add, must'nt be <code>null</code>.
      * @return a <code>BigFraction</code> instance with the resulting values.
-     * @throws NullPointerException
+     * @throws NullArgumentException
      *             if the {@link BigInteger} is <code>null</code>.
      */
-    public BigFraction add(final BigInteger bg) {
+    public BigFraction add(final BigInteger bg) throws NullArgumentException {
+        MathUtils.checkNotNull(bg);
         return new BigFraction(numerator.add(denominator.multiply(bg)), denominator);
     }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java Sun Jun  5 14:59:29 2011
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import org.apache.commons.math.exception.NoDataException;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 import org.apache.commons.math.util.FastMath;
@@ -385,7 +386,9 @@ public abstract class AbstractRealMatrix
     }
 
     /** {@inheritDoc} */
-    public void setSubMatrix(final double[][] subMatrix, final int row, final int column) {
+    public void setSubMatrix(final double[][] subMatrix, final int row, final int column)
+        throws NoDataException, DimensionMismatchException, NullArgumentException {
+        MathUtils.checkNotNull(subMatrix);
         final int nRows = subMatrix.length;
         if (nRows == 0) {
             throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java Sun Jun  5 14:59:29 2011
@@ -24,7 +24,9 @@ import org.apache.commons.math.FieldElem
 import org.apache.commons.math.exception.NoDataException;
 import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.MathIllegalStateException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Implementation of FieldMatrix<T> using a {@link FieldElement}[][] array to store entries.
@@ -140,18 +142,16 @@ public class Array2DRowFieldMatrix<T ext
      * @param copyArray Whether to copy or reference the input array.
      * @throws DimensionMismatchException if {@code d} is not rectangular.
      * @throws NoDataException if there are not at least one row and one column.
-     * @throws org.apache.commons.math.exception.NullArgumentException
-     * if {@code d} is {@code null}.
+     * @throws NullArgumentException if {@code d} is {@code null}.
      * @see #Array2DRowFieldMatrix(FieldElement[][])
      */
-    public Array2DRowFieldMatrix(final Field<T> field, final T[][] d, final boolean copyArray) {
+    public Array2DRowFieldMatrix(final Field<T> field, final T[][] d, final boolean copyArray)
+        throws DimensionMismatchException, NoDataException, NullArgumentException {
         super(field);
         if (copyArray) {
             copyIn(d);
         } else {
-            if (d == null) {
-                throw new NullPointerException();
-            }
+            MathUtils.checkNotNull(d);
             final int nRows = d.length;
             if (nRows == 0) {
                 throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java Sun Jun  5 14:59:29 2011
@@ -24,6 +24,7 @@ import org.apache.commons.math.exception
 import org.apache.commons.math.exception.NoDataException;
 import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Implementation of RealMatrix using a double[][] array to store entries and
@@ -87,10 +88,11 @@ public class Array2DRowRealMatrix extend
      * @param d Data for the new matrix.
      * @throws DimensionMismatchException if {@code d} is not rectangular.
      * @throws NoDataException if {@code d} row or colum dimension is zero.
-     * @throws NullPointerException if {@code d} is {@code null}.
+     * @throws NullArgumentException if {@code d} is {@code null}.
      * @see #Array2DRowRealMatrix(double[][], boolean)
      */
-    public Array2DRowRealMatrix(final double[][] d) {
+    public Array2DRowRealMatrix(final double[][] d)
+        throws DimensionMismatchException, NoDataException, NullArgumentException {
         copyIn(d);
     }
 
@@ -275,6 +277,7 @@ public class Array2DRowRealMatrix extend
             if (column > 0) {
                 throw new MathIllegalStateException(LocalizedFormats.FIRST_COLUMNS_NOT_INITIALIZED_YET, column);
             }
+            MathUtils.checkNotNull(subMatrix);
             final int nRows = subMatrix.length;
             if (nRows == 0) {
                 throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
@@ -526,10 +529,11 @@ public class Array2DRowRealMatrix extend
      * @param in Data to copy.
      * @throws NoDataException if the input array is empty.
      * @throws DimensionMismatchException if the input array is not rectangular.
-     * @throws org.apache.commons.math.exception.NullArgumentException if
+     * @throws NullArgumentException if
      * the input array is {@code null}.
      */
-    private void copyIn(final double[][] in) {
+    private void copyIn(final double[][] in)
+        throws DimensionMismatchException, NoDataException, NullArgumentException {
         setSubMatrix(in, 0, 0);
     }
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java Sun Jun  5 14:59:29 2011
@@ -25,6 +25,7 @@ import org.apache.commons.math.exception
 import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Cache-friendly implementation of FieldMatrix using a flat arrays to store
@@ -759,6 +760,7 @@ public class BlockFieldMatrix<T extends 
     @Override
     public void setSubMatrix(final T[][] subMatrix, final int row, final int column) {
         // safety checks
+        MathUtils.checkNotNull(subMatrix);
         final int refLength = subMatrix[0].length;
         if (refLength == 0) {
             throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockRealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockRealMatrix.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockRealMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockRealMatrix.java Sun Jun  5 14:59:29 2011
@@ -22,8 +22,10 @@ import java.util.Arrays;
 
 import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.NoDataException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Cache-friendly implementation of RealMatrix using a flat arrays to store
@@ -764,8 +766,10 @@ public class BlockRealMatrix extends Abs
 
     /** {@inheritDoc} */
     @Override
-    public void setSubMatrix(final double[][] subMatrix, final int row, final int column) {
+    public void setSubMatrix(final double[][] subMatrix, final int row, final int column)
+        throws NoDataException, NullArgumentException {
         // safety checks
+        MathUtils.checkNotNull(subMatrix);
         final int refLength = subMatrix[0].length;
         if (refLength == 0) {
             throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrix.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrix.java Sun Jun  5 14:59:29 2011
@@ -17,6 +17,11 @@
 
 package org.apache.commons.math.linear;
 
+import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.NullArgumentException;
+import org.apache.commons.math.exception.OutOfRangeException;
+import org.apache.commons.math.exception.ZeroException;
+
 /**
  * Interface defining a real-valued matrix with basic algebraic operations.
  * <p>
@@ -210,19 +215,16 @@ public interface RealMatrix extends AnyM
     * @param subMatrix  array containing the submatrix replacement data
     * @param row  row coordinate of the top, left element to be replaced
     * @param column  column coordinate of the top, left element to be replaced
-    * @throws org.apache.commons.math.exception.ZeroException if
-    * {@code subMatrix} does not contain at least one column.
-    * @throws org.apache.commons.math.exception.OutOfRangeException if
-    * {@code subMatrix} does not fit into this matrix from element in
-    * {@code (row, column)}.
-    * @throws org.apache.commons.math.exception.DimensionMismatchException
-    * if {@code subMatrix} is not rectangular.
+    * @throws ZeroException if {@code subMatrix} does not contain at least one column.
+    * @throws OutOfRangeException if {@code subMatrix} does not fit into
+    * this matrix from element in {@code (row, column)}.
+    * @throws DimensionMismatchException if {@code subMatrix} is not rectangular.
     * (not all rows have the same length) or empty.
-    * @throws org.apache.commons.math.exception.NullArgumentException if
-    * {@code subMatrix} is {@code null}.
+    * @throws NullArgumentException if {@code subMatrix} is {@code null}.
     * @since 2.0
     */
-    void setSubMatrix(double[][] subMatrix, int row, int column);
+    void setSubMatrix(double[][] subMatrix, int row, int column)
+        throws ZeroException, OutOfRangeException, DimensionMismatchException, NullArgumentException;
 
    /**
     * Geet the entries at the given row index

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/EmpiricalDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/EmpiricalDistribution.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/EmpiricalDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/EmpiricalDistribution.java Sun Jun  5 14:59:29 2011
@@ -22,6 +22,7 @@ import java.io.File;
 import java.net.URL;
 import java.util.List;
 
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.stat.descriptive.StatisticalSummary;
 import org.apache.commons.math.stat.descriptive.SummaryStatistics;
 
@@ -62,6 +63,7 @@ public interface EmpiricalDistribution {
      *
      * @param file the input file
      * @throws IOException if an IO error occurs
+     * @throws NullArgumentException if file is null
      */
     void load(File file) throws IOException;
 
@@ -70,8 +72,9 @@ public interface EmpiricalDistribution {
      *
      * @param url url of the input file
      * @throws IOException if an IO error occurs
+     * @throws NullArgumentException if url is null
      */
-    void load(URL url) throws IOException;
+    void load(URL url) throws IOException, NullArgumentException;
 
     /**
      * Generates a random value from this distribution.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java Sun Jun  5 14:59:29 2011
@@ -28,10 +28,12 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.stat.descriptive.StatisticalSummary;
 import org.apache.commons.math.stat.descriptive.SummaryStatistics;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Implements <code>EmpiricalDistribution</code> interface.  This implementation
@@ -115,8 +117,9 @@ public class EmpiricalDistributionImpl i
      * array of numbers.
      *
      * @param in the input data array
+     * @exception NullArgumentException if in is null
      */
-    public void load(double[] in) {
+    public void load(double[] in) throws NullArgumentException {
         DataAdapter da = new ArrayDataAdapter(in);
         try {
             da.computeStats();
@@ -133,8 +136,10 @@ public class EmpiricalDistributionImpl i
      * @param url  url of the input file
      *
      * @throws IOException if an IO error occurs
+     * @throws NullArgumentException if url is null
      */
-    public void load(URL url) throws IOException {
+    public void load(URL url) throws IOException, NullArgumentException {
+        MathUtils.checkNotNull(url);
         BufferedReader in =
             new BufferedReader(new InputStreamReader(url.openStream()));
         try {
@@ -161,8 +166,10 @@ public class EmpiricalDistributionImpl i
      *
      * @param file the input file
      * @throws IOException if an IO error occurs
+     * @throws NullArgumentException if file is null
      */
-    public void load(File file) throws IOException {
+    public void load(File file) throws IOException, NullArgumentException {
+        MathUtils.checkNotNull(file);
         BufferedReader in = new BufferedReader(new FileReader(file));
         try {
             DataAdapter da = new StreamDataAdapter(in);
@@ -288,9 +295,11 @@ public class EmpiricalDistributionImpl i
          * Construct an ArrayDataAdapter from a double[] array
          *
          * @param in double[] array holding the data
+         * @throws NullArgumentException if in is null
          */
-        public ArrayDataAdapter(double[] in){
+        public ArrayDataAdapter(double[] in) throws NullArgumentException {
             super();
+            MathUtils.checkNotNull(in);
             inputArray = in;
         }
 

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=1132432&r1=1132431&r2=1132432&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 Sun Jun  5 14:59:29 2011
@@ -21,6 +21,7 @@ import java.lang.reflect.InvocationTarge
 import java.util.Arrays;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.NullArgumentException;
 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;
@@ -32,6 +33,7 @@ import org.apache.commons.math.stat.desc
 import org.apache.commons.math.stat.descriptive.rank.Percentile;
 import org.apache.commons.math.stat.descriptive.summary.Sum;
 import org.apache.commons.math.stat.descriptive.summary.SumOfSquares;
+import org.apache.commons.math.util.MathUtils;
 import org.apache.commons.math.util.ResizableDoubleArray;
 import org.apache.commons.math.util.FastMath;
 
@@ -699,9 +701,12 @@ public class DescriptiveStatistics imple
      *
      * @param source DescriptiveStatistics to copy
      * @param dest DescriptiveStatistics to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(DescriptiveStatistics source, DescriptiveStatistics dest) {
+    public static void copy(DescriptiveStatistics source, DescriptiveStatistics dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         // Copy data and window size
         dest.eDA = source.eDA.copy();
         dest.windowSize = source.windowSize;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java Sun Jun  5 14:59:29 2011
@@ -19,6 +19,7 @@ package org.apache.commons.math.stat.des
 import java.io.Serializable;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.NullArgumentException;
 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.Mean;
@@ -652,9 +653,12 @@ public class SummaryStatistics implement
      *
      * @param source SummaryStatistics to copy
      * @param dest SummaryStatistics to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(SummaryStatistics source, SummaryStatistics dest) {
+    public static void copy(SummaryStatistics source, SummaryStatistics dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         dest.maxImpl = source.maxImpl.copy();
         dest.meanImpl = source.meanImpl.copy();
         dest.minImpl = source.minImpl.copy();

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SynchronizedDescriptiveStatistics.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SynchronizedDescriptiveStatistics.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SynchronizedDescriptiveStatistics.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SynchronizedDescriptiveStatistics.java Sun Jun  5 14:59:29 2011
@@ -16,6 +16,9 @@
  */
 package org.apache.commons.math.stat.descriptive;
 
+import org.apache.commons.math.exception.NullArgumentException;
+import org.apache.commons.math.util.MathUtils;
+
 /**
  * Implementation of
  * {@link org.apache.commons.math.stat.descriptive.DescriptiveStatistics} that
@@ -159,10 +162,13 @@ public class SynchronizedDescriptiveStat
      *
      * @param source SynchronizedDescriptiveStatistics to copy
      * @param dest SynchronizedDescriptiveStatistics to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
     public static void copy(SynchronizedDescriptiveStatistics source,
-            SynchronizedDescriptiveStatistics dest) {
+                            SynchronizedDescriptiveStatistics dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         synchronized (source) {
             synchronized (dest) {
                 DescriptiveStatistics.copy(source, dest);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SynchronizedSummaryStatistics.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SynchronizedSummaryStatistics.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SynchronizedSummaryStatistics.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/SynchronizedSummaryStatistics.java Sun Jun  5 14:59:29 2011
@@ -16,6 +16,9 @@
  */
 package org.apache.commons.math.stat.descriptive;
 
+import org.apache.commons.math.exception.NullArgumentException;
+import org.apache.commons.math.util.MathUtils;
+
 /**
  * Implementation of
  * {@link org.apache.commons.math.stat.descriptive.SummaryStatistics} that
@@ -319,10 +322,13 @@ public class SynchronizedSummaryStatisti
      *
      * @param source SynchronizedSummaryStatistics to copy
      * @param dest SynchronizedSummaryStatistics to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
     public static void copy(SynchronizedSummaryStatistics source,
-            SynchronizedSummaryStatistics dest) {
+                            SynchronizedSummaryStatistics dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         synchronized (source) {
             synchronized (dest) {
                 SummaryStatistics.copy(source, dest);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java Sun Jun  5 14:59:29 2011
@@ -17,7 +17,10 @@
 package org.apache.commons.math.stat.descriptive.moment;
 
 import java.io.Serializable;
+
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Computes the first moment (arithmetic mean).  Uses the definitional formula:
@@ -148,9 +151,12 @@ public class FirstMoment extends Abstrac
      *
      * @param source FirstMoment to copy
      * @param dest FirstMoment to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(FirstMoment source, FirstMoment dest) {
+    public static void copy(FirstMoment source, FirstMoment dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         dest.setData(source.getDataRef());
         dest.n = source.n;
         dest.m1 = source.m1;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/FourthMoment.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/FourthMoment.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/FourthMoment.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/FourthMoment.java Sun Jun  5 14:59:29 2011
@@ -18,6 +18,9 @@ package org.apache.commons.math.stat.des
 
 import java.io.Serializable;
 
+import org.apache.commons.math.exception.NullArgumentException;
+import org.apache.commons.math.util.MathUtils;
+
 /**
  * Computes a statistic related to the Fourth Central Moment.  Specifically,
  * what is computed is the sum of
@@ -133,9 +136,12 @@ public class FourthMoment extends ThirdM
      *
      * @param source FourthMoment to copy
      * @param dest FourthMoment to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(FourthMoment source, FourthMoment dest) {
+    public static void copy(FourthMoment source, FourthMoment dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         ThirdMoment.copy(source, dest);
         dest.m4 = source.m4;
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java Sun Jun  5 14:59:29 2011
@@ -19,11 +19,13 @@ package org.apache.commons.math.stat.des
 import java.io.Serializable;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
 import org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic;
 import org.apache.commons.math.stat.descriptive.summary.SumOfLogs;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Returns the <a href="http://www.xycoon.com/geometric_mean.htm">
@@ -183,9 +185,12 @@ public class GeometricMean extends Abstr
      *
      * @param source GeometricMean to copy
      * @param dest GeometricMean to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(GeometricMean source, GeometricMean dest) {
+    public static void copy(GeometricMean source, GeometricMean dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         dest.setData(source.getDataRef());
         dest.sumOfLogs = source.sumOfLogs.copy();
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java Sun Jun  5 14:59:29 2011
@@ -19,9 +19,11 @@ package org.apache.commons.math.stat.des
 import java.io.Serializable;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.util.MathUtils;
 
 
 /**
@@ -211,9 +213,12 @@ public class Kurtosis extends AbstractSt
      *
      * @param source Kurtosis to copy
      * @param dest Kurtosis to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(Kurtosis source, Kurtosis dest) {
+    public static void copy(Kurtosis source, Kurtosis dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         dest.setData(source.getDataRef());
         dest.moment = source.moment.copy();
         dest.incMoment = source.incMoment;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Mean.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Mean.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Mean.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Mean.java Sun Jun  5 14:59:29 2011
@@ -18,9 +18,11 @@ package org.apache.commons.math.stat.des
 
 import java.io.Serializable;
 
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
 import org.apache.commons.math.stat.descriptive.WeightedEvaluation;
 import org.apache.commons.math.stat.descriptive.summary.Sum;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * <p>Computes the arithmetic mean of a set of values. Uses the definitional
@@ -262,9 +264,12 @@ public class Mean extends AbstractStorel
      *
      * @param source Mean to copy
      * @param dest Mean to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(Mean source, Mean dest) {
+    public static void copy(Mean source, Mean dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         dest.setData(source.getDataRef());
         dest.incMoment = source.incMoment;
         dest.moment = source.moment.copy();

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/SecondMoment.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/SecondMoment.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/SecondMoment.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/SecondMoment.java Sun Jun  5 14:59:29 2011
@@ -18,6 +18,9 @@ package org.apache.commons.math.stat.des
 
 import java.io.Serializable;
 
+import org.apache.commons.math.exception.NullArgumentException;
+import org.apache.commons.math.util.MathUtils;
+
 /**
  * Computes a statistic related to the Second Central Moment.  Specifically,
  * what is computed is the sum of squared deviations from the sample mean.
@@ -114,9 +117,12 @@ public class SecondMoment extends FirstM
      *
      * @param source SecondMoment to copy
      * @param dest SecondMoment to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(SecondMoment source, SecondMoment dest) {
+    public static void copy(SecondMoment source, SecondMoment dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         FirstMoment.copy(source, dest);
         dest.m2 = source.m2;
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/SemiVariance.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/SemiVariance.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/SemiVariance.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/SemiVariance.java Sun Jun  5 14:59:29 2011
@@ -21,6 +21,7 @@ import java.io.Serializable;
 import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.stat.descriptive.AbstractUnivariateStatistic;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * <p>Computes the semivariance of a set of values with respect to a given cutoff value.
@@ -156,9 +157,12 @@ public class SemiVariance extends Abstra
      *
      * @param source SemiVariance to copy
      * @param dest SemiVariance to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(final SemiVariance source, SemiVariance dest) {
+    public static void copy(final SemiVariance source, SemiVariance dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         dest.setData(source.getDataRef());
         dest.biasCorrected = source.biasCorrected;
         dest.varianceDirection = source.varianceDirection;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Skewness.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Skewness.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Skewness.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Skewness.java Sun Jun  5 14:59:29 2011
@@ -18,8 +18,10 @@ package org.apache.commons.math.stat.des
 
 import java.io.Serializable;
 
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Computes the skewness of the available values.
@@ -203,9 +205,12 @@ public class Skewness extends AbstractSt
      *
      * @param source Skewness to copy
      * @param dest Skewness to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(Skewness source, Skewness dest) {
+    public static void copy(Skewness source, Skewness dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         dest.setData(source.getDataRef());
         dest.moment = new ThirdMoment(source.moment.copy());
         dest.incMoment = source.incMoment;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/StandardDeviation.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/StandardDeviation.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/StandardDeviation.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/StandardDeviation.java Sun Jun  5 14:59:29 2011
@@ -18,8 +18,10 @@ package org.apache.commons.math.stat.des
 
 import java.io.Serializable;
 
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Computes the sample standard deviation.  The standard deviation
@@ -261,9 +263,12 @@ public class StandardDeviation extends A
      *
      * @param source StandardDeviation to copy
      * @param dest StandardDeviation to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(StandardDeviation source, StandardDeviation dest) {
+    public static void copy(StandardDeviation source, StandardDeviation dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         dest.setData(source.getDataRef());
         dest.variance = source.variance.copy();
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/ThirdMoment.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/ThirdMoment.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/ThirdMoment.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/ThirdMoment.java Sun Jun  5 14:59:29 2011
@@ -18,6 +18,9 @@ package org.apache.commons.math.stat.des
 
 import java.io.Serializable;
 
+import org.apache.commons.math.exception.NullArgumentException;
+import org.apache.commons.math.util.MathUtils;
+
 
 /**
  * Computes a statistic related to the Third Central Moment.  Specifically,
@@ -128,9 +131,12 @@ public class ThirdMoment extends SecondM
      *
      * @param source ThirdMoment to copy
      * @param dest ThirdMoment to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(ThirdMoment source, ThirdMoment dest) {
+    public static void copy(ThirdMoment source, ThirdMoment dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         SecondMoment.copy(source, dest);
         dest.m3 = source.m3;
         dest.nDevSq = source.nDevSq;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Variance.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Variance.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Variance.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/moment/Variance.java Sun Jun  5 14:59:29 2011
@@ -22,6 +22,7 @@ import org.apache.commons.math.exception
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.stat.descriptive.WeightedEvaluation;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Computes the variance of the available values.  By default, the unbiased
@@ -595,13 +596,12 @@ public class Variance extends AbstractSt
      *
      * @param source Variance to copy
      * @param dest Variance to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(Variance source, Variance dest) {
-        if (source == null ||
-            dest == null) {
-            throw new NullArgumentException();
-        }
+    public static void copy(Variance source, Variance dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         dest.setData(source.getDataRef());
         dest.moment = source.moment.copy();
         dest.isBiasCorrected = source.isBiasCorrected;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/rank/Max.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/rank/Max.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/rank/Max.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/rank/Max.java Sun Jun  5 14:59:29 2011
@@ -18,7 +18,9 @@ package org.apache.commons.math.stat.des
 
 import java.io.Serializable;
 
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Returns the maximum of the available values.
@@ -153,9 +155,12 @@ public class Max extends AbstractStorele
      *
      * @param source Max to copy
      * @param dest Max to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(Max source, Max dest) {
+    public static void copy(Max source, Max dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         dest.setData(source.getDataRef());
         dest.n = source.n;
         dest.value = source.value;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/rank/Min.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/rank/Min.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/rank/Min.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/rank/Min.java Sun Jun  5 14:59:29 2011
@@ -18,7 +18,9 @@ package org.apache.commons.math.stat.des
 
 import java.io.Serializable;
 
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Returns the minimum of the available values.
@@ -153,9 +155,12 @@ public class Min extends AbstractStorele
      *
      * @param source Min to copy
      * @param dest Min to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(Min source, Min dest) {
+    public static void copy(Min source, Min dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         dest.setData(source.getDataRef());
         dest.n = source.n;
         dest.value = source.value;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java Sun Jun  5 14:59:29 2011
@@ -19,10 +19,12 @@ package org.apache.commons.math.stat.des
 import java.io.Serializable;
 import java.util.Arrays;
 
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.OutOfRangeException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.stat.descriptive.AbstractUnivariateStatistic;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Provides percentile computation.
@@ -482,9 +484,12 @@ public class Percentile extends Abstract
      *
      * @param source Percentile to copy
      * @param dest Percentile to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(Percentile source, Percentile dest) {
+    public static void copy(Percentile source, Percentile dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         dest.setData(source.getDataRef());
         if (source.cachedPivots != null) {
             System.arraycopy(source.cachedPivots, 0, dest.cachedPivots, 0, source.cachedPivots.length);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/Product.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/Product.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/Product.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/Product.java Sun Jun  5 14:59:29 2011
@@ -18,9 +18,11 @@ package org.apache.commons.math.stat.des
 
 import java.io.Serializable;
 
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
 import org.apache.commons.math.stat.descriptive.WeightedEvaluation;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Returns the product of the available values.
@@ -210,9 +212,12 @@ public class Product extends AbstractSto
      *
      * @param source Product to copy
      * @param dest Product to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(Product source, Product dest) {
+    public static void copy(Product source, Product dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         dest.setData(source.getDataRef());
         dest.n = source.n;
         dest.value = source.value;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/Sum.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/Sum.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/Sum.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/Sum.java Sun Jun  5 14:59:29 2011
@@ -18,7 +18,9 @@ package org.apache.commons.math.stat.des
 
 import java.io.Serializable;
 
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math.util.MathUtils;
 
 
 /**
@@ -206,9 +208,12 @@ public class Sum extends AbstractStorele
      *
      * @param source Sum to copy
      * @param dest Sum to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(Sum source, Sum dest) {
+    public static void copy(Sum source, Sum dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         dest.setData(source.getDataRef());
         dest.n = source.n;
         dest.value = source.value;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/SumOfLogs.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/SumOfLogs.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/SumOfLogs.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/SumOfLogs.java Sun Jun  5 14:59:29 2011
@@ -18,8 +18,10 @@ package org.apache.commons.math.stat.des
 
 import java.io.Serializable;
 
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Returns the sum of the natural logs for this collection of values.
@@ -152,9 +154,12 @@ public class SumOfLogs extends AbstractS
      *
      * @param source SumOfLogs to copy
      * @param dest SumOfLogs to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(SumOfLogs source, SumOfLogs dest) {
+    public static void copy(SumOfLogs source, SumOfLogs dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         dest.setData(source.getDataRef());
         dest.n = source.n;
         dest.value = source.value;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/SumOfSquares.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/SumOfSquares.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/SumOfSquares.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/descriptive/summary/SumOfSquares.java Sun Jun  5 14:59:29 2011
@@ -18,7 +18,9 @@ package org.apache.commons.math.stat.des
 
 import java.io.Serializable;
 
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Returns the sum of the squares of the available values.
@@ -140,9 +142,12 @@ public class SumOfSquares extends Abstra
      *
      * @param source SumOfSquares to copy
      * @param dest SumOfSquares to copy to
-     * @throws NullPointerException if either source or dest is null
+     * @throws NullArgumentException if either source or dest is null
      */
-    public static void copy(SumOfSquares source, SumOfSquares dest) {
+    public static void copy(SumOfSquares source, SumOfSquares dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
         dest.setData(source.getDataRef());
         dest.n = source.n;
         dest.value = source.value;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java Sun Jun  5 14:59:29 2011
@@ -19,6 +19,7 @@ package org.apache.commons.math.stat.inf
 import org.apache.commons.math.MathException;
 import org.apache.commons.math.exception.NotPositiveException;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.exception.OutOfRangeException;
 import org.apache.commons.math.exception.DimensionMismatchException;
@@ -27,6 +28,7 @@ import org.apache.commons.math.distribut
 import org.apache.commons.math.distribution.ChiSquaredDistributionImpl;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * Implements Chi-Square test statistics defined in the
@@ -337,10 +339,12 @@ public class ChiSquareTestImpl implement
      * Throws MathIllegalArgumentException if the input array is not rectangular.
      *
      * @param in array to be tested
-     * @throws NullPointerException if input array is null
+     * @throws NullArgumentException if input array is null
      * @throws MathIllegalArgumentException if input array is not rectangular
      */
-    private void checkRectangular(long[][] in) {
+    private void checkRectangular(long[][] in)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(in);
         for (int i = 1; i < in.length; i++) {
             if (in[i].length != in[0].length) {
                 throw new DimensionMismatchException(LocalizedFormats.DIFFERENT_ROWS_LENGTHS,

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java Sun Jun  5 14:59:29 2011
@@ -2325,7 +2325,8 @@ public final class MathUtils {
      * @param o Object to be checked.
      * @throws NullArgumentException if {@code o} is {@code null}.
      */
-    public static void checkNotNull(Object o) {
+    public static void checkNotNull(Object o)
+        throws NullArgumentException {
         if (o == null) {
             throw new NullArgumentException();
         }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/ResizableDoubleArray.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/ResizableDoubleArray.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/ResizableDoubleArray.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/ResizableDoubleArray.java Sun Jun  5 14:59:29 2011
@@ -20,6 +20,7 @@ import java.io.Serializable;
 import java.util.Arrays;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 
 /**
@@ -277,13 +278,16 @@ public class ResizableDoubleArray implem
     /**
      * Copy constructor.  Creates a new ResizableDoubleArray that is a deep,
      * fresh copy of the original. Needs to acquire synchronization lock
-     * on original.  Original may not be null; otherwise a NullPointerException
+     * on original.  Original may not be null; otherwise a {@link NullArgumentException}
      * is thrown.
      *
      * @param original array to copy
+     * @exception NullArgumentException if original is null
      * @since 2.0
      */
-    public ResizableDoubleArray(ResizableDoubleArray original) {
+    public ResizableDoubleArray(ResizableDoubleArray original)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(original);
         copy(original, this);
     }
 
@@ -823,16 +827,20 @@ public class ResizableDoubleArray implem
      * <p>Obtains synchronization locks on both source and dest
      * (in that order) before performing the copy.</p>
      *
-     * <p>Neither source nor dest may be null; otherwise a NullPointerException
+     * <p>Neither source nor dest may be null; otherwise a {@link NullArgumentException}
      * is thrown</p>
      *
      * @param source ResizableDoubleArray to copy
      * @param dest ResizableArray to replace with a copy of the source array
+     * @exception NullArgumentException if either source or dest is null
      * @since 2.0
      *
      */
-    public static void copy(ResizableDoubleArray source, ResizableDoubleArray dest) {
-       synchronized(source) {
+    public static void copy(ResizableDoubleArray source, ResizableDoubleArray dest)
+        throws NullArgumentException {
+        MathUtils.checkNotNull(source);
+        MathUtils.checkNotNull(dest);
+        synchronized(source) {
            synchronized(dest) {
                dest.initialCapacity = source.initialCapacity;
                dest.contractionCriteria = source.contractionCriteria;

Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Sun Jun  5 14:59:29 2011
@@ -52,6 +52,9 @@ The <action> type attribute can be add,u
     If the output is not quite correct, check for invisible trailing spaces!
      -->
     <release version="3.0" date="TBD" description="TBD">
+      <action dev="luc" type="fix" issue="MATH-403">
+        Replaced NullPointerException by NullArgumentException.
+      </action>
       <action dev="luc" type="add">
         Added a consistent classes hierarchy for Euclidean spaces in dimension 1, 2 and 3.
       </action>

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/complex/ComplexTest.java Sun Jun  5 14:59:29 2011
@@ -18,6 +18,7 @@
 package org.apache.commons.math.complex;
 
 import org.apache.commons.math.TestUtils;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
@@ -632,14 +633,9 @@ public class ComplexTest {
                new Complex(-1, 3).pow(Complex.ZERO), 10e-12);
    }
 
-    @Test
+    @Test(expected=NullArgumentException.class)
     public void testpowNull() {
-        try {
-            Complex.ONE.pow(null);
-            Assert.fail("Expecting NullPointerException");
-        } catch (NullPointerException ex) {
-            // expected
-        }
+        Complex.ONE.pow(null);
     }
 
     @Test

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java Sun Jun  5 14:59:29 2011
@@ -23,6 +23,7 @@ import org.apache.commons.math.TestUtils
 import org.apache.commons.math.util.FastMath;
 import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.OutOfRangeException;
 import org.apache.commons.math.exception.NoDataException;
 import org.apache.commons.math.exception.NumberIsTooSmallException;
@@ -930,8 +931,8 @@ public final class Array2DRowRealMatrixT
         // null
         try {
             m.setSubMatrix(null,1,1);
-            Assert.fail("expecting NullPointerException");
-        } catch (NullPointerException e) {
+            Assert.fail("expecting NullArgumentException");
+        } catch (NullArgumentException e) {
             // expected
         }
         Array2DRowRealMatrix m2 = new Array2DRowRealMatrix();

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java Sun Jun  5 14:59:29 2011
@@ -27,6 +27,7 @@ import org.apache.commons.math.exception
 import org.apache.commons.math.fraction.Fraction;
 import org.apache.commons.math.fraction.FractionField;
 import org.apache.commons.math.exception.NoDataException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.OutOfRangeException;
 import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
@@ -1213,8 +1214,8 @@ public final class BlockFieldMatrixTest 
         // null
         try {
             m.setSubMatrix(null,1,1);
-            Assert.fail("expecting NullPointerException");
-        } catch (NullPointerException e) {
+            Assert.fail("expecting NullArgumentException");
+        } catch (NullArgumentException e) {
             // expected
         }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java Sun Jun  5 14:59:29 2011
@@ -25,6 +25,7 @@ import org.junit.Assert;
 import org.apache.commons.math.TestUtils;
 import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.OutOfRangeException;
 import org.apache.commons.math.exception.NoDataException;
 import org.apache.commons.math.exception.NumberIsTooSmallException;
@@ -1113,8 +1114,8 @@ public final class BlockRealMatrixTest {
         // null
         try {
             m.setSubMatrix(null,1,1);
-            Assert.fail("expecting NullPointerException");
-        } catch (NullPointerException e) {
+            Assert.fail("expecting NullArgumentException");
+        } catch (NullArgumentException e) {
             // expected
         }
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SparseRealMatrixTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SparseRealMatrixTest.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SparseRealMatrixTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SparseRealMatrixTest.java Sun Jun  5 14:59:29 2011
@@ -20,6 +20,7 @@ import org.junit.Test;
 import org.junit.Assert;
 
 import org.apache.commons.math.TestUtils;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.OutOfRangeException;
 import org.apache.commons.math.exception.NoDataException;
 import org.apache.commons.math.exception.NumberIsTooSmallException;
@@ -629,8 +630,8 @@ public final class SparseRealMatrixTest 
         // null
         try {
             m.setSubMatrix(null, 1, 1);
-            Assert.fail("expecting NullPointerException");
-        } catch (NullPointerException e) {
+            Assert.fail("expecting NullArgumentException");
+        } catch (NullArgumentException e) {
             // expected
         }
         try {

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/EmpiricalDistributionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/EmpiricalDistributionTest.java?rev=1132432&r1=1132431&r2=1132432&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/EmpiricalDistributionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/EmpiricalDistributionTest.java Sun Jun  5 14:59:29 2011
@@ -25,6 +25,7 @@ import java.util.ArrayList;
 
 import org.apache.commons.math.RetryRunner;
 import org.apache.commons.math.TestUtils;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.stat.descriptive.SummaryStatistics;
 import org.junit.Assert;
 import org.junit.Before;
@@ -184,37 +185,19 @@ public final class EmpiricalDistribution
         verifySame(empiricalDistribution2, dist2);
     }
 
-    @Test
+    @Test(expected=NullArgumentException.class)
     public void testLoadNullDoubleArray() {
-        EmpiricalDistribution dist = new EmpiricalDistributionImpl();
-        try {
-            dist.load((double[]) null);
-            Assert.fail("load((double[]) null) expected NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
+       new EmpiricalDistributionImpl().load((double[]) null);
     }
 
-    @Test
+    @Test(expected=NullArgumentException.class)
     public void testLoadNullURL() throws Exception {
-        EmpiricalDistribution dist = new EmpiricalDistributionImpl();
-        try {
-            dist.load((URL) null);
-            Assert.fail("load((URL) null) expected NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
+        new EmpiricalDistributionImpl().load((URL) null);
     }
 
-    @Test
+    @Test(expected=NullArgumentException.class)
     public void testLoadNullFile() throws Exception {
-        EmpiricalDistribution dist = new EmpiricalDistributionImpl();
-        try {
-            dist.load((File) null);
-            Assert.fail("load((File) null) expected NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
+        new EmpiricalDistributionImpl().load((File) null);
     }
 
     /**



Mime
View raw message