Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

Reorder to make sure logic correct in case fetcherNPReader.next() or contentReader.next() throws exception other than EOFException.

John Xing2359bb8465b9
diff --git a/src/java/org/apache/nutch/tools/ParseSegment.java b/src/java/org/apache/nutch/tools/ParseSegment.java
index e5e00a47a..e60eb612d 100644
--- a/src/java/org/apache/nutch/tools/ParseSegment.java
+++ b/src/java/org/apache/nutch/tools/ParseSegment.java
@@ -144,6 +144,15 @@ public class ParseSegment {
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)
@@ -154,11 +163,6 @@ public class ParseSegment {
return;
}
- entry++;
- myEntry = entry;
- if (LOG.isLoggable(Level.FINE))
- LOG.fine("Read in entry "+entry);
-
// safe guard against mismatched files
//if (entry != fetcherNPReader.key() ||
// entry != contentReader.key()) {