Index: GermanAnalyzer.java =================================================================== RCS file: /home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/analysis/de/GermanAnalyzer.java,v retrieving revision 1.9 diff -u -r1.9 GermanAnalyzer.java --- GermanAnalyzer.java 12 Mar 2004 09:45:17 -0000 1.9 +++ GermanAnalyzer.java 26 Mar 2004 16:50:27 -0000 @@ -61,6 +61,7 @@ import org.apache.lucene.analysis.standard.StandardTokenizer; import java.io.File; +import java.io.IOException; import java.io.Reader; import java.util.HashSet; import java.util.Hashtable; @@ -129,7 +130,7 @@ /** * Builds an analyzer with the given stop words. */ - public GermanAnalyzer(File stopwords) { + public GermanAnalyzer(File stopwords) throws IOException { stopSet = new HashSet(WordlistLoader.getWordtable(stopwords).keySet()); } @@ -150,7 +151,7 @@ /** * Builds an exclusionlist from the words contained in the given file. */ - public void setStemExclusionTable(File exclusionlist) { + public void setStemExclusionTable(File exclusionlist) throws IOException { exclusionSet = new HashSet(WordlistLoader.getWordtable(exclusionlist).keySet()); } Index: WordlistLoader.java =================================================================== RCS file: /home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/analysis/de/WordlistLoader.java,v retrieving revision 1.6 diff -u -r1.6 WordlistLoader.java --- WordlistLoader.java 12 Mar 2004 09:43:48 -0000 1.6 +++ WordlistLoader.java 26 Mar 2004 16:50:27 -0000 @@ -62,8 +62,7 @@ /** * Loads a text file and adds every line as an entry to a Hashtable. Every line - * should contain only one word. If the file is not found or on any error, an - * empty table is returned. + * should contain only one word. * * @author Gerhard Schwarz * @version $Id: WordlistLoader.java,v 1.6 2004/03/12 09:43:48 ehatcher Exp $ @@ -75,7 +74,7 @@ * @param path Path to the wordlist * @param wordfile Name of the wordlist */ - public static Hashtable getWordtable(String path, String wordfile) { + public static Hashtable getWordtable(String path, String wordfile) throws IOException { if (path == null || wordfile == null) { return new Hashtable(); } @@ -85,7 +84,7 @@ /** * @param wordfile Complete path to the wordlist */ - public static Hashtable getWordtable(String wordfile) { + public static Hashtable getWordtable(String wordfile) throws IOException { if (wordfile == null) { return new Hashtable(); } @@ -96,13 +95,16 @@ * @param wordfile File containing the wordlist * @todo Create a Set version of this method */ - public static Hashtable getWordtable(File wordfile) { + public static Hashtable getWordtable(File wordfile) throws IOException { if (wordfile == null) { return new Hashtable(); } Hashtable result = null; + FileReader freader = null; + LineNumberReader lnr = null; try { - LineNumberReader lnr = new LineNumberReader(new FileReader(wordfile)); + freader = new FileReader(wordfile); + lnr = new LineNumberReader(freader); String word = null; String[] stopwords = new String[100]; int wordcount = 0; @@ -117,9 +119,11 @@ } result = makeWordTable(stopwords, wordcount); } -// On error, use an empty table - catch (IOException e) { - result = new Hashtable(); + finally { + if (lnr != null) + lnr.close(); + if (freader != null) + freader.close(); } return result; }