commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cyrille Artho (JIRA)" <>
Subject [jira] [Commented] (MATH-1116) NullPointerException not advertized in Javadoc
Date Thu, 07 May 2015 06:43:00 GMT


Cyrille Artho commented on MATH-1116:

In general, the need to initialize newly constructed objects with more data is now documented,
but we have found two cases where a NullPointerException is thrown because of missing data.

The documentation should be updated to reflect this. This is similar to issues report in MATH-1116
but concerns classes that are not going to be deprecated (as far as we can tell).

    org.apache.commons.math3.ode.nonstiff.HighamHall54Integrator var1 = new org.apache.commons.math3.ode.nonstiff.HighamHall54Integrator(0.0d,
0.0d, 0.0d, 0.0d);
    double[] var2 = new double[] { 0.0d };
    var1.computeDerivatives(0.0d, var2, var2); // NPE

    new org.apache.commons.math3.stat.correlation.SpearmansCorrelation().getCorrelationMatrix();
// NPE

> NullPointerException not advertized in Javadoc
> ----------------------------------------------
>                 Key: MATH-1116
>                 URL:
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.2
>         Environment: Mac OS 10.9, Java 6, 7
>            Reporter: Cyrille Artho
>            Priority: Minor
>              Labels: javadoc
>         Attachments:,
> The following statement produces a NullPointerException:
> new org.apache.commons.math3.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer().getWeight();
> The documentation does not seem to indicate that other data must be set before getWeight
is used (at least I could not find that information). In this case, weightMatrix is still
null because it has not been initialized.
> This call should probably throw an IllegalStateException, which makes it clear that this
API usage is incorrect.
> This test uses LevenbergMarquardtOptimizer but any instantiable subclass of MultivariateVectorOptimizer
probably works the same way.

This message was sent by Atlassian JIRA

View raw message