commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] Updated: (MATH-467) HarmonicCoefficientsGuesser.sortObservations() potentlal NPE warning
Date Thu, 06 Jan 2011 15:34:47 GMT

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

Sebb updated MATH-467:
----------------------

    Affects Version/s: 2.2

> 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.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message