Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-3783

An incomplete fix for the NPE bugs in NearSpansUnordered.java

Details

    • New

    Description

      The fix revision 698487 was aimed to remove an NPE bug (LUCENE-1404) on the returned value of "min()" in the method "isPayloadAvailable" of the file "/lucene/java/trunk/src/java/org/apache/lucene/search/spans/NearSpansUnordered.java" , but it is incomplete.

      Since the returned value "min()" could be null during the runtime execution, its value should also be null-checked before being dereferenced in other methods.

      The buggy code locations the same fix needs to be applied at are as bellows:

      Lines 159 , 170 , and 196 of the methods "next()"
      Line 216 of the methods "skipTo()"
      Line 230 of the methods "doc()"
      230 public int doc()

      { return min().doc(); }

      Line 232 of the methods "start()"
      232 public int start()

      { return min().start(); }

      Line 315 of the methods "atMatch()"
      private boolean atMatch()

      { 315 return (min().doc() == max.doc()) && ((max.end() - min().start() - totalLength) <= slop); }

      Attachments

        Activity

          People

            Unassigned Unassigned
            guangtai Guangtai Liang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 10m
                10m
                Remaining:
                Remaining Estimate - 10m
                10m
                Logged:
                Time Spent - Not Specified
                Not Specified