commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Maisonobe (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (MATH-467) HarmonicCoefficientsGuesser.sortObservations() potentlal NPE warning
Date Wed, 23 Mar 2011 20:31:07 GMT

     [ 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

Mime
View raw message