> +++ > commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java > Sat Nov 20 21:01:50 2010 > @@ -20,9 +20,9 @@ package org.apache.commons.math.linear; > import java.util.Iterator; > import java.util.NoSuchElementException; > > -import org.apache.commons.math.exception.FunctionEvaluationException; > import org.apache.commons.math.exception.MathUnsupportedOperationException; > import org.apache.commons.math.exception.DimensionMismatchException; > +import org.apache.commons.math.exception.MathUserException; > import org.apache.commons.math.exception.OutOfRangeException; > import org.apache.commons.math.analysis.BinaryFunction; > import org.apache.commons.math.analysis.ComposableFunction; > @@ -156,11 +156,7 @@ public abstract class AbstractRealVector > /** {...@inheritdoc} */ > public RealVector mapAddToSelf(double d) { > if (d != 0) { > - try { > - return mapToSelf(BinaryFunction.ADD.fix1stArgument(d)); > - } catch (FunctionEvaluationException e) { > - throw new IllegalArgumentException(e); > - } > + return mapToSelf(BinaryFunction.ADD.fix1stArgument(d)); > } > return this; > } > @@ -356,7 +352,7 @@ public abstract class AbstractRealVector > public RealVector mapAbsToSelf() { > try { > return mapToSelf(ComposableFunction.ABS); > - } catch (FunctionEvaluationException e) { > + } catch (MathUserException e) { > throw new IllegalArgumentException(e); > } > }
This is in contravention of the stated policy of not catching "MathUserException" in CM code. Moreover, it is useless since the ABS function will never throw such an exception. In fact, I think that none of these functions throws any exception; the "try/catch" should be removed entirely. Regards, Gilles --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org