replaced RuntimeException by MathRuntimeException

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/branches/MATH_2_0@710171 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2008-11-03 21:36:31 +00:00
parent 9e8e88d916
commit ea15217793
5 changed files with 29 additions and 17 deletions

View File

@ -21,6 +21,7 @@ import java.util.ArrayList;
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 @@ public class ContinuousOutputModel
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);
}
}

View File

@ -22,6 +22,7 @@ import java.util.Comparator;
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 @@ public abstract class DirectSearchOptimizer {
} catch (DimensionMismatchException dme) {
// this should not happen
throw new RuntimeException("internal error");
throw new MathRuntimeException("unexpected exception caught", new Object[0], dme);
}
}

View File

@ -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 @@ public class EmpiricalDistributionImpl implements Serializable, EmpiricalDistrib
da.computeStats();
fillBinStats(in);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
throw new MathRuntimeException(e);
}
loaded = true;
@ -418,7 +419,7 @@ public class EmpiricalDistributionImpl implements Serializable, EmpiricalDistrib
}
}
}
throw new RuntimeException("No bin selected");
throw new MathRuntimeException("no bin selected", new Object[0]);
}
/**

View File

@ -26,6 +26,7 @@ import java.util.ArrayList;
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 @@ public final class EmpiricalDistributionTest extends RetryTestCase {
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 @@ public final class EmpiricalDistributionTest extends RetryTestCase {
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 @@ public final class EmpiricalDistributionTest extends RetryTestCase {
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 @@ public final class EmpiricalDistributionTest extends RetryTestCase {
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");
}
}

View File

@ -17,6 +17,8 @@
package org.apache.commons.math.util;
import org.apache.commons.math.MathRuntimeException;
/**
* @version $Revision$ $Date$
*/
@ -57,7 +59,7 @@ public class TestBean {
*
*/
public Double getZ() {
throw new RuntimeException();
throw new MathRuntimeException();
}
/**