Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

Fix for NUTCH-2494 contributed by Ashraful Islam, closes #274

Md Ashraful Islam87c7a2e57bdd
diff --git a/src/java/org/apache/nutch/fetcher/FetcherOutputFormat.java b/src/java/org/apache/nutch/fetcher/FetcherOutputFormat.java
index d526a07d3..121a825db 100644
--- a/src/java/org/apache/nutch/fetcher/FetcherOutputFormat.java
+++ b/src/java/org/apache/nutch/fetcher/FetcherOutputFormat.java
@@ -44,16 +44,19 @@ import org.apache.nutch.protocol.Content;
/** Splits FetcherOutput entries into multiple map files. */
public class FetcherOutputFormat implements OutputFormat<Text, NutchWritable> {
- public void checkOutputSpecs(FileSystem fs, JobConf job) throws IOException {
+ public void checkOutputSpecs(FileSystem ignored, JobConf job)
+ throws IOException {
Path out = FileOutputFormat.getOutputPath(job);
if ((out == null) && (job.getNumReduceTasks() != 0)) {
throw new InvalidJobConfException("Output directory not set in JobConf.");
}
- if (fs == null) {
- fs = out.getFileSystem(job);
+
+ if (out != null) {
+ FileSystem fs = out.getFileSystem(job);
+ if (fs.exists(new Path(out, CrawlDatum.FETCH_DIR_NAME))) {
+ throw new IOException("Segment already fetched!");
+ }
}
- if (fs.exists(new Path(out, CrawlDatum.FETCH_DIR_NAME)))
- throw new IOException("Segment already fetched!");
}
public RecordWriter<Text, NutchWritable> getRecordWriter(final FileSystem fs,
diff --git a/src/java/org/apache/nutch/parse/ParseOutputFormat.java b/src/java/org/apache/nutch/parse/ParseOutputFormat.java
index 2c8396a75..722ad7d7f 100644
--- a/src/java/org/apache/nutch/parse/ParseOutputFormat.java
+++ b/src/java/org/apache/nutch/parse/ParseOutputFormat.java
@@ -79,16 +79,18 @@ public class ParseOutputFormat implements OutputFormat<Text, Parse> {
}
}
- public void checkOutputSpecs(FileSystem fs, JobConf job) throws IOException {
+ public void checkOutputSpecs(FileSystem ignored, JobConf job)
+ throws IOException {
Path out = FileOutputFormat.getOutputPath(job);
if ((out == null) && (job.getNumReduceTasks() != 0)) {
throw new InvalidJobConfException("Output directory not set in JobConf.");
}
- if (fs == null) {
- fs = out.getFileSystem(job);
+
+ if (out != null) {
+ FileSystem fs = out.getFileSystem(job);
+ if (fs.exists(new Path(out, CrawlDatum.PARSE_DIR_NAME)))
+ throw new IOException("Segment already parsed!");
}
- if (fs.exists(new Path(out, CrawlDatum.PARSE_DIR_NAME)))
- throw new IOException("Segment already parsed!");
}
public RecordWriter<Text, Parse> getRecordWriter(FileSystem fs, JobConf job,