commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1159438 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java
Date Thu, 18 Aug 2011 22:53:49 GMT
Author: erans
Date: Thu Aug 18 22:53:48 2011
New Revision: 1159438

URL: http://svn.apache.org/viewvc?rev=1159438&view=rev
Log:
MATH-621
Unexplored code path.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java?rev=1159438&r1=1159437&r2=1159438&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java
Thu Aug 18 22:53:48 2011
@@ -22,6 +22,7 @@ import java.util.Arrays;
 import org.apache.commons.math.analysis.MultivariateRealFunction;
 import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.MathIllegalStateException;
+import org.apache.commons.math.exception.MathInternalError;
 import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.exception.OutOfRangeException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
@@ -475,6 +476,7 @@ public class BOBYQAOptimizer
                             gopt.setEntry(i, gopt.getEntry(i) + temp * xpt.getEntry(k, i));
                         }
                     }
+                    throw new PathIsExploredException(); // XXX
                 }
             }
 
@@ -2528,3 +2530,16 @@ public class BOBYQAOptimizer
         return ds;
     }
 }
+
+/**
+ * Marker for code paths that are not explored with the current unit tests.
+ * If the path becomes explored, it should just be removed from the code.
+ */
+class PathIsExploredException extends RuntimeException {
+    private static final String PATH_IS_EXPLORED
+        = "If this exception is thrown, just remove it from the code";
+
+    PathIsExploredException() {
+        super(PATH_IS_EXPLORED);
+    }
+}



Mime
View raw message