commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r1164573 [1/2] - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/exception/util/ main/java/org/apache/commons/math/ode/ main/java/org/apache/commons/math/ode/events/ main/java/org/apache/commons/math/ode/nonstiff/ main/...
Date Fri, 02 Sep 2011 15:11:32 GMT
Author: luc
Date: Fri Sep  2 15:11:31 2011
New Revision: 1164573

URL: http://svn.apache.org/viewvc?rev=1164573&view=rev
Log:
Use the refactored exceptions framework for ODE.

The IntegratorException and EvenException classes have been removed. The
uses of the checked ConvergenceException have been replaced by the
unchecked one from the exception package. Sanity checks now use
the nes DimensionMismatchException. Step size underflows now trigger
NumberIsTooSmallException.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/FirstOrderIntegrator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/IntegratorException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/MultistepIntegrator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/SecondOrderIntegrator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventHandler.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventState.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegrator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsIntegrator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegrator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegrator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java
    commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
    commons/proper/math/trunk/src/site/xdoc/changes.xml
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/ContinuousOutputModelTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/FirstOrderConverterTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/events/EventStateTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/events/OverlappingEventsTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegratorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaStepInterpolatorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54IntegratorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54StepInterpolatorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853StepInterpolatorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/EulerStepInterpolatorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GillIntegratorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GillStepInterpolatorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegratorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54IntegratorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/HighamHall54StepInterpolatorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointIntegratorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/MidpointStepInterpolatorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesIntegratorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolatorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/StepInterpolatorTestUtils.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/StepNormalizerOutputTestBase.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/sampling/StepNormalizerTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java Fri Sep  2 15:11:31 2011
@@ -151,7 +151,7 @@ public enum LocalizedFormats implements 
     MAX_COUNT_EXCEEDED("maximal count ({0}) exceeded"), /* keep */
     MAX_EVALUATIONS_EXCEEDED("maximal number of evaluations ({0}) exceeded"),
     MAX_ITERATIONS_EXCEEDED("maximal number of iterations ({0}) exceeded"),
-    MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION("minimal step size ({0,number,0.00E00}) reached, integration needs {1,number,0.00E00}"),
+    MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION("minimal step size ({1,number,0.00E00}) reached, integration needs {0,number,0.00E00}"),
     MISMATCHED_LOESS_ABSCISSA_ORDINATE_ARRAYS("Loess expects the abscissa and ordinate arrays to be of the same size, but got {0} abscissae and {1} ordinatae"),
     NAN_ELEMENT_AT_INDEX("element {0} is NaN"),
     NAN_VALUE_CONVERSION("cannot convert NaN value"),

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java Fri Sep  2 15:11:31 2011
@@ -26,13 +26,14 @@ import java.util.List;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
-import org.apache.commons.math.ConvergenceException;
 import org.apache.commons.math.MaxEvaluationsExceededException;
 import org.apache.commons.math.analysis.solvers.BracketingNthOrderBrentSolver;
 import org.apache.commons.math.analysis.solvers.UnivariateRealSolver;
+import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
-import org.apache.commons.math.ode.events.EventException;
 import org.apache.commons.math.ode.events.EventHandler;
 import org.apache.commons.math.ode.events.EventState;
 import org.apache.commons.math.ode.sampling.AbstractStepInterpolator;
@@ -226,14 +227,13 @@ public abstract class AbstractIntegrator
      * @param yDot placeholder array where to put the time derivative of the state vector
      * @param tEnd final integration time
      * @return time at end of step
-     * @exception IntegratorException if the value of one event state cannot be evaluated
+     * @exception MathIllegalStateException if the value of one event state cannot be evaluated
      * @since 2.2
      */
     protected double acceptStep(final AbstractStepInterpolator interpolator,
                                 final double[] y, final double[] yDot, final double tEnd)
-        throws IntegratorException {
+        throws MathIllegalStateException {
 
-        try {
             double previousT = interpolator.getGlobalPreviousTime();
             final double currentT = interpolator.getGlobalCurrentTime();
             resetOccurred = false;
@@ -329,15 +329,6 @@ public abstract class AbstractIntegrator
             }
 
             return currentT;
-        } catch (EventException se) {
-            final Throwable cause = se.getCause();
-            if ((cause != null) && (cause instanceof MathUserException)) {
-                throw (MathUserException) cause;
-            }
-            throw new IntegratorException(se);
-        } catch (ConvergenceException ce) {
-            throw new IntegratorException(ce);
-        }
 
     }
 
@@ -347,27 +338,27 @@ public abstract class AbstractIntegrator
      * @param y0 state vector at t0
      * @param t target time for the integration
      * @param y placeholder where to put the state vector
-     * @exception IntegratorException if some inconsistency is detected
+     * @exception DimensionMismatchException if some inconsistency is detected
+     * @exception NumberIsTooSmallException if integration span is too small
      */
     protected void sanityChecks(final FirstOrderDifferentialEquations ode,
                                 final double t0, final double[] y0,
                                 final double t, final double[] y)
-        throws IntegratorException {
+        throws DimensionMismatchException, NumberIsTooSmallException {
 
         if (ode.getDimension() != y0.length) {
-            throw new IntegratorException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y0.length);
+            throw new DimensionMismatchException(ode.getDimension(), y0.length);
         }
 
         if (ode.getDimension() != y.length) {
-            throw new IntegratorException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, ode.getDimension(), y.length);
+            throw new DimensionMismatchException(ode.getDimension(), y.length);
         }
 
         if (FastMath.abs(t - t0) <= 1.0e-12 * FastMath.max(FastMath.abs(t0), FastMath.abs(t))) {
-            throw new IntegratorException(
-                    LocalizedFormats.TOO_SMALL_INTEGRATION_INTERVAL,
-                    FastMath.abs(t - t0));
+            throw new NumberIsTooSmallException(LocalizedFormats.TOO_SMALL_INTEGRATION_INTERVAL,
+                                                FastMath.abs(t - t0),
+                                                1.0e-12 * FastMath.max(FastMath.abs(t0), FastMath.abs(t)),
+                                                false);
         }
 
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/FirstOrderIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/FirstOrderIntegrator.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/FirstOrderIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/FirstOrderIntegrator.java Fri Sep  2 15:11:31 2011
@@ -17,7 +17,8 @@
 
 package org.apache.commons.math.ode;
 
-import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 
 /** This interface represents a first order integrator for
  * differential equations.
@@ -51,12 +52,12 @@ public interface FirstOrderIntegrator ex
    * @return stop time, will be the same as target time if integration reached its
    * target, but may be different if some {@link
    * org.apache.commons.math.ode.events.EventHandler} stops it at some point.
-   * @throws IntegratorException if the integrator cannot perform integration
-   * @throws MathUserException this exception is propagated to the caller if
-   * the underlying user function triggers one
+   * @throws MathIllegalStateException if the integrator cannot perform integration
+   * @throws MathIllegalArgumentException if integration parameters are wrong (typically
+   * too small integration span)
    */
   double integrate (FirstOrderDifferentialEquations equations,
-                    double t0, double[] y0,
-                    double t, double[] y) throws MathUserException, IntegratorException;
+                    double t0, double[] y0, double t, double[] y)
+      throws MathIllegalStateException, MathIllegalArgumentException;
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/MultistepIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/MultistepIntegrator.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/MultistepIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/MultistepIntegrator.java Fri Sep  2 15:11:31 2011
@@ -18,6 +18,7 @@
 package org.apache.commons.math.ode;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.linear.Array2DRowRealMatrix;
@@ -204,12 +205,10 @@ public abstract class MultistepIntegrato
      * @param y0 initial value of the state vector at t0
      * @param t target time for the integration
      * (can be set to a value smaller than <code>t0</code> for backward integration)
-     * @throws IntegratorException if the integrator cannot perform integration
-     * @throws MathUserException this exception is propagated to the caller if
-     * the underlying user function triggers one
+     * @throws MathIllegalStateException if the integrator cannot perform integration
      */
     protected void start(final double t0, final double[] y0, final double t)
-        throws MathUserException, IntegratorException {
+        throws MathIllegalStateException {
 
         // make sure NO user event nor user step handler is triggered,
         // this is the task of the top level integrator, not the task

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/SecondOrderIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/SecondOrderIntegrator.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/SecondOrderIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/SecondOrderIntegrator.java Fri Sep  2 15:11:31 2011
@@ -17,7 +17,8 @@
 
 package org.apache.commons.math.ode;
 
-import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 
 
 /** This interface represents a second order integrator for
@@ -48,13 +49,13 @@ public interface SecondOrderIntegrator e
    * same object as y0
    * @param yDot placeholder where to put the first derivative of
    * the state vector at time t, can be the same object as yDot0
-   * @throws IntegratorException if the integrator cannot perform integration
-   * @throws MathUserException this exception is propagated to the caller if the
-   * underlying user function triggers one
+   * @throws MathIllegalStateException if the integrator cannot perform integration
+   * @throws MathIllegalArgumentException if integration parameters are wrong (typically
+   * too small integration span)
    */
   void integrate(SecondOrderDifferentialEquations equations,
                  double t0, double[] y0, double[] yDot0,
                  double t, double[] y, double[] yDot)
-      throws MathUserException, IntegratorException;
+      throws MathIllegalStateException, MathIllegalArgumentException;
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventHandler.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventHandler.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventHandler.java Fri Sep  2 15:11:31 2011
@@ -94,9 +94,8 @@ public interface EventHandler  {
    * @param t current value of the independent <i>time</i> variable
    * @param y array containing the current value of the state vector
    * @return value of the g switching function
-   * @exception EventException if the switching function cannot be evaluated
    */
-  double g(double t, double[] y) throws EventException;
+  double g(double t, double[] y);
 
   /** Handle an event and choose what to do next.
 
@@ -158,9 +157,8 @@ public interface EventHandler  {
    * @return indication of what the integrator should do next, this
    * value must be one of {@link #STOP}, {@link #RESET_STATE},
    * {@link #RESET_DERIVATIVES} or {@link #CONTINUE}
-   * @exception EventException if the event occurrence triggers an error
    */
-  int eventOccurred(double t, double[] y, boolean increasing) throws EventException;
+  int eventOccurred(double t, double[] y, boolean increasing);
 
   /** Reset the state prior to continue the integration.
 
@@ -176,8 +174,7 @@ public interface EventHandler  {
    * @param t current value of the independent <i>time</i> variable
    * @param y array containing the current value of the state vector
    * the new state should be put in the same array
-   * @exception EventException if the state cannot be reseted
    */
-  void resetState(double t, double[] y) throws EventException;
+  void resetState(double t, double[] y);
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventState.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventState.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventState.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventState.java Fri Sep  2 15:11:31 2011
@@ -17,14 +17,13 @@
 
 package org.apache.commons.math.ode.events;
 
-import org.apache.commons.math.ConvergenceException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.analysis.solvers.AllowedSolution;
 import org.apache.commons.math.analysis.solvers.BracketedUnivariateRealSolver;
 import org.apache.commons.math.analysis.solvers.PegasusSolver;
 import org.apache.commons.math.analysis.solvers.UnivariateRealSolver;
 import org.apache.commons.math.analysis.solvers.UnivariateRealSolverUtils;
-import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.ConvergenceException;
 import org.apache.commons.math.ode.sampling.StepInterpolator;
 import org.apache.commons.math.util.FastMath;
 
@@ -148,57 +147,44 @@ public class EventState {
 
     /** Reinitialize the beginning of the step.
      * @param interpolator valid for the current step
-     * @exception EventException if the event handler
-     * value cannot be evaluated at the beginning of the step
      */
-    public void reinitializeBegin(final StepInterpolator interpolator)
-        throws EventException {
-        try {
-
-            t0 = interpolator.getPreviousTime();
-            interpolator.setInterpolatedTime(t0);
-            g0 = handler.g(t0, interpolator.getInterpolatedState());
-            if (g0 == 0) {
-                // excerpt from MATH-421 issue:
-                // If an ODE solver is setup with an EventHandler that return STOP
-                // when the even is triggered, the integrator stops (which is exactly
-                // the expected behavior). If however the user wants to restart the
-                // solver from the final state reached at the event with the same
-                // configuration (expecting the event to be triggered again at a
-                // later time), then the integrator may fail to start. It can get stuck
-                // at the previous event. The use case for the bug MATH-421 is fairly
-                // general, so events occurring exactly at start in the first step should
-                // be ignored.
-
-                // extremely rare case: there is a zero EXACTLY at interval start
-                // we will use the sign slightly after step beginning to force ignoring this zero
-                final double epsilon = FastMath.max(solver.getAbsoluteAccuracy(),
-                                                    FastMath.abs(solver.getRelativeAccuracy() * t0));
-                final double tStart = t0 + 0.5 * epsilon;
-                interpolator.setInterpolatedTime(tStart);
-                g0 = handler.g(tStart, interpolator.getInterpolatedState());
-            }
-            g0Positive = g0 >= 0;
+    public void reinitializeBegin(final StepInterpolator interpolator) {
 
-        } catch (MathUserException mue) {
-            throw new EventException(mue);
+        t0 = interpolator.getPreviousTime();
+        interpolator.setInterpolatedTime(t0);
+        g0 = handler.g(t0, interpolator.getInterpolatedState());
+        if (g0 == 0) {
+            // excerpt from MATH-421 issue:
+            // If an ODE solver is setup with an EventHandler that return STOP
+            // when the even is triggered, the integrator stops (which is exactly
+            // the expected behavior). If however the user wants to restart the
+            // solver from the final state reached at the event with the same
+            // configuration (expecting the event to be triggered again at a
+            // later time), then the integrator may fail to start. It can get stuck
+            // at the previous event. The use case for the bug MATH-421 is fairly
+            // general, so events occurring exactly at start in the first step should
+            // be ignored.
+
+            // extremely rare case: there is a zero EXACTLY at interval start
+            // we will use the sign slightly after step beginning to force ignoring this zero
+            final double epsilon = FastMath.max(solver.getAbsoluteAccuracy(),
+                                                FastMath.abs(solver.getRelativeAccuracy() * t0));
+            final double tStart = t0 + 0.5 * epsilon;
+            interpolator.setInterpolatedTime(tStart);
+            g0 = handler.g(tStart, interpolator.getInterpolatedState());
         }
+        g0Positive = g0 >= 0;
+
     }
 
     /** Evaluate the impact of the proposed step on the event handler.
      * @param interpolator step interpolator for the proposed step
      * @return true if the event handler triggers an event before
      * the end of the proposed step
-     * @exception MathUserException if the interpolator fails to
-     * compute the switching function somewhere within the step
-     * @exception EventException if the switching function
-     * cannot be evaluated
      * @exception ConvergenceException if an event cannot be located
      */
     public boolean evaluateStep(final StepInterpolator interpolator)
-        throws MathUserException, EventException, ConvergenceException {
-
-        try {
+        throws ConvergenceException {
 
             forward = interpolator.isForward();
             final double t1 = interpolator.getCurrentTime();
@@ -212,12 +198,8 @@ public class EventState {
 
             final UnivariateRealFunction f = new UnivariateRealFunction() {
                 public double value(final double t) {
-                    try {
-                        interpolator.setInterpolatedTime(t);
-                        return handler.g(t, interpolator.getInterpolatedState());
-                    } catch (EventException e) {
-                        throw new ConveyedException(e);
-                    }
+                    interpolator.setInterpolatedTime(t);
+                    return handler.g(t, interpolator.getInterpolatedState());
                 }
             };
 
@@ -292,10 +274,6 @@ public class EventState {
             pendingEventTime = Double.NaN;
             return false;
 
-        } catch (ConveyedException ce) {
-            throw ce.getConveyedException();
-        }
-
     }
 
     /** Get the occurrence time of the event triggered in the current step.
@@ -313,11 +291,8 @@ public class EventState {
      * end of the step
      * @param y array containing the current value of the state vector
      * at the end of the step
-     * @exception EventException if the value of the event
-     * handler cannot be evaluated
      */
-    public void stepAccepted(final double t, final double[] y)
-        throws EventException {
+    public void stepAccepted(final double t, final double[] y) {
 
         t0 = t;
         g0 = handler.g(t, y);
@@ -347,11 +322,8 @@ public class EventState {
      * @param y array were to put the desired state vector at the beginning
      * of the next step
      * @return true if the integrator should reset the derivatives too
-     * @exception EventException if the state cannot be reseted by the event
-     * handler
      */
-    public boolean reset(final double t, final double[] y)
-        throws EventException {
+    public boolean reset(final double t, final double[] y) {
 
         if (!(pendingEvent && (FastMath.abs(pendingEventTime - t) <= convergence))) {
             return false;
@@ -368,29 +340,4 @@ public class EventState {
 
     }
 
-    /** Local exception to convey EventException instances through root finding algorithms. */
-    private static class ConveyedException extends RuntimeException {
-
-        /** Serializable uid. */
-        private static final long serialVersionUID = 2668348550531980574L;
-
-        /** Conveyed exception. */
-        private final EventException conveyedException;
-
-        /** Simple constructor.
-         * @param conveyedException conveyed exception
-         */
-        public ConveyedException(final EventException conveyedException) {
-            this.conveyedException = conveyedException;
-        }
-
-        /** Get the conveyed exception.
-         * @return conveyed exception
-         */
-        public EventException getConveyedException() {
-            return conveyedException;
-        }
-
-    }
-
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegrator.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegrator.java Fri Sep  2 15:11:31 2011
@@ -17,10 +17,10 @@
 
 package org.apache.commons.math.ode.nonstiff;
 
-import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.linear.Array2DRowRealMatrix;
 import org.apache.commons.math.ode.FirstOrderDifferentialEquations;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.sampling.NordsieckStepInterpolator;
 import org.apache.commons.math.ode.sampling.StepHandler;
 import org.apache.commons.math.util.FastMath;
@@ -192,7 +192,7 @@ public class AdamsBashforthIntegrator ex
     public double integrate(final FirstOrderDifferentialEquations equations,
                             final double t0, final double[] y0,
                             final double t, final double[] y)
-        throws MathUserException, IntegratorException {
+        throws MathIllegalStateException, MathIllegalArgumentException {
 
         final int n = y0.length;
         sanityChecks(equations, t0, y0, t, y);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsIntegrator.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsIntegrator.java Fri Sep  2 15:11:31 2011
@@ -17,10 +17,10 @@
 
 package org.apache.commons.math.ode.nonstiff;
 
-import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.linear.Array2DRowRealMatrix;
 import org.apache.commons.math.ode.FirstOrderDifferentialEquations;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.MultistepIntegrator;
 
 
@@ -89,7 +89,7 @@ public abstract class AdamsIntegrator ex
     public abstract double integrate(final FirstOrderDifferentialEquations equations,
                                      final double t0, final double[] y0,
                                      final double t, final double[] y)
-        throws MathUserException, IntegratorException;
+        throws MathIllegalStateException, MathIllegalArgumentException;
 
     /** {@inheritDoc} */
     @Override

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegrator.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegrator.java Fri Sep  2 15:11:31 2011
@@ -19,11 +19,11 @@ package org.apache.commons.math.ode.nons
 
 import java.util.Arrays;
 
-import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.linear.Array2DRowRealMatrix;
 import org.apache.commons.math.linear.RealMatrixPreservingVisitor;
 import org.apache.commons.math.ode.FirstOrderDifferentialEquations;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.sampling.NordsieckStepInterpolator;
 import org.apache.commons.math.ode.sampling.StepHandler;
 import org.apache.commons.math.util.FastMath;
@@ -209,7 +209,7 @@ public class AdamsMoultonIntegrator exte
     public double integrate(final FirstOrderDifferentialEquations equations,
                             final double t0, final double[] y0,
                             final double t, final double[] y)
-        throws MathUserException, IntegratorException {
+        throws MathIllegalStateException, MathIllegalArgumentException {
 
         final int n = y0.length;
         sanityChecks(equations, t0, y0, t, y);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java Fri Sep  2 15:11:31 2011
@@ -17,12 +17,15 @@
 
 package org.apache.commons.math.ode.nonstiff;
 
+import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.ode.AbstractIntegrator;
 import org.apache.commons.math.ode.ExtendedFirstOrderDifferentialEquations;
 import org.apache.commons.math.ode.FirstOrderDifferentialEquations;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.util.FastMath;
 
 /**
@@ -218,13 +221,14 @@ public abstract class AdaptiveStepsizeIn
    * @param y0 state vector at t0
    * @param t target time for the integration
    * @param y placeholder where to put the state vector
-   * @exception IntegratorException if some inconsistency is detected
+   * @exception DimensionMismatchException if some inconsistency is detected
+   * @exception NumberIsTooSmallException if integration span is too small
    */
   @Override
   protected void sanityChecks(final FirstOrderDifferentialEquations equations,
                               final double t0, final double[] y0,
                               final double t, final double[] y)
-      throws IntegratorException {
+      throws DimensionMismatchException, NumberIsTooSmallException {
 
       super.sanityChecks(equations, t0, y0, t, y);
 
@@ -235,13 +239,11 @@ public abstract class AdaptiveStepsizeIn
       }
 
       if ((vecAbsoluteTolerance != null) && (vecAbsoluteTolerance.length != mainSetDimension)) {
-          throw new IntegratorException(
-                  LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, mainSetDimension, vecAbsoluteTolerance.length);
+          throw new DimensionMismatchException(mainSetDimension, vecAbsoluteTolerance.length);
       }
 
       if ((vecRelativeTolerance != null) && (vecRelativeTolerance.length != mainSetDimension)) {
-          throw new IntegratorException(
-                  LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, mainSetDimension, vecRelativeTolerance.length);
+          throw new DimensionMismatchException(mainSetDimension, vecRelativeTolerance.length);
       }
 
   }
@@ -332,19 +334,18 @@ public abstract class AdaptiveStepsizeIn
    * are silently increased up to this value, if false such small
    * steps generate an exception
    * @return a bounded integration step (h if no bound is reach, or a bounded value)
-   * @exception IntegratorException if the step is too small and acceptSmall is false
+   * @exception NumberIsTooSmallException if the step is too small and acceptSmall is false
    */
   protected double filterStep(final double h, final boolean forward, final boolean acceptSmall)
-    throws IntegratorException {
+    throws MathIllegalArgumentException {
 
       double filteredH = h;
       if (FastMath.abs(h) < minStep) {
           if (acceptSmall) {
               filteredH = forward ? minStep : -minStep;
           } else {
-              throw new IntegratorException(
-                      LocalizedFormats.MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION,
-                      minStep, FastMath.abs(h));
+              throw new NumberIsTooSmallException(LocalizedFormats.MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION,
+                                                  minStep, FastMath.abs(h), true);
           }
       }
 
@@ -362,7 +363,7 @@ public abstract class AdaptiveStepsizeIn
   public abstract double integrate (FirstOrderDifferentialEquations equations,
                                     double t0, double[] y0,
                                     double t, double[] y)
-    throws MathUserException, IntegratorException;
+    throws MathIllegalStateException, MathIllegalArgumentException;
 
   /** {@inheritDoc} */
   @Override

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java Fri Sep  2 15:11:31 2011
@@ -17,9 +17,9 @@
 
 package org.apache.commons.math.ode.nonstiff;
 
-import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.ode.FirstOrderDifferentialEquations;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.sampling.StepHandler;
 import org.apache.commons.math.util.FastMath;
 
@@ -192,7 +192,7 @@ public abstract class EmbeddedRungeKutta
   public double integrate(final FirstOrderDifferentialEquations equations,
                           final double t0, final double[] y0,
                           final double t, final double[] y)
-  throws MathUserException, IntegratorException {
+      throws MathIllegalStateException, MathIllegalArgumentException {
 
     sanityChecks(equations, t0, y0, t, y);
     setEquations(equations);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegrator.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/GraggBulirschStoerIntegrator.java Fri Sep  2 15:11:31 2011
@@ -18,9 +18,10 @@
 package org.apache.commons.math.ode.nonstiff;
 
 import org.apache.commons.math.analysis.solvers.UnivariateRealSolver;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.ode.FirstOrderDifferentialEquations;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.events.EventHandler;
 import org.apache.commons.math.ode.sampling.AbstractStepInterpolator;
 import org.apache.commons.math.ode.sampling.StepHandler;
@@ -546,7 +547,7 @@ public class GraggBulirschStoerIntegrato
   @Override
   public double integrate(final FirstOrderDifferentialEquations equations,
                           final double t0, final double[] y0, final double t, final double[] y)
-      throws MathUserException, IntegratorException {
+      throws MathIllegalStateException, MathIllegalArgumentException {
 
     sanityChecks(equations, t0, y0, t, y);
     setEquations(equations);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/RungeKuttaIntegrator.java Fri Sep  2 15:11:31 2011
@@ -18,10 +18,10 @@
 package org.apache.commons.math.ode.nonstiff;
 
 
-import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.ode.AbstractIntegrator;
 import org.apache.commons.math.ode.FirstOrderDifferentialEquations;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.sampling.StepHandler;
 import org.apache.commons.math.util.FastMath;
 
@@ -93,7 +93,7 @@ public abstract class RungeKuttaIntegrat
   public double integrate(final FirstOrderDifferentialEquations equations,
                           final double t0, final double[] y0,
                           final double t, final double[] y)
-  throws MathUserException, IntegratorException {
+      throws MathIllegalStateException, MathIllegalArgumentException {
 
     sanityChecks(equations, t0, y0, t, y);
     setEquations(equations);

Modified: commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties (original)
+++ commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties Fri Sep  2 15:11:31 2011
@@ -122,7 +122,7 @@ EVALUATIONS = \u00e9valuations
 MAX_COUNT_EXCEEDED = limite ({0}) d\u00e9pass\u00e9
 MAX_EVALUATIONS_EXCEEDED = nombre maximal d''\u00e9valuations ({0}) d\u00e9pass\u00e9
 MAX_ITERATIONS_EXCEEDED = nombre maximal d''it\u00e9rations ({0}) d\u00e9pass\u00e9
-MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION = pas minimal ({0,number,0.00E00}) atteint, l''int\u00e9gration n\u00e9cessite {1,number,0.00E00}
+MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION = pas minimal ({1,number,0.00E00}) atteint, l''int\u00e9gration n\u00e9cessite {0,number,0.00E00}
 MISMATCHED_LOESS_ABSCISSA_ORDINATE_ARRAYS = Loess a besoin de tableaux d'abscisses et d'oordonn\u00e9es de m\u00eame taille, mais il y a {0} points en abscisse et {1} en ordonn\u00e9e
 NAN_ELEMENT_AT_INDEX = l''\u00e9l\u00e9ment {0} est un NaN
 NAN_VALUE_CONVERSION = les valeurs NaN ne peuvent \u00eatre converties

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=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Fri Sep  2 15:11:31 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="update" issue="MATH-488" >
+        Use the refactored exceptions framework for ODE. 
+      </action>
       <action dev="luc" type="add" >
         Added a getter to allow retrieving the exception related to an exception context
         provider. 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/ContinuousOutputModelTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/ContinuousOutputModelTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/ContinuousOutputModelTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/ContinuousOutputModelTest.java Fri Sep  2 15:11:31 2011
@@ -20,9 +20,6 @@ package org.apache.commons.math.ode;
 import java.util.Random;
 
 import org.apache.commons.math.exception.MathUserException;
-import org.apache.commons.math.ode.ContinuousOutputModel;
-import org.apache.commons.math.ode.FirstOrderIntegrator;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.nonstiff.DormandPrince54Integrator;
 import org.apache.commons.math.ode.nonstiff.DormandPrince853Integrator;
 import org.apache.commons.math.ode.sampling.DummyStepInterpolator;
@@ -41,8 +38,7 @@ public class ContinuousOutputModelTest {
   }
 
   @Test
-  public void testBoundaries()
-    throws MathUserException, IntegratorException {
+  public void testBoundaries() {
     integ.addStepHandler(new ContinuousOutputModel());
     integ.integrate(pb,
                     pb.getInitialTime(), pb.getInitialState(),
@@ -54,8 +50,7 @@ public class ContinuousOutputModelTest {
   }
 
   @Test
-  public void testRandomAccess()
-    throws MathUserException, IntegratorException {
+  public void testRandomAccess() {
 
     ContinuousOutputModel cm = new ContinuousOutputModel();
     integ.addStepHandler(cm);
@@ -84,8 +79,7 @@ public class ContinuousOutputModelTest {
   }
 
   @Test
-  public void testModelsMerging()
-    throws MathUserException, IntegratorException {
+  public void testModelsMerging() {
 
       // theoretical solution: y[0] = cos(t), y[1] = sin(t)
       FirstOrderDifferentialEquations problem =

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/FirstOrderConverterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/FirstOrderConverterTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/FirstOrderConverterTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/FirstOrderConverterTest.java Fri Sep  2 15:11:31 2011
@@ -17,10 +17,8 @@
 
 package org.apache.commons.math.ode;
 
-import org.apache.commons.math.exception.MathUserException;
-import org.apache.commons.math.ode.FirstOrderConverter;
-import org.apache.commons.math.ode.IntegratorException;
-import org.apache.commons.math.ode.SecondOrderDifferentialEquations;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.ode.nonstiff.ClassicalRungeKuttaIntegrator;
 import org.apache.commons.math.util.FastMath;
 import org.junit.Assert;
@@ -39,8 +37,7 @@ public class FirstOrderConverterTest {
   }
 
   @Test
-  public void testDecreasingSteps()
-    throws MathUserException, IntegratorException {
+  public void testDecreasingSteps() {
 
     double previousError = Double.NaN;
     for (int i = 0; i < 10; ++i) {
@@ -57,16 +54,14 @@ public class FirstOrderConverterTest {
   }
 
   @Test
-  public void testSmallStep()
-    throws MathUserException, IntegratorException {
+  public void testSmallStep() {
     double error = integrateWithSpecifiedStep(4.0, 0.0, 1.0, 1.0e-4)
                    - FastMath.sin(4.0);
     Assert.assertTrue(FastMath.abs(error) < 1.0e-10);
   }
 
   @Test
-  public void testBigStep()
-    throws MathUserException, IntegratorException {
+  public void testBigStep() {
     double error = integrateWithSpecifiedStep(4.0, 0.0, 1.0, 0.5)
                    - FastMath.sin(4.0);
     Assert.assertTrue(FastMath.abs(error) > 0.1);
@@ -100,7 +95,7 @@ public class FirstOrderConverterTest {
   private double integrateWithSpecifiedStep(double omega,
                                             double t0, double t,
                                             double step)
-  throws MathUserException, IntegratorException {
+  throws MathIllegalStateException, MathIllegalArgumentException {
     double[] y0 = new double[2];
     y0[0] = FastMath.sin(omega * t0);
     y0[1] = omega * FastMath.cos(omega * t0);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/events/EventStateTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/events/EventStateTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/events/EventStateTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/events/EventStateTest.java Fri Sep  2 15:11:31 2011
@@ -18,9 +18,7 @@
 package org.apache.commons.math.ode.events;
 
 
-import org.apache.commons.math.ConvergenceException;
 import org.apache.commons.math.analysis.solvers.BrentSolver;
-import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.ode.sampling.AbstractStepInterpolator;
 import org.apache.commons.math.ode.sampling.DummyStepInterpolator;
 import org.junit.Assert;
@@ -30,8 +28,7 @@ public class EventStateTest {
 
     // JIRA: MATH-322
     @Test
-    public void closeEvents()
-        throws EventException, ConvergenceException, MathUserException {
+    public void closeEvents() {
 
         final double r1  = 90.0;
         final double r2  = 135.0;

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/events/OverlappingEventsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/events/OverlappingEventsTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/events/OverlappingEventsTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/events/OverlappingEventsTest.java Fri Sep  2 15:11:31 2011
@@ -24,7 +24,6 @@ import org.apache.commons.math.analysis.
 import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.ode.FirstOrderDifferentialEquations;
 import org.apache.commons.math.ode.FirstOrderIntegrator;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.nonstiff.DormandPrince853Integrator;
 import org.junit.Assert;
 import org.junit.Test;
@@ -48,12 +47,9 @@ public class OverlappingEventsTest imple
      * calculations occur very close together instead. Uses event type 0. See
      * {@link org.apache.commons.math.ode.events.EventHandler#g(double, double[])
      * EventHandler.g(double, double[])}.
-     * @throws EventException in case of event evaluation failure
-     * @throws IntegratorException in case of integration failure
-     * @throws MathUserException in case of derivative evaluation failure
      */
     @Test
-    public void testOverlappingEvents0() throws MathUserException, IntegratorException, EventException {
+    public void testOverlappingEvents0() {
         test(0);
     }
 
@@ -61,12 +57,9 @@ public class OverlappingEventsTest imple
      * calculations occur very close together instead. Uses event type 1. See
      * {@link org.apache.commons.math.ode.events.EventHandler#g(double, double[])
      * EventHandler.g(double, double[])}.
-     * @throws EventException in case of event evaluation failure
-     * @throws IntegratorException in case of integration failure
-     * @throws MathUserException in case of derivative evaluation failure
      */
     @Test
-    public void testOverlappingEvents1() throws MathUserException, IntegratorException, EventException {
+    public void testOverlappingEvents1() {
         test(1);
     }
 
@@ -75,11 +68,8 @@ public class OverlappingEventsTest imple
      * @param eventType the type of events to use. See
      * {@link org.apache.commons.math.ode.events.EventHandler#g(double, double[])
      * EventHandler.g(double, double[])}.
-     * @throws EventException in case of event evaluation failure
-     * @throws IntegratorException in case of integration failure
-     * @throws MathUserException in case of derivative evaluation failure
      */
-    public void test(int eventType) throws MathUserException, IntegratorException, EventException {
+    public void test(int eventType) {
         double e = 1e-15;
         FirstOrderIntegrator integrator = new DormandPrince853Integrator(e, 100.0, 1e-7, 1e-7);
         BaseSecantSolver rootSolver = new PegasusSolver(e, e);
@@ -147,18 +137,18 @@ public class OverlappingEventsTest imple
         }
 
         /** {@inheritDoc} */
-        public double g(double t, double[] y) throws EventException {
+        public double g(double t, double[] y) {
             return (eventType == 0) ? y[idx] >= 1.0 ? 1.0 : -1.0
                                     : y[idx] - 1.0;
         }
 
         /** {@inheritDoc} */
-        public int eventOccurred(double t, double[] y, boolean increasing) throws EventException {
+        public int eventOccurred(double t, double[] y, boolean increasing) {
             return STOP;
         }
 
         /** {@inheritDoc} */
-        public void resetState(double t, double[] y) throws EventException {
+        public void resetState(double t, double[] y) {
             // Never called.
         }
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java Fri Sep  2 15:11:31 2011
@@ -18,9 +18,10 @@
 package org.apache.commons.math.ode.nonstiff;
 
 
+import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.ode.FirstOrderIntegrator;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.TestProblem1;
 import org.apache.commons.math.ode.TestProblem5;
 import org.apache.commons.math.ode.TestProblem6;
@@ -31,8 +32,8 @@ import org.junit.Test;
 
 public class AdamsBashforthIntegratorTest {
 
-    @Test(expected=IntegratorException.class)
-    public void dimensionCheck() throws MathUserException, IntegratorException {
+    @Test(expected=DimensionMismatchException.class)
+    public void dimensionCheck() {
         TestProblem1 pb = new TestProblem1();
         FirstOrderIntegrator integ =
             new AdamsBashforthIntegrator(2, 0.0, 1.0, 1.0e-10, 1.0e-10);
@@ -41,8 +42,8 @@ public class AdamsBashforthIntegratorTes
                         1.0, new double[pb.getDimension()+10]);
     }
 
-    @Test(expected=IntegratorException.class)
-    public void testMinStep() throws MathUserException, IntegratorException {
+    @Test(expected=NumberIsTooSmallException.class)
+    public void testMinStep() {
 
           TestProblem1 pb = new TestProblem1();
           double minStep = 0.1 * (pb.getFinalTime() - pb.getInitialTime());
@@ -63,7 +64,7 @@ public class AdamsBashforthIntegratorTes
 
     @Test
     public void testIncreasingTolerance()
-        throws MathUserException, IntegratorException {
+        {
 
         int previousCalls = Integer.MAX_VALUE;
         for (int i = -12; i < -5; ++i) {
@@ -99,7 +100,7 @@ public class AdamsBashforthIntegratorTes
     }
 
     @Test(expected = MathUserException.class)
-    public void exceedMaxEvaluations() throws MathUserException, IntegratorException {
+    public void exceedMaxEvaluations() {
 
         TestProblem1 pb  = new TestProblem1();
         double range = pb.getFinalTime() - pb.getInitialTime();
@@ -115,7 +116,7 @@ public class AdamsBashforthIntegratorTes
     }
 
     @Test
-    public void backward() throws MathUserException, IntegratorException {
+    public void backward() {
 
         TestProblem5 pb = new TestProblem5();
         double range = FastMath.abs(pb.getFinalTime() - pb.getInitialTime());
@@ -133,7 +134,7 @@ public class AdamsBashforthIntegratorTes
     }
 
     @Test
-    public void polynomial() throws MathUserException, IntegratorException {
+    public void polynomial() {
         TestProblem6 pb = new TestProblem6();
         double range = FastMath.abs(pb.getFinalTime() - pb.getInitialTime());
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegratorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegratorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegratorTest.java Fri Sep  2 15:11:31 2011
@@ -18,9 +18,10 @@
 package org.apache.commons.math.ode.nonstiff;
 
 
+import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.ode.FirstOrderIntegrator;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.TestProblem1;
 import org.apache.commons.math.ode.TestProblem5;
 import org.apache.commons.math.ode.TestProblem6;
@@ -31,8 +32,8 @@ import org.junit.Test;
 
 public class AdamsMoultonIntegratorTest {
 
-    @Test(expected=IntegratorException.class)
-    public void dimensionCheck() throws MathUserException, IntegratorException {
+    @Test(expected=DimensionMismatchException.class)
+    public void dimensionCheck() {
         TestProblem1 pb = new TestProblem1();
         FirstOrderIntegrator integ =
             new AdamsMoultonIntegrator(2, 0.0, 1.0, 1.0e-10, 1.0e-10);
@@ -41,8 +42,8 @@ public class AdamsMoultonIntegratorTest 
                         1.0, new double[pb.getDimension()+10]);
     }
 
-    @Test(expected=IntegratorException.class)
-    public void testMinStep() throws MathUserException, IntegratorException {
+    @Test(expected=NumberIsTooSmallException.class)
+    public void testMinStep() {
 
           TestProblem1 pb = new TestProblem1();
           double minStep = 0.1 * (pb.getFinalTime() - pb.getInitialTime());
@@ -63,7 +64,7 @@ public class AdamsMoultonIntegratorTest 
 
     @Test
     public void testIncreasingTolerance()
-        throws MathUserException, IntegratorException {
+        {
 
         int previousCalls = Integer.MAX_VALUE;
         for (int i = -12; i < -2; ++i) {
@@ -99,7 +100,7 @@ public class AdamsMoultonIntegratorTest 
     }
 
     @Test(expected = MathUserException.class)
-    public void exceedMaxEvaluations() throws MathUserException, IntegratorException {
+    public void exceedMaxEvaluations() {
 
         TestProblem1 pb  = new TestProblem1();
         double range = pb.getFinalTime() - pb.getInitialTime();
@@ -115,7 +116,7 @@ public class AdamsMoultonIntegratorTest 
     }
 
     @Test
-    public void backward() throws MathUserException, IntegratorException {
+    public void backward() {
 
         TestProblem5 pb = new TestProblem5();
         double range = FastMath.abs(pb.getFinalTime() - pb.getInitialTime());
@@ -133,7 +134,7 @@ public class AdamsMoultonIntegratorTest 
     }
 
     @Test
-    public void polynomial() throws MathUserException, IntegratorException {
+    public void polynomial() {
         TestProblem6 pb = new TestProblem6();
         double range = FastMath.abs(pb.getFinalTime() - pb.getInitialTime());
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java Fri Sep  2 15:11:31 2011
@@ -18,10 +18,11 @@
 package org.apache.commons.math.ode.nonstiff;
 
 
+import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.ode.FirstOrderDifferentialEquations;
 import org.apache.commons.math.ode.FirstOrderIntegrator;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.TestProblem1;
 import org.apache.commons.math.ode.TestProblem3;
 import org.apache.commons.math.ode.TestProblem5;
@@ -29,7 +30,6 @@ import org.apache.commons.math.ode.TestP
 import org.apache.commons.math.ode.TestProblemFactory;
 import org.apache.commons.math.ode.TestProblemHandler;
 import org.apache.commons.math.ode.events.EventHandler;
-import org.apache.commons.math.ode.nonstiff.ClassicalRungeKuttaIntegrator;
 import org.apache.commons.math.ode.sampling.StepHandler;
 import org.apache.commons.math.ode.sampling.StepInterpolator;
 import org.apache.commons.math.util.FastMath;
@@ -39,7 +39,7 @@ import org.junit.Test;
 public class ClassicalRungeKuttaIntegratorTest {
 
   @Test
-  public void testMissedEndEvent() throws IntegratorException, MathUserException {
+  public void testMissedEndEvent() {
       final double   t0     = 1878250320.0000029;
       final double   tEvent = 1878250379.9999986;
       final double[] k      = { 1.0e-4, 1.0e-5, 1.0e-6 };
@@ -100,9 +100,7 @@ public class ClassicalRungeKuttaIntegrat
                                                         0.0, new double[pb.getDimension()+10],
                                                         1.0, new double[pb.getDimension()]);
         Assert.fail("an exception should have been thrown");
-    } catch(MathUserException de) {
-      Assert.fail("wrong exception caught");
-    } catch(IntegratorException ie) {
+    } catch(DimensionMismatchException ie) {
     }
     try  {
         TestProblem1 pb = new TestProblem1();
@@ -110,9 +108,7 @@ public class ClassicalRungeKuttaIntegrat
                                                           0.0, new double[pb.getDimension()],
                                                           1.0, new double[pb.getDimension()+10]);
           Assert.fail("an exception should have been thrown");
-      } catch(MathUserException de) {
-        Assert.fail("wrong exception caught");
-      } catch(IntegratorException ie) {
+      } catch(DimensionMismatchException ie) {
       }
     try  {
       TestProblem1 pb = new TestProblem1();
@@ -120,15 +116,13 @@ public class ClassicalRungeKuttaIntegrat
                                                         0.0, new double[pb.getDimension()],
                                                         0.0, new double[pb.getDimension()]);
         Assert.fail("an exception should have been thrown");
-    } catch(MathUserException de) {
-      Assert.fail("wrong exception caught");
-    } catch(IntegratorException ie) {
+    } catch(NumberIsTooSmallException ie) {
     }
   }
 
   @Test
   public void testDecreasingSteps()
-    throws MathUserException, IntegratorException  {
+     {
 
     TestProblemAbstract[] problems = TestProblemFactory.getProblems();
     for (int k = 0; k < problems.length; ++k) {
@@ -177,7 +171,7 @@ public class ClassicalRungeKuttaIntegrat
 
   @Test
   public void testSmallStep()
-    throws MathUserException, IntegratorException {
+    {
 
     TestProblem1 pb = new TestProblem1();
     double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001;
@@ -196,7 +190,7 @@ public class ClassicalRungeKuttaIntegrat
 
   @Test
   public void testBigStep()
-    throws MathUserException, IntegratorException {
+    {
 
     TestProblem1 pb = new TestProblem1();
     double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.2;
@@ -215,7 +209,7 @@ public class ClassicalRungeKuttaIntegrat
 
   @Test
   public void testBackward()
-    throws MathUserException, IntegratorException {
+    {
 
     TestProblem5 pb = new TestProblem5();
     double step = FastMath.abs(pb.getFinalTime() - pb.getInitialTime()) * 0.001;
@@ -234,7 +228,7 @@ public class ClassicalRungeKuttaIntegrat
 
   @Test
   public void testKepler()
-    throws MathUserException, IntegratorException {
+    {
 
     final TestProblem3 pb  = new TestProblem3(0.9);
     double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.0003;
@@ -278,7 +272,7 @@ public class ClassicalRungeKuttaIntegrat
 
   @Test
   public void testStepSize()
-    throws MathUserException, IntegratorException {
+    {
       final double step = 1.23456;
       FirstOrderIntegrator integ = new ClassicalRungeKuttaIntegrator(step);
       integ.addStepHandler(new StepHandler() {

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaStepInterpolatorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaStepInterpolatorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/ClassicalRungeKuttaStepInterpolatorTest.java Fri Sep  2 15:11:31 2011
@@ -25,9 +25,7 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Random;
 
-import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.ode.ContinuousOutputModel;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.TestProblem3;
 import org.apache.commons.math.ode.sampling.StepHandler;
 import org.apache.commons.math.ode.sampling.StepInterpolatorTestUtils;
@@ -38,7 +36,7 @@ public class ClassicalRungeKuttaStepInte
 
   @Test
   public void derivativesConsistency()
-  throws MathUserException, IntegratorException {
+  {
     TestProblem3 pb = new TestProblem3();
     double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001;
     ClassicalRungeKuttaIntegrator integ = new ClassicalRungeKuttaIntegrator(step);
@@ -47,8 +45,7 @@ public class ClassicalRungeKuttaStepInte
 
   @Test
   public void serialization()
-    throws MathUserException, IntegratorException,
-           IOException, ClassNotFoundException {
+    throws IOException, ClassNotFoundException {
 
     TestProblem3 pb = new TestProblem3(0.9);
     double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.0003;

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54IntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54IntegratorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54IntegratorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54IntegratorTest.java Fri Sep  2 15:11:31 2011
@@ -17,9 +17,10 @@
 
 package org.apache.commons.math.ode.nonstiff;
 
+import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.ode.FirstOrderIntegrator;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.TestProblem1;
 import org.apache.commons.math.ode.TestProblem3;
 import org.apache.commons.math.ode.TestProblem4;
@@ -27,8 +28,6 @@ import org.apache.commons.math.ode.TestP
 import org.apache.commons.math.ode.TestProblemAbstract;
 import org.apache.commons.math.ode.TestProblemHandler;
 import org.apache.commons.math.ode.events.EventHandler;
-import org.apache.commons.math.ode.nonstiff.DormandPrince54Integrator;
-import org.apache.commons.math.ode.nonstiff.EmbeddedRungeKuttaIntegrator;
 import org.apache.commons.math.ode.sampling.StepHandler;
 import org.apache.commons.math.ode.sampling.StepInterpolator;
 import org.apache.commons.math.util.FastMath;
@@ -38,26 +37,19 @@ import org.junit.Test;
 
 public class DormandPrince54IntegratorTest {
 
-  @Test
+  @Test(expected=DimensionMismatchException.class)
   public void testDimensionCheck() {
-    try  {
       TestProblem1 pb = new TestProblem1();
       DormandPrince54Integrator integrator = new DormandPrince54Integrator(0.0, 1.0,
                                                                            1.0e-10, 1.0e-10);
       integrator.integrate(pb,
                            0.0, new double[pb.getDimension()+10],
                            1.0, new double[pb.getDimension()+10]);
-      Assert.fail("an exception should have been thrown");
-    } catch(MathUserException de) {
-      Assert.fail("wrong exception caught");
-    } catch(IntegratorException ie) {
-    }
   }
 
-  @Test
+  @Test(expected=NumberIsTooSmallException.class)
   public void testMinStep() {
 
-    try {
       TestProblem1 pb = new TestProblem1();
       double minStep = 0.1 * (pb.getFinalTime() - pb.getInitialTime());
       double maxStep = pb.getFinalTime() - pb.getInitialTime();
@@ -73,16 +65,12 @@ public class DormandPrince54IntegratorTe
                       pb.getInitialTime(), pb.getInitialState(),
                       pb.getFinalTime(), new double[pb.getDimension()]);
       Assert.fail("an exception should have been thrown");
-    } catch(MathUserException de) {
-      Assert.fail("wrong exception caught");
-    } catch(IntegratorException ie) {
-    }
 
   }
 
   @Test
   public void testSmallLastStep()
-    throws MathUserException, IntegratorException {
+    {
 
     TestProblemAbstract pb = new TestProblem5();
     double minStep = 1.25;
@@ -108,7 +96,7 @@ public class DormandPrince54IntegratorTe
 
   @Test
   public void testBackward()
-      throws MathUserException, IntegratorException {
+      {
 
       TestProblem5 pb = new TestProblem5();
       double minStep = 0;
@@ -159,7 +147,7 @@ public class DormandPrince54IntegratorTe
 
   @Test
   public void testIncreasingTolerance()
-    throws MathUserException, IntegratorException {
+    {
 
     int previousCalls = Integer.MAX_VALUE;
     for (int i = -12; i < -2; ++i) {
@@ -201,7 +189,7 @@ public class DormandPrince54IntegratorTe
 
   @Test
   public void testEvents()
-    throws MathUserException, IntegratorException {
+    {
 
     TestProblem4 pb = new TestProblem4();
     double minStep = 0;
@@ -235,7 +223,7 @@ public class DormandPrince54IntegratorTe
 
   @Test
   public void testKepler()
-    throws MathUserException, IntegratorException {
+    {
 
     final TestProblem3 pb  = new TestProblem3(0.9);
     double minStep = 0;
@@ -258,7 +246,7 @@ public class DormandPrince54IntegratorTe
 
   @Test
   public void testVariableSteps()
-    throws MathUserException, IntegratorException {
+    {
 
     final TestProblem3 pb  = new TestProblem3(0.9);
     double minStep = 0;

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54StepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54StepInterpolatorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54StepInterpolatorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince54StepInterpolatorTest.java Fri Sep  2 15:11:31 2011
@@ -27,7 +27,6 @@ import java.util.Random;
 
 import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.ode.ContinuousOutputModel;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.TestProblem3;
 import org.apache.commons.math.ode.sampling.StepHandler;
 import org.apache.commons.math.ode.sampling.StepInterpolator;
@@ -40,7 +39,7 @@ public class DormandPrince54StepInterpol
 
   @Test
   public void derivativesConsistency()
-  throws MathUserException, IntegratorException {
+  {
     TestProblem3 pb = new TestProblem3(0.1);
     double minStep = 0;
     double maxStep = pb.getFinalTime() - pb.getInitialTime();
@@ -54,8 +53,7 @@ public class DormandPrince54StepInterpol
 
   @Test
   public void serialization()
-    throws MathUserException, IntegratorException,
-           IOException, ClassNotFoundException {
+    throws IOException, ClassNotFoundException {
 
     TestProblem3 pb = new TestProblem3(0.9);
     double minStep = 0;
@@ -105,7 +103,7 @@ public class DormandPrince54StepInterpol
 
   @Test
   public void checkClone()
-    throws MathUserException, IntegratorException {
+    {
       TestProblem3 pb = new TestProblem3(0.9);
       double minStep = 0;
       double maxStep = pb.getFinalTime() - pb.getInitialTime();

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853IntegratorTest.java Fri Sep  2 15:11:31 2011
@@ -17,10 +17,11 @@
 
 package org.apache.commons.math.ode.nonstiff;
 
+import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.ode.FirstOrderDifferentialEquations;
 import org.apache.commons.math.ode.FirstOrderIntegrator;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.TestProblem1;
 import org.apache.commons.math.ode.TestProblem3;
 import org.apache.commons.math.ode.TestProblem4;
@@ -37,7 +38,7 @@ import org.junit.Test;
 public class DormandPrince853IntegratorTest {
 
   @Test
-  public void testMissedEndEvent() throws IntegratorException, MathUserException {
+  public void testMissedEndEvent() {
       final double   t0     = 1878250320.0000029;
       final double   tEvent = 1878250379.9999986;
       final double[] k  = { 1.0e-4, 1.0e-5, 1.0e-6 };
@@ -93,9 +94,8 @@ public class DormandPrince853IntegratorT
 
   }
 
-  @Test
+  @Test(expected=DimensionMismatchException.class)
   public void testDimensionCheck() {
-    try  {
       TestProblem1 pb = new TestProblem1();
       DormandPrince853Integrator integrator = new DormandPrince853Integrator(0.0, 1.0,
                                                                              1.0e-10, 1.0e-10);
@@ -103,15 +103,10 @@ public class DormandPrince853IntegratorT
                            0.0, new double[pb.getDimension()+10],
                            1.0, new double[pb.getDimension()+10]);
       Assert.fail("an exception should have been thrown");
-    } catch(MathUserException de) {
-      Assert.fail("wrong exception caught");
-    } catch(IntegratorException ie) {
-    }
   }
 
-  @Test
+  @Test(expected=NumberIsTooSmallException.class)
   public void testNullIntervalCheck() {
-    try  {
       TestProblem1 pb = new TestProblem1();
       DormandPrince853Integrator integrator = new DormandPrince853Integrator(0.0, 1.0,
                                                                              1.0e-10, 1.0e-10);
@@ -119,16 +114,11 @@ public class DormandPrince853IntegratorT
                            0.0, new double[pb.getDimension()],
                            0.0, new double[pb.getDimension()]);
       Assert.fail("an exception should have been thrown");
-    } catch(MathUserException de) {
-      Assert.fail("wrong exception caught");
-    } catch(IntegratorException ie) {
-    }
   }
 
-  @Test
+  @Test(expected=NumberIsTooSmallException.class)
   public void testMinStep() {
 
-    try {
       TestProblem1 pb = new TestProblem1();
       double minStep = 0.1 * (pb.getFinalTime() - pb.getInitialTime());
       double maxStep = pb.getFinalTime() - pb.getInitialTime();
@@ -144,16 +134,12 @@ public class DormandPrince853IntegratorT
                       pb.getInitialTime(), pb.getInitialState(),
                       pb.getFinalTime(), new double[pb.getDimension()]);
       Assert.fail("an exception should have been thrown");
-    } catch(MathUserException de) {
-      Assert.fail("wrong exception caught");
-    } catch(IntegratorException ie) {
-    }
 
   }
 
   @Test
   public void testIncreasingTolerance()
-    throws MathUserException, IntegratorException {
+    {
 
     int previousCalls = Integer.MAX_VALUE;
     AdaptiveStepsizeIntegrator integ =
@@ -190,7 +176,7 @@ public class DormandPrince853IntegratorT
 
   @Test
   public void testBackward()
-      throws MathUserException, IntegratorException {
+      {
 
       TestProblem5 pb = new TestProblem5();
       double minStep = 0;
@@ -214,7 +200,7 @@ public class DormandPrince853IntegratorT
 
   @Test
   public void testEvents()
-    throws MathUserException, IntegratorException {
+    {
 
     TestProblem4 pb = new TestProblem4();
     double minStep = 0;
@@ -247,7 +233,7 @@ public class DormandPrince853IntegratorT
 
   @Test
   public void testKepler()
-    throws MathUserException, IntegratorException {
+    {
 
     final TestProblem3 pb  = new TestProblem3(0.9);
     double minStep = 0;
@@ -270,7 +256,7 @@ public class DormandPrince853IntegratorT
 
   @Test
   public void testVariableSteps()
-    throws MathUserException, IntegratorException {
+    {
 
     final TestProblem3 pb  = new TestProblem3(0.9);
     double minStep = 0;
@@ -291,7 +277,7 @@ public class DormandPrince853IntegratorT
 
   @Test
   public void testUnstableDerivative()
-  throws MathUserException, IntegratorException {
+  {
     final StepProblem stepProblem = new StepProblem(0.0, 1.0, 2.0);
     FirstOrderIntegrator integ =
       new DormandPrince853Integrator(0.1, 10, 1.0e-12, 0.0);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853StepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853StepInterpolatorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853StepInterpolatorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/DormandPrince853StepInterpolatorTest.java Fri Sep  2 15:11:31 2011
@@ -27,7 +27,6 @@ import java.util.Random;
 
 import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.ode.ContinuousOutputModel;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.TestProblem3;
 import org.apache.commons.math.ode.sampling.StepHandler;
 import org.apache.commons.math.ode.sampling.StepInterpolator;
@@ -40,7 +39,7 @@ public class DormandPrince853StepInterpo
 
   @Test
   public void derivativesConsistency()
-  throws MathUserException, IntegratorException {
+  {
     TestProblem3 pb = new TestProblem3(0.1);
     double minStep = 0;
     double maxStep = pb.getFinalTime() - pb.getInitialTime();
@@ -54,8 +53,7 @@ public class DormandPrince853StepInterpo
 
   @Test
   public void serialization()
-    throws MathUserException, IntegratorException,
-           IOException, ClassNotFoundException {
+    throws IOException, ClassNotFoundException {
 
     TestProblem3 pb = new TestProblem3(0.9);
     double minStep = 0;
@@ -105,7 +103,7 @@ public class DormandPrince853StepInterpo
 
   @Test
   public void checklone()
-  throws MathUserException, IntegratorException {
+  {
     TestProblem3 pb = new TestProblem3(0.9);
     double minStep = 0;
     double maxStep = pb.getFinalTime() - pb.getInitialTime();

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/EulerIntegratorTest.java Fri Sep  2 15:11:31 2011
@@ -18,17 +18,15 @@
 package org.apache.commons.math.ode.nonstiff;
 
 
-import org.apache.commons.math.exception.MathUserException;
+import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.ode.FirstOrderDifferentialEquations;
 import org.apache.commons.math.ode.FirstOrderIntegrator;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.TestProblem1;
 import org.apache.commons.math.ode.TestProblem5;
 import org.apache.commons.math.ode.TestProblemAbstract;
 import org.apache.commons.math.ode.TestProblemFactory;
 import org.apache.commons.math.ode.TestProblemHandler;
 import org.apache.commons.math.ode.events.EventHandler;
-import org.apache.commons.math.ode.nonstiff.EulerIntegrator;
 import org.apache.commons.math.ode.sampling.StepHandler;
 import org.apache.commons.math.ode.sampling.StepInterpolator;
 import org.apache.commons.math.util.FastMath;
@@ -37,23 +35,18 @@ import org.junit.Test;
 
 public class EulerIntegratorTest {
 
-  @Test
+  @Test(expected=DimensionMismatchException.class)
   public void testDimensionCheck() {
-    try  {
       TestProblem1 pb = new TestProblem1();
       new EulerIntegrator(0.01).integrate(pb,
                                           0.0, new double[pb.getDimension()+10],
                                           1.0, new double[pb.getDimension()+10]);
         Assert.fail("an exception should have been thrown");
-    } catch(MathUserException de) {
-      Assert.fail("wrong exception caught");
-    } catch(IntegratorException ie) {
-    }
   }
 
   @Test
   public void testDecreasingSteps()
-    throws MathUserException, IntegratorException {
+    {
 
     TestProblemAbstract[] problems = TestProblemFactory.getProblems();
     for (int k = 0; k < problems.length; ++k) {
@@ -99,7 +92,7 @@ public class EulerIntegratorTest {
 
   @Test
   public void testSmallStep()
-    throws MathUserException, IntegratorException {
+    {
 
     TestProblem1 pb  = new TestProblem1();
     double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001;
@@ -120,7 +113,7 @@ public class EulerIntegratorTest {
 
   @Test
   public void testBigStep()
-    throws MathUserException, IntegratorException {
+    {
 
     TestProblem1 pb  = new TestProblem1();
     double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.2;
@@ -140,7 +133,7 @@ public class EulerIntegratorTest {
 
   @Test
   public void testBackward()
-      throws MathUserException, IntegratorException {
+      {
 
       TestProblem5 pb = new TestProblem5();
       double step = FastMath.abs(pb.getFinalTime() - pb.getInitialTime()) * 0.001;
@@ -159,7 +152,7 @@ public class EulerIntegratorTest {
 
   @Test
   public void testStepSize()
-    throws MathUserException, IntegratorException {
+    {
       final double step = 1.23456;
       FirstOrderIntegrator integ = new EulerIntegrator(step);
       integ.addStepHandler(new StepHandler() {

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/EulerStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/EulerStepInterpolatorTest.java?rev=1164573&r1=1164572&r2=1164573&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/EulerStepInterpolatorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/EulerStepInterpolatorTest.java Fri Sep  2 15:11:31 2011
@@ -27,7 +27,6 @@ import java.util.Random;
 
 import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.ode.ContinuousOutputModel;
-import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.TestProblem1;
 import org.apache.commons.math.ode.TestProblem3;
 import org.apache.commons.math.ode.sampling.StepHandler;
@@ -39,7 +38,7 @@ import org.junit.Test;
 public class EulerStepInterpolatorTest {
 
   @Test
-  public void noReset() throws MathUserException {
+  public void noReset() {
 
     double[]   y    =   { 0.0, 1.0, -2.0 };
     double[][] yDot = { { 1.0, 2.0, -2.0 } };
@@ -121,7 +120,7 @@ public class EulerStepInterpolatorTest {
 
   @Test
   public void derivativesConsistency()
-  throws MathUserException, IntegratorException {
+  {
     TestProblem3 pb = new TestProblem3();
     double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001;
     EulerIntegrator integ = new EulerIntegrator(step);
@@ -130,8 +129,7 @@ public class EulerStepInterpolatorTest {
 
   @Test
   public void serialization()
-    throws MathUserException, IntegratorException,
-           IOException, ClassNotFoundException {
+    throws IOException, ClassNotFoundException {
 
     TestProblem1 pb = new TestProblem1();
     double step = (pb.getFinalTime() - pb.getInitialTime()) * 0.001;



Mime
View raw message