commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1499076 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/MathArrays.java
Date Tue, 02 Jul 2013 19:49:49 GMT
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) {



Mime
View raw message