You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Cyrille Artho (JIRA)" <ji...@apache.org> on 2015/05/07 08:43:59 UTC

[jira] [Updated] (MATH-1116) NullPointerException not advertized in Javadoc

     [ https://issues.apache.org/jira/browse/MATH-1116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cyrille Artho updated MATH-1116:
--------------------------------
    Attachment: Report7.java

Self-contained unit test to reproduce NullPointerException on SpearmansCorrelation (the need to initialize it further is not documented yet).

> NullPointerException not advertized in Javadoc
> ----------------------------------------------
>
>                 Key: MATH-1116
>                 URL: https://issues.apache.org/jira/browse/MATH-1116
>             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: IllegalStateB.java, Report2.java, Report6.java, Report7.java
>
>
> 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
(v6.3.4#6332)