lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dna...@apache.org
Subject svn commit: r219245 - /lucene/java/trunk/src/demo/org/apache/lucene/demo/HTMLDocument.java
Date Fri, 15 Jul 2005 20:45:17 GMT
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;



Mime
View raw message