You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tn...@apache.org on 2013/07/02 21:49:49 UTC

svn commit: r1499076 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/MathArrays.java

Author: tn
Date: Tue Jul  2 19:49:48 2013
New Revision: 1499076

URL: http://svn.apache.org/r1499076
Log:
Do sanity checks first to prevent NullPointerException.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/MathArrays.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/MathArrays.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/MathArrays.java?rev=1499076&r1=1499075&r2=1499076&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/MathArrays.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/MathArrays.java Tue Jul  2 19:49:48 2013
@@ -677,13 +677,15 @@ public class MathArrays {
                                    double[] ... yList)
         throws NullArgumentException,
                DimensionMismatchException {
-        final int yListLen = yList.length;
-        final int len = x.length;
 
         // Consistency checks.
         if (x == null) {
             throw new NullArgumentException();
         }
+
+        final int yListLen = yList.length;
+        final int len = x.length;
+
         for (int j = 0; j < yListLen; j++) {
             final double[] y = yList[j];
             if (y == null) {