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: 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.

Reply via email to