You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by dn...@apache.org on 2005/07/15 22:45:17 UTC

svn commit: r219245 - /lucene/java/trunk/src/demo/org/apache/lucene/demo/HTMLDocument.java

Author: dnaber
Date: Fri Jul 15 13:45:14 2005
New Revision: 219245

URL: http://svn.apache.org/viewcvs?rev=219245&view=rev
Log:
don't close the input stream as HTMLParser spawns a thread internally
and closing the stream leads to errors (this reverts one of my previous
changes)

Modified:
    lucene/java/trunk/src/demo/org/apache/lucene/demo/HTMLDocument.java

Modified: lucene/java/trunk/src/demo/org/apache/lucene/demo/HTMLDocument.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/demo/org/apache/lucene/demo/HTMLDocument.java?rev=219245&r1=219244&r2=219245&view=diff
==============================================================================
--- lucene/java/trunk/src/demo/org/apache/lucene/demo/HTMLDocument.java (original)
+++ lucene/java/trunk/src/demo/org/apache/lucene/demo/HTMLDocument.java Fri Jul 15 13:45:14 2005
@@ -62,25 +62,19 @@
     // tokenized prior to indexing.
     doc.add(new Field("uid", uid(f), Field.Store.NO, Field.Index.UN_TOKENIZED));
 
-    FileInputStream fis = null;
-    try {
-      fis = new FileInputStream(f);
-      HTMLParser parser = new HTMLParser(fis);
+    FileInputStream fis = new FileInputStream(f);
+    HTMLParser parser = new HTMLParser(fis);
       
-      // Add the tag-stripped contents as a Reader-valued Text field so it will
-      // get tokenized and indexed.
-      doc.add(new Field("contents", parser.getReader()));
+    // Add the tag-stripped contents as a Reader-valued Text field so it will
+    // get tokenized and indexed.
+    doc.add(new Field("contents", parser.getReader()));
 
-      // Add the summary as a field that is stored and returned with
-      // hit documents for display.
-      doc.add(new Field("summary", parser.getSummary(), Field.Store.YES, Field.Index.NO));
+    // Add the summary as a field that is stored and returned with
+    // hit documents for display.
+    doc.add(new Field("summary", parser.getSummary(), Field.Store.YES, Field.Index.NO));
 
-      // Add the title as a field that it can be searched and that is stored.
-      doc.add(new Field("title", parser.getTitle(), Field.Store.YES, Field.Index.TOKENIZED));
-    } finally {
-      if (fis != null)
-        fis.close();
-    }
+    // Add the title as a field that it can be searched and that is stored.
+    doc.add(new Field("title", parser.getTitle(), Field.Store.YES, Field.Index.TOKENIZED));
 
     // return the document
     return doc;