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

Unncessary creation of object in org.apache.lucene.analysis.WordlistLoader.getWordSet()

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Won't Fix
    • 2.3.1, 2.3.2
    • None
    • modules/analysis
    • None
    • New

    Description

      Here's the function:

      public static HashSet getWordSet(File wordfile) throws IOException {
      HashSet result = new HashSet();
      FileReader reader = null;
      try

      { reader = new FileReader(wordfile); result = getWordSet(reader); }

      finally

      { if (reader != null) reader.close(); }

      return result;
      }

      The creation of the new HashSet object in the declaration of "result" is unnecessary. Either "result" will be unconditionally set by the call to getWordSet() or an exception will occur.

      This was detected by FindBugs.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ddillard David Dillard
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: