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

        David Dillard created issue -
        Robert Muir made changes -
        Field Original Value New Value
        Component/s contrib/analyzers [ 12312333 ]
        Component/s Analysis [ 12310230 ]
        Mark Thomas made changes -
        Workflow jira [ 12427521 ] Default workflow, editable Closed status [ 12563555 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12563555 ] jira [ 12585144 ]
        Shai Erera made changes -
        Component/s modules/analysis [ 12310230 ]
        Component/s contrib/analyzers [ 12312333 ]
        Erick Erickson made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Won't Fix [ 2 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development