Lucene - Core
  1. Lucene - Core
  2. LUCENE-1248

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

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Won't Fix
    • Affects Version/s: 2.3.1, 2.3.2
    • Fix Version/s: None
    • Component/s: modules/analysis
    • Labels:
      None
    • Lucene Fields:
      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.

        Activity

        Hide
        Erick Erickson added a comment -

        SPRING_CLEANING_2013 We can reopen if necessary.

        Show
        Erick Erickson added a comment - SPRING_CLEANING_2013 We can reopen if necessary.

          People

          • Assignee:
            Unassigned
            Reporter:
            David Dillard
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development