Elia Bertolina created MATH-1646:
------------------------------------

             Summary: PreconditionedIterativeLinearSolver.solve() not throwing 
proper NullArgumentException
                 Key: MATH-1646
                 URL: https://issues.apache.org/jira/browse/MATH-1646
             Project: Commons Math
          Issue Type: Bug
    Affects Versions: 3.6.1
            Reporter: Elia Bertolina


PreconditionedIterativeLinearSolver.solve(RealLinearOperator a, 
RealLinearOperator m,RealVector b, RealVector x0) does not throw a 
NullArgumentException when one of the parameters is null.In the documentation 
it is stated that an NullArgumentException will be thrown if any of the 
parameters is null.

However, in this test case:

 
{code:java}
public class PreconditionedIterativeLinearSolver_failure_Test {
    public void test() throws Throwable {
        Array2DRowRealMatrix array2DRowRealMatrix =
                             new Array2DRowRealMatrix();
        ConjugateGradient conjugateGradient = 
                             new ConjugateGradient(49, 49, true);
        ArrayRealVector arrayRealVector = new ArrayRealVector();
        try {
            RealVector realVector = conjugateGradient.solve(
            (RealLinearOperator) array2DRowRealMatrix,
            (RealLinearOperator) null,
            (RealVector) arrayRealVector,
            (RealVector) arrayRealVector);
            org.junit.Assert.fail();
        } 
        catch 
        (org.apache.commons.math3.exception.NullArgumentException e){
          //Exception caught and test successful        
        }
    }
}{code}
 

The second RealLinearOperator parameter is null and a NullArgumentException 
should be thrown, however the method executes normally, and test case fails.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to