You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Luc Maisonobe (JIRA)" <ji...@apache.org> on 2011/03/23 21:31:07 UTC

[jira] [Closed] (MATH-467) HarmonicCoefficientsGuesser.sortObservations() potentlal NPE warning

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

Luc Maisonobe closed MATH-467.
------------------------------


Closing issue as it was included in version 2.2, which has been released

> HarmonicCoefficientsGuesser.sortObservations() potentlal NPE warning
> --------------------------------------------------------------------
>
>                 Key: MATH-467
>                 URL: https://issues.apache.org/jira/browse/MATH-467
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.2, 3.0
>            Reporter: Sebb
>            Priority: Minor
>
> HarmonicCoefficientsGuesser.sortObservations()
> generates an NPE warning from Eclipse which thinks that mI can be null in the while condition.
> The code looks like:
> {code}
> WeightedObservedPoint mI = observations[i];
> while ((i >= 0) && (curr.getX() < mI.getX())) {
>     observations[i + 1] = mI;
>     if (i-- != 0) {
>         mI = observations[i];
>     } else {
>         mI = null;
>     }
> }
> // mI is not used further
> {code}
> It looks to me as though the "mI = null" statement is either redundant or wrong - why would one want to replace one of the observations with null during a sort?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira