Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-467

HarmonicCoefficientsGuesser.sortObservations() potentlal NPE warning

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.2, 3.0
    • None
    • None
    • None

    Description

      HarmonicCoefficientsGuesser.sortObservations()

      generates an NPE warning from Eclipse which thinks that mI can be null in the while condition.

      The code looks like:

      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
      

      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?

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: