Author: luc
Date: Mon Nov 3 13:36:31 2008
New Revision: 710171
URL: http://svn.apache.org/viewvc?rev=710171&view=rev
Log:
replaced RuntimeException by MathRuntimeException
Modified:
commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/ContinuousOutputModel.java
commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/optimization/DirectSearchOptimizer.java
commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java
commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/random/EmpiricalDistributionTest.java
commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/util/TestBean.java
Modified:
commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/ContinuousOutputModel.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/ContinuousOutputModel.java?rev=710171&r1=710170&r2=710171&view=diff
==============================================================================
---
commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/ContinuousOutputModel.java
(original)
+++
commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/ode/ContinuousOutputModel.java
Mon Nov 3 13:36:31 2008
@@ -21,6 +21,7 @@
import java.util.List;
import java.io.Serializable;
+import org.apache.commons.math.MathRuntimeException;
import org.apache.commons.math.ode.nonstiff.AdaptiveStepsizeIntegrator;
import org.apache.commons.math.ode.sampling.StepHandler;
import org.apache.commons.math.ode.sampling.StepInterpolator;
@@ -314,8 +315,7 @@
steps.get(index).setInterpolatedTime(time);
} catch (DerivativeException de) {
- throw new RuntimeException("unexpected DerivativeException caught: " +
- de.getMessage());
+ throw new MathRuntimeException("unexpected exception caught", new
Object[0], de);
}
}
Modified:
commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/optimization/DirectSearchOptimizer.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/optimization/DirectSearchOptimizer.java?rev=710171&r1=710170&r2=710171&view=diff
==============================================================================
---
commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/optimization/DirectSearchOptimizer.java
(original)
+++
commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/optimization/DirectSearchOptimizer.java
Mon Nov 3 13:36:31 2008
@@ -22,6 +22,7 @@
import org.apache.commons.math.ConvergenceException;
import org.apache.commons.math.DimensionMismatchException;
+import org.apache.commons.math.MathRuntimeException;
import org.apache.commons.math.linear.RealMatrix;
import org.apache.commons.math.random.CorrelatedRandomVectorGenerator;
import org.apache.commons.math.random.JDKRandomGenerator;
@@ -269,7 +270,7 @@
} catch (DimensionMismatchException dme) {
// this should not happen
- throw new RuntimeException("internal error");
+ throw new MathRuntimeException("unexpected exception caught", new
Object[0], dme);
}
}
Modified:
commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java?rev=710171&r1=710170&r2=710171&view=diff
==============================================================================
---
commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java
(original)
+++
commons/proper/math/branches/MATH_2_0/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java
Mon Nov 3 13:36:31 2008
@@ -17,19 +17,20 @@
package org.apache.commons.math.random;
-import java.io.EOFException;
-import java.io.Serializable;
import java.io.BufferedReader;
-import java.io.FileReader;
+import java.io.EOFException;
import java.io.File;
+import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.io.Serializable;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.math.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math.MathRuntimeException;
import org.apache.commons.math.stat.descriptive.StatisticalSummary;
+import org.apache.commons.math.stat.descriptive.SummaryStatistics;
/**
* Implements <code>EmpiricalDistribution</code> interface. This
implementation
@@ -110,7 +111,7 @@
da.computeStats();
fillBinStats(in);
} catch (Exception e) {
- throw new RuntimeException(e.getMessage());
+ throw new MathRuntimeException(e);
}
loaded = true;
@@ -418,7 +419,7 @@
}
}
}
- throw new RuntimeException("No bin selected");
+ throw new MathRuntimeException("no bin selected", new Object[0]);
}
/**
Modified:
commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/random/EmpiricalDistributionTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/random/EmpiricalDistributionTest.java?rev=710171&r1=710170&r2=710171&view=diff
==============================================================================
---
commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/random/EmpiricalDistributionTest.java
(original)
+++
commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/random/EmpiricalDistributionTest.java
Mon Nov 3 13:36:31 2008
@@ -26,6 +26,7 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.apache.commons.math.MathRuntimeException;
import org.apache.commons.math.RetryTestCase;
import org.apache.commons.math.TestUtils;
import org.apache.commons.math.stat.descriptive.SummaryStatistics;
@@ -141,7 +142,11 @@
empiricalDistribution.getNextValue();
empiricalDistribution2.getNextValue();
fail("Expecting IllegalStateException");
- } catch (IllegalStateException ex) {;}
+ } catch (IllegalStateException ex) {
+ // expected
+ } catch (Exception e) {
+ fail("wrong exception caught");
+ }
}
/**
@@ -190,9 +195,10 @@
try {
dist.load((double[]) null);
fail("load((double[]) null) expected RuntimeException");
- }
- catch (RuntimeException e) {
+ } catch (MathRuntimeException e) {
// expected
+ } catch (Exception e) {
+ fail("wrong exception caught");
}
}
@@ -201,9 +207,10 @@
try {
dist.load((URL) null);
fail("load((URL) null) expected NullPointerException");
- }
- catch (NullPointerException e) {
+ } catch (NullPointerException e) {
// expected
+ } catch (Exception e) {
+ fail("wrong exception caught");
}
}
@@ -212,9 +219,10 @@
try {
dist.load((File) null);
fail("load((File) null) expected NullPointerException");
- }
- catch (NullPointerException e) {
+ } catch (NullPointerException e) {
// expected
+ } catch (Exception e) {
+ fail("wrong exception caught");
}
}
Modified:
commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/util/TestBean.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/util/TestBean.java?rev=710171&r1=710170&r2=710171&view=diff
==============================================================================
---
commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/util/TestBean.java
(original)
+++
commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/util/TestBean.java
Mon Nov 3 13:36:31 2008
@@ -17,6 +17,8 @@
package org.apache.commons.math.util;
+import org.apache.commons.math.MathRuntimeException;
+
/**
* @version $Revision$ $Date$
*/
@@ -57,7 +59,7 @@
*
*/
public Double getZ() {
- throw new RuntimeException();
+ throw new MathRuntimeException();
}
/**