use properly the top level exceptions for too specific cases which don't need a devoted exception class

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@506600 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2007-02-12 19:35:59 +00:00
parent ee556907bb
commit 08042a0c22
3 changed files with 9 additions and 10 deletions

View File

@ -198,11 +198,10 @@ public class UnivariateRealSolverUtils {
if (fa * fb >= 0.0 ) {
throw new ConvergenceException
("Number of iterations= " + numIterations +
" maximum iterations= " + maximumIterations +
" initial= " + initial + " lowerBound=" + lowerBound +
" upperBound=" + upperBound + " final a value=" + a +
" final b value=" + b + " f(a)=" + fa + " f(b)=" + fb);
("Number of iterations={0}, maximum iterations={1}, initial={2}, lower bound={3}, upper bound={4}, final a value={5}, final b value={6}, f(a)={7}, f(b)={8}",
new Object[] { new Integer(numIterations), new Integer(maximumIterations),
new Double(initial), new Double(lowerBound), new Double(upperBound),
new Double(a), new Double(b), new Double(fa), new Double(fb) });
}
return new double[]{a, b};

View File

@ -71,8 +71,7 @@ public abstract class AbstractContinuousDistribution
try {
return cumulativeProbability(x) - p;
} catch (MathException ex) {
throw new FunctionEvaluationException
(x, "Error computing cdf", ex);
throw new FunctionEvaluationException(x, ex.getPattern(), ex.getArguments(), ex);
}
}
};

View File

@ -44,7 +44,7 @@ public class DefaultTransformer implements NumberTransformer, Serializable {
public double transform(Object o) throws MathException{
if (o == null) {
throw new MathException("Conversion Exception in Transformation, Object is null");
throw new MathException("Conversion Exception in Transformation, Object is null", new Object[0]);
}
if (o instanceof Number) {
@ -54,7 +54,8 @@ public class DefaultTransformer implements NumberTransformer, Serializable {
try {
return new Double(o.toString()).doubleValue();
} catch (Exception e) {
throw new MathException("Conversion Exception in Transformation: " + e.getMessage(), e);
throw new MathException("Conversion Exception in Transformation: {0}",
new Object[] { e.getMessage() }, e);
}
}
}
}