You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by jo...@apache.org on 2005/09/23 20:40:39 UTC

svn commit: r291187 - /lucene/nutch/trunk/src/java/org/apache/nutch/tools/ParseSegment.java

Author: johnx
Date: Fri Sep 23 11:40:36 2005
New Revision: 291187

URL: http://svn.apache.org/viewcvs?rev=291187&view=rev
Log:
Reorder to make sure logic correct in case fetcherNPReader.next()
or contentReader.next() throws exception other than EOFException.

Modified:
    lucene/nutch/trunk/src/java/org/apache/nutch/tools/ParseSegment.java

Modified: lucene/nutch/trunk/src/java/org/apache/nutch/tools/ParseSegment.java
URL: http://svn.apache.org/viewcvs/lucene/nutch/trunk/src/java/org/apache/nutch/tools/ParseSegment.java?rev=291187&r1=291186&r2=291187&view=diff
==============================================================================
--- lucene/nutch/trunk/src/java/org/apache/nutch/tools/ParseSegment.java (original)
+++ lucene/nutch/trunk/src/java/org/apache/nutch/tools/ParseSegment.java Fri Sep 23 11:40:36 2005
@@ -144,6 +144,15 @@
           synchronized (ParseSegment.this) {
             t1 = System.currentTimeMillis();
 
+            // 20050919, xing,
+            // entry++ should go before fetcherNPReader.next()
+            // and contentReader.next(), in order to have the logic correct
+            // if contentReader throws exception other than EOFException.
+            entry++;
+            myEntry = entry;
+            if (LOG.isLoggable(Level.FINE))
+              LOG.fine("Read in entry "+entry);
+
             try {
               if (fetcherNPReader.next(fetcherOutput) == null ||
                 contentReader.next(content) == null)
@@ -153,11 +162,6 @@
               // other threads will be stopped also.
               return;
             }
-
-            entry++;
-            myEntry = entry;
-            if (LOG.isLoggable(Level.FINE))
-              LOG.fine("Read in entry "+entry);
 
             // safe guard against mismatched files
             //if (entry != fetcherNPReader.key() ||