Apache Nutch is an extensible and scalable web crawler
NUTCH-993 NullPointerException at FetcherOutputFormat.checkOutputSpecs
Julien Nioche32f7cafad67f
diff --git a/CHANGES.txt b/CHANGES.txtindex 67e049a58..1797f53c0 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -2,6 +2,8 @@ Nutch Change LogRelease 1.4 - Current development+* NUTCH-993 NullPointerException at FetcherOutputFormat.checkOutputSpecs (Christian Guegi via jnioche)+* NUTCH-1013 Migrate RegexURLNormalizer from Apache ORO to java.util.regex (markus)* NUTCH-1016 Strip UTF-8 non-character codepoints and add logging for SolrWriter (markus)diff --git a/src/java/org/apache/nutch/fetcher/FetcherOutputFormat.java b/src/java/org/apache/nutch/fetcher/FetcherOutputFormat.javaindex 70e411ccc..a82ea2e79 100644--- a/src/java/org/apache/nutch/fetcher/FetcherOutputFormat.java+++ b/src/java/org/apache/nutch/fetcher/FetcherOutputFormat.java@@ -30,6 +30,7 @@ import org.apache.hadoop.io.Text;import org.apache.hadoop.io.SequenceFile.CompressionType;import org.apache.hadoop.mapred.FileOutputFormat;+import org.apache.hadoop.mapred.InvalidJobConfException;import org.apache.hadoop.mapred.OutputFormat;import org.apache.hadoop.mapred.RecordWriter;import org.apache.hadoop.mapred.JobConf;@@ -46,8 +47,15 @@ public class FetcherOutputFormat implements OutputFormat<Text, NutchWritable> {public void checkOutputSpecs(FileSystem fs, 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 (fs.exists(new Path(out, CrawlDatum.FETCH_DIR_NAME)))- throw new IOException("Segment already fetched!");+ 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.javaindex 09cadb9e5..09097aef5 100644--- a/src/java/org/apache/nutch/parse/ParseOutputFormat.java+++ b/src/java/org/apache/nutch/parse/ParseOutputFormat.java@@ -75,9 +75,16 @@ public class ParseOutputFormat implements OutputFormat<Text, Parse> {}public void checkOutputSpecs(FileSystem fs, JobConf job) throws IOException {- Path out = FileOutputFormat.getOutputPath(job);- if (fs.exists(new Path(out, CrawlDatum.PARSE_DIR_NAME)))- throw new IOException("Segment already parsed!");+ 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 (fs.exists(new Path(out, CrawlDatum.PARSE_DIR_NAME)))+ throw new IOException("Segment already parsed!");}public RecordWriter<Text, Parse> getRecordWriter(FileSystem fs, JobConf job,