Details
-
Improvement
-
Status: Resolved
-
Trivial
-
Resolution: Won't Fix
-
2.3.1, 2.3.2
-
None
-
None
-
New
Description
Here's the function:
public static HashSet getWordSet(File wordfile) throws IOException {
HashSet result = new HashSet();
FileReader reader = null;
try
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.