commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r1177986 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/ main/java/org/apache/commons/math/fraction/ main/java/org/apache/commons/math/optimization/ main/java/org/apache/commons/math/optimization/linear/ site/xdoc/ t...
Date Sat, 01 Oct 2011 14:16:50 GMT
Author: luc
Date: Sat Oct  1 14:16:50 2011
New Revision: 1177986

URL: http://svn.apache.org/viewvc?rev=1177986&view=rev
Log:
Replaced checked ConvergenceException with an unchecked version.

JIRA: MATH-487

Removed:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ConvergenceException.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ConvergenceExceptionTest.java
Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionConversionException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionFormat.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/OptimizationException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/AbstractLinearOptimizer.java
    commons/proper/math/trunk/src/site/xdoc/changes.xml
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegratorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/BigFractionTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionConversionException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionConversionException.java?rev=1177986&r1=1177985&r2=1177986&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionConversionException.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionConversionException.java
Sat Oct  1 14:16:50 2011
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.fraction;
 
-import org.apache.commons.math.ConvergenceException;
+import org.apache.commons.math.exception.ConvergenceException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 
 /**

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionFormat.java?rev=1177986&r1=1177985&r2=1177986&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionFormat.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionFormat.java
Sat Oct  1 14:16:50 2011
@@ -23,7 +23,7 @@ import java.text.ParseException;
 import java.text.ParsePosition;
 import java.util.Locale;
 
-import org.apache.commons.math.ConvergenceException;
+import org.apache.commons.math.exception.ConvergenceException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/OptimizationException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/OptimizationException.java?rev=1177986&r1=1177985&r2=1177986&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/OptimizationException.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/OptimizationException.java
Sat Oct  1 14:16:50 2011
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.optimization;
 
-import org.apache.commons.math.ConvergenceException;
+import org.apache.commons.math.exception.ConvergenceException;
 import org.apache.commons.math.exception.util.Localizable;
 
 /**
@@ -44,12 +44,4 @@ public class OptimizationException exten
         super(specifier, parts);
     }
 
-    /**
-     * Create an exception with a given root cause.
-     * @param cause  the exception or error that caused this exception to be thrown
-     */
-    public OptimizationException(Throwable cause) {
-        super(cause);
-    }
-
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/AbstractLinearOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/AbstractLinearOptimizer.java?rev=1177986&r1=1177985&r2=1177986&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/AbstractLinearOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/linear/AbstractLinearOptimizer.java
Sat Oct  1 14:16:50 2011
@@ -90,13 +90,13 @@ public abstract class AbstractLinearOpti
     }
 
     /** Increment the iterations counter by 1.
-     * @exception OptimizationException if the maximal number
+     * @exception MaxCountExceededException if the maximal number
      * of iterations is exceeded
      */
     protected void incrementIterationsCounter()
-        throws OptimizationException {
+        throws MaxCountExceededException {
         if (++iterations > maxIterations) {
-            throw new OptimizationException(new MaxCountExceededException(maxIterations));
+            throw new MaxCountExceededException(maxIterations);
         }
     }
 

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=1177986&r1=1177985&r2=1177986&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Sat Oct  1 14:16:50 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-487" >
+        The checked ConvergenceException has been replaced by an unchecked ConvergenceException.
+      </action>
       <action dev="luc" type="fix" issue="MATH-381" due-to="Pascal Parraud">
         ODE step interpolation with Jacobians is now fully merged with
         classical step interpolation.

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegratorTest.java?rev=1177986&r1=1177985&r2=1177986&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegratorTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegratorTest.java
Sat Oct  1 14:16:50 2011
@@ -18,7 +18,6 @@ package org.apache.commons.math.analysis
 
 import java.util.Random;
 
-import org.apache.commons.math.ConvergenceException;
 import org.apache.commons.math.MathException;
 import org.apache.commons.math.analysis.QuinticFunction;
 import org.apache.commons.math.analysis.SinFunction;
@@ -76,8 +75,7 @@ public class LegendreGaussIntegratorTest
     }
 
     @Test
-    public void testExactIntegration()
-        throws ConvergenceException {
+    public void testExactIntegration() {
         Random random = new Random(86343623467878363l);
         for (int n = 2; n < 6; ++n) {
             LegendreGaussIntegrator integrator =
@@ -105,7 +103,7 @@ public class LegendreGaussIntegratorTest
     }
 
     @Test
-    public void testIssue464() throws ConvergenceException {
+    public void testIssue464() {
         final double value = 0.2;
         UnivariateRealFunction f = new UnivariateRealFunction() {
             public double value(double x) {

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/BigFractionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/BigFractionTest.java?rev=1177986&r1=1177985&r2=1177986&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/BigFractionTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/BigFractionTest.java
Sat Oct  1 14:16:50 2011
@@ -19,8 +19,8 @@ package org.apache.commons.math.fraction
 import java.math.BigDecimal;
 import java.math.BigInteger;
 
-import org.apache.commons.math.ConvergenceException;
 import org.apache.commons.math.TestUtils;
+import org.apache.commons.math.exception.ConvergenceException;
 import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.util.FastMath;
 import org.junit.Assert;

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java?rev=1177986&r1=1177985&r2=1177986&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/fraction/FractionTest.java
Sat Oct  1 14:16:50 2011
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.fraction;
 
-import org.apache.commons.math.ConvergenceException;
+import org.apache.commons.math.exception.ConvergenceException;
 import org.apache.commons.math.exception.MathIllegalArgumentException;
 import org.apache.commons.math.exception.MathArithmeticException;
 import org.apache.commons.math.TestUtils;
@@ -65,15 +65,10 @@ public class FractionTest {
         assertFraction(15, 1, new Fraction(15.0000000000001));
     }
 
-    @Test
+    @Test(expected=ConvergenceException.class)
     public void testGoldenRatio() {
-        try {
-            // the golden ratio is notoriously a difficult number for continuous fraction
-            new Fraction((1 + FastMath.sqrt(5)) / 2, 1.0e-12, 25);
-            Assert.fail("an exception should have been thrown");
-        } catch (ConvergenceException ce) {
-            // expected behavior
-        }
+        // the golden ratio is notoriously a difficult number for continuous fraction
+        new Fraction((1 + FastMath.sqrt(5)) / 2, 1.0e-12, 25);
     }
 
     // MATH-179



Mime
View raw message