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

ClassCastException thrown in the map(String,int,TermVectorOffsetInfo[],int[]) method in org.apache.lucene.index.SortedTermVectorMapper

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.0.2, 3.1, 3.4, 3.5
    • None
    • core/index
    • None
    • New

    Description

      The method "map" in the "SortedTermVectorMapper" class does not check the parameter "term" for the valid values. It throws ClassCastException when called with a invalid string for the parameter "term" (i.e., "var3.map("*", (-1), null, null)"). The exception thrown is due to an explict cast(i.e., casting the return value of termToTVE.get(term) to type "TermVectorEntry").

      Suggested Fixes: Replace the beginning of the method body for the class "SortedTermVectorMapper" by changing it like this:

      public void map(String term, int frequency, TermVectorOffsetInfo[] offsets, int[] positions) {
      if(termToTVE.get(term) instanceof TermVectorEntry)

      { TermVectorEntry entry = (TermVectorEntry) termToTVE.get(term); ... }

      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            shinhwei SHIN HWEI TAN
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 0.05h
                0.05h
                Remaining:
                Remaining Estimate - 0.05h
                0.05h
                Logged:
                Time Spent - Not Specified
                Not Specified