Apache Nutch is an extensible and scalable web crawler
NUTCH-2049 Upgrade Trunk to Hadoop > 2.4 stable
Julien Nioche845b922c4c38
diff --git a/CHANGES.txt b/CHANGES.txtindex 60eab31bb..345e131de 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -2,6 +2,8 @@ Nutch Change LogNutch Current Development 1.11-SNAPSHOT+* NUTCH-2049 Upgrade to Hadoop 2.4 (lewismc)+* NUTCH-1486 Upgrade to Solr 4.10.2 (lewismc, markus)* NUTCH-2048 parse-tika: fix dependencies in plugin.xml (Michael Joyce via snagel)diff --git a/build.xml b/build.xmlindex b244a24b4..d3fd7f3cf 100644--- a/build.xml+++ b/build.xml@@ -427,9 +427,6 @@<copy todir="${test.build.data}"><fileset dir="src/testresources" includes="**/*"/></copy>-- <copy file="${test.src.dir}/nutch-site.xml"- todir="${test.build.classes}"/><copy file="${test.src.dir}/log4j.properties"todir="${test.build.classes}"/>diff --git a/conf/nutch-default.xml b/conf/nutch-default.xmlindex 632ce5d3e..18703f2e4 100644--- a/conf/nutch-default.xml+++ b/conf/nutch-default.xml@@ -1543,6 +1543,16 @@ CAUTION: Set the parser.timeout to -1 or a bigger value than 30, when using this</description></property>+<property>+ <name>io.serializations</name>+ <value>org.apache.hadoop.io.serializer.WritableSerialization,org.apache.hadoop.io.serializer.JavaSerialization</value>+ <!-- org.apache.hadoop.io.serializer.avro.AvroSpecificSerialization,+ org.apache.hadoop.io.serializer.avro.AvroReflectSerialization,+ org.apache.hadoop.io.serializer.avro.AvroGenericSerialization, -->+ <description>A list of serialization classes that can be used for+ obtaining serializers and deserializers.</description>+</property>+<!-- linkrank scoring properties --><property>diff --git a/ivy/ivy.xml b/ivy/ivy.xmlindex 73a5ef858..bd2718dd7 100644--- a/ivy/ivy.xml+++ b/ivy/ivy.xml@@ -43,10 +43,11 @@<dependency org="commons-collections" name="commons-collections" rev="3.1" conf="*->default" /><dependency org="commons-httpclient" name="commons-httpclient" rev="3.1" conf="*->master" /><dependency org="commons-codec" name="commons-codec" rev="1.3" conf="*->default" />- <dependency org="org.apache.commons" name="commons-compress" rev="1.9" conf="*->default" />+ <dependency org="org.apache.commons" name="commons-compress" rev="1.9" conf="*->default" /><dependency org="org.apache.commons" name="commons-jexl" rev="2.1.1" />-- <dependency org="org.apache.hadoop" name="hadoop-core" rev="1.2.0" conf="*->default">++ <!-- Hadoop Dependencies -->+ <dependency org="org.apache.hadoop" name="hadoop-common" rev="2.4.0" conf="*->default"><exclude org="hsqldb" name="hsqldb" /><exclude org="net.sf.kosmosfs" name="kfs" /><exclude org="net.java.dev.jets3t" name="jets3t" />@@ -54,6 +55,10 @@<exclude org="org.mortbay.jetty" name="jsp-*" /><exclude org="ant" name="ant" /></dependency>+ <dependency org="org.apache.hadoop" name="hadoop-hdfs" rev="2.4.0" conf="*->default"/>+ <dependency org="org.apache.hadoop" name="hadoop-mapreduce-client-core" rev="2.4.0" conf="*->default"/>+ <dependency org="org.apache.hadoop" name="hadoop-mapreduce-client-jobclient" rev="2.4.0" conf="*->default"/>+ <!-- End of Hadoop Dependencies --><dependency org="org.apache.tika" name="tika-core" rev="1.8" /><dependency org="com.ibm.icu" name="icu4j" rev="55.1" />@@ -77,17 +82,25 @@<!--artifacts needed for testing --><dependency org="junit" name="junit" rev="4.11" conf="test->default" />- <dependency org="org.apache.hadoop" name="hadoop-test" rev="1.2.0" conf="test->default" />+ <!--dependency org="org.apache.hadoop" name="hadoop-test" rev="1.2.0" conf="test->default" /--><dependency org="org.mortbay.jetty" name="jetty-client" rev="6.1.22" conf="test->default" /><dependency org="org.mortbay.jetty" name="jetty" rev="6.1.22" conf="test->default" /><dependency org="org.mortbay.jetty" name="jetty-util" rev="6.1.22" conf="test->default" /><!-- end of test artifacts -->++ <dependency org="org.mortbay.jetty" name="jetty-client" rev="6.1.22" conf="test->default" />++ <dependency org="org.mortbay.jetty" name="jetty" rev="6.1.22" conf="test->default" />+ <dependency org="org.mortbay.jetty" name="jetty-util" rev="6.1.22" conf="test->default" />+<!--global exclusion --><exclude module="jmxtools" /><exclude module="jms" /><exclude module="jmxri" /><exclude org="com.thoughtworks.xstream"/>+ <exclude org="org.apache.mrunit"/>+ <exclude org="com.thoughtworks.xstream"/></dependencies>diff --git a/src/bin/crawl b/src/bin/crawlindex 57475b8d4..d008c1802 100644--- a/src/bin/crawl+++ b/src/bin/crawl@@ -140,7 +140,7 @@ commonOptions="-D mapred.reduce.tasks=$numTasks -D mapred.child.java.opts=-Xmx10# check that hadoop can be found on the pathif [ $mode = "distributed" ]; thenif [ $(which hadoop | wc -l ) -eq 0 ]; then- echo "Can't find Hadoop executable. Add HADOOP_HOME/bin to the path or run in local mode."+ echo "Can't find Hadoop executable. Add HADOOP_COMMON_HOME/bin to the path or run in local mode."exit -1;fifidiff --git a/src/bin/nutch b/src/bin/nutchindex 975a32e59..21ff0930c 100755--- a/src/bin/nutch+++ b/src/bin/nutch@@ -290,7 +290,7 @@ if $local; thenelse# check that hadoop can be found on the pathif [ $(which hadoop | wc -l ) -eq 0 ]; then- echo "Can't find Hadoop executable. Add HADOOP_HOME/bin to the path or run in local mode."+ echo "Can't find Hadoop executable. Add HADOOP_COMMON_HOME/bin to the path or run in local mode."exit -1;fifidiff --git a/src/java/org/apache/nutch/crawl/AdaptiveFetchSchedule.java b/src/java/org/apache/nutch/crawl/AdaptiveFetchSchedule.javaindex ee536a6bb..08cad3481 100755--- a/src/java/org/apache/nutch/crawl/AdaptiveFetchSchedule.java+++ b/src/java/org/apache/nutch/crawl/AdaptiveFetchSchedule.java@@ -70,9 +70,9 @@ public class AdaptiveFetchSchedule extends AbstractFetchSchedule {protected float DEC_RATE;- private int MAX_INTERVAL;+ private float MAX_INTERVAL;- private int MIN_INTERVAL;+ private float MIN_INTERVAL;private boolean SYNC_DELTA;@@ -84,9 +84,9 @@ public class AdaptiveFetchSchedule extends AbstractFetchSchedule {return;INC_RATE = conf.getFloat("db.fetch.schedule.adaptive.inc_rate", 0.2f);DEC_RATE = conf.getFloat("db.fetch.schedule.adaptive.dec_rate", 0.2f);- MIN_INTERVAL = conf.getInt("db.fetch.schedule.adaptive.min_interval", 60);- MAX_INTERVAL = conf.getInt("db.fetch.schedule.adaptive.max_interval",- SECONDS_PER_DAY * 365); // 1 year+ MIN_INTERVAL = conf.getFloat("db.fetch.schedule.adaptive.min_interval", (float) 60.0);+ MAX_INTERVAL = conf.getFloat("db.fetch.schedule.adaptive.max_interval",+ (float) SECONDS_PER_DAY * 365); // 1 yearSYNC_DELTA = conf.getBoolean("db.fetch.schedule.adaptive.sync_delta", true);SYNC_DELTA_RATE = conf.getFloat("db.fetch.schedule.adaptive.sync_delta_rate", 0.2f);diff --git a/src/java/org/apache/nutch/crawl/CrawlDbReader.java b/src/java/org/apache/nutch/crawl/CrawlDbReader.javaindex 4df066105..fd9fa9d5b 100644--- a/src/java/org/apache/nutch/crawl/CrawlDbReader.java+++ b/src/java/org/apache/nutch/crawl/CrawlDbReader.java@@ -33,14 +33,6 @@ import java.util.regex.Pattern;import java.util.TreeMap;--------// Commons Logging importsimport org.slf4j.Logger;import org.slf4j.LoggerFactory;@@ -75,9 +67,7 @@ import org.apache.hadoop.util.Tool;import org.apache.hadoop.util.ToolRunner;import org.apache.nutch.util.NutchConfiguration;import org.apache.nutch.util.NutchJob;-import org.apache.nutch.util.NutchTool;import org.apache.nutch.util.StringUtil;-import org.apache.commons.jexl2.Expression;import org.apache.commons.jexl2.JexlEngine;@@ -778,6 +768,7 @@ public class CrawlDbReader extends Configured implements Closeable, Tool {String[] st = k.split(" ");int code = Integer.parseInt(st[1]);if (st.length > 2){+ @SuppressWarnings("unchecked")Map<String, Object> individualStatusInfo = (Map<String, Object>) statusMap.get(String.valueOf(code));Map<String, String> hostValues;if(individualStatusInfo.containsKey("hostValues")){diff --git a/src/java/org/apache/nutch/crawl/DeduplicationJob.java b/src/java/org/apache/nutch/crawl/DeduplicationJob.javaindex 8106b0e21..56932a4c9 100644--- a/src/java/org/apache/nutch/crawl/DeduplicationJob.java+++ b/src/java/org/apache/nutch/crawl/DeduplicationJob.java@@ -23,7 +23,6 @@ import java.util.Iterator;import java.util.Map;import java.util.Random;-import org.apache.hadoop.conf.Configured;import org.apache.hadoop.fs.FileSystem;import org.apache.hadoop.fs.Path;import org.apache.hadoop.io.BytesWritable;diff --git a/src/java/org/apache/nutch/crawl/MimeAdaptiveFetchSchedule.java b/src/java/org/apache/nutch/crawl/MimeAdaptiveFetchSchedule.javaindex f4a1fa3fd..4fe5cef37 100644--- a/src/java/org/apache/nutch/crawl/MimeAdaptiveFetchSchedule.java+++ b/src/java/org/apache/nutch/crawl/MimeAdaptiveFetchSchedule.java@@ -18,7 +18,6 @@package org.apache.nutch.crawl;import java.io.BufferedReader;-import java.io.FileReader;import java.io.IOException;import java.io.Reader;import java.util.HashMap;@@ -26,7 +25,6 @@ import java.util.HashMap;import org.apache.commons.lang.StringUtils;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.io.Text;-import org.apache.hadoop.io.*;import org.apache.nutch.crawl.CrawlDatum;import org.apache.nutch.metadata.HttpHeaders;import org.apache.nutch.util.MimeUtil;diff --git a/src/java/org/apache/nutch/fetcher/FetcherOutputFormat.java b/src/java/org/apache/nutch/fetcher/FetcherOutputFormat.javaindex 44d36e460..89969eef0 100644--- a/src/java/org/apache/nutch/fetcher/FetcherOutputFormat.java+++ b/src/java/org/apache/nutch/fetcher/FetcherOutputFormat.java@@ -23,12 +23,12 @@ import org.apache.nutch.crawl.CrawlDatum;import org.apache.nutch.crawl.NutchWritable;import org.apache.hadoop.fs.FileSystem;import org.apache.hadoop.fs.Path;-import org.apache.hadoop.io.MapFile;+import org.apache.hadoop.io.MapFile.Writer.Option;+import org.apache.hadoop.io.SequenceFile;import org.apache.hadoop.io.Writable;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;@@ -37,7 +37,6 @@ import org.apache.hadoop.mapred.JobConf;import org.apache.hadoop.mapred.Reporter;import org.apache.hadoop.mapred.SequenceFileOutputFormat;import org.apache.hadoop.util.Progressable;-import org.apache.nutch.parse.Parse;import org.apache.nutch.parse.ParseOutputFormat;import org.apache.nutch.protocol.Content;@@ -68,8 +67,13 @@ public class FetcherOutputFormat implements OutputFormat<Text, NutchWritable> {final CompressionType compType = SequenceFileOutputFormat.getOutputCompressionType(job);- final MapFile.Writer fetchOut = new MapFile.Writer(job, fs,- fetch.toString(), Text.class, CrawlDatum.class, compType, progress);+ Option fKeyClassOpt = MapFile.Writer.keyClass(Text.class);+ org.apache.hadoop.io.SequenceFile.Writer.Option fValClassOpt = SequenceFile.Writer.valueClass(CrawlDatum.class);+ org.apache.hadoop.io.SequenceFile.Writer.Option fProgressOpt = SequenceFile.Writer.progressable(progress);+ org.apache.hadoop.io.SequenceFile.Writer.Option fCompOpt = SequenceFile.Writer.compression(compType);++ final MapFile.Writer fetchOut = new MapFile.Writer(job,+ fetch, fKeyClassOpt, fValClassOpt, fCompOpt, fProgressOpt);return new RecordWriter<Text, NutchWritable>() {private MapFile.Writer contentOut;@@ -77,8 +81,12 @@ public class FetcherOutputFormat implements OutputFormat<Text, NutchWritable> {{if (Fetcher.isStoringContent(job)) {- contentOut = new MapFile.Writer(job, fs, content.toString(),- Text.class, Content.class, compType, progress);+ Option cKeyClassOpt = MapFile.Writer.keyClass(Text.class);+ org.apache.hadoop.io.SequenceFile.Writer.Option cValClassOpt = SequenceFile.Writer.valueClass(Content.class);+ org.apache.hadoop.io.SequenceFile.Writer.Option cProgressOpt = SequenceFile.Writer.progressable(progress);+ org.apache.hadoop.io.SequenceFile.Writer.Option cCompOpt = SequenceFile.Writer.compression(compType);+ contentOut = new MapFile.Writer(job, content,+ cKeyClassOpt, cValClassOpt, cCompOpt, cProgressOpt);}if (Fetcher.isParsing(job)) {diff --git a/src/java/org/apache/nutch/indexer/IndexingFiltersChecker.java b/src/java/org/apache/nutch/indexer/IndexingFiltersChecker.javaindex 2d45843a8..197bf010d 100644--- a/src/java/org/apache/nutch/indexer/IndexingFiltersChecker.java+++ b/src/java/org/apache/nutch/indexer/IndexingFiltersChecker.java@@ -22,7 +22,6 @@ import java.util.Iterator;import java.util.List;import java.util.Map;-import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.conf.Configured;import org.apache.hadoop.io.Text;import org.apache.hadoop.mapred.JobConf;diff --git a/src/java/org/apache/nutch/parse/OutlinkExtractor.java b/src/java/org/apache/nutch/parse/OutlinkExtractor.javaindex 2181683e4..d1773f8f1 100644--- a/src/java/org/apache/nutch/parse/OutlinkExtractor.java+++ b/src/java/org/apache/nutch/parse/OutlinkExtractor.java@@ -142,113 +142,4 @@ public class OutlinkExtractor {return retval;}- /**- * Extracts outlinks from a plain text. <br />- * This Method takes the Jakarta Regexp API.- *- * @param plainText- *- * @return Array of <code>Outlink</code> s within found in plainText- * @deprecated only for tests- */- @Deprecated- private Outlink[] getOutlinksJakartaRegexpImpl(final String plainText) {-- throw new UnsupportedOperationException(- "Implementation commented out. Please uncomment to use it.");-- // final List outlinks = new ArrayList();- // String url;- // Outlink link;- //- // RE re = new RE(URL_PATTERN);- //- // int pos = 0;- //- // while (re.match(plainText, pos)) {- //- // url = re.getParen(0);- //- // if (LOG.isTraceEnabled()) {- // LOG.trace("Extracted url: " + url);- // }- //- // try {- //- // link = new Outlink(url, null);- // outlinks.add(link);- //- // } catch (MalformedURLException ex) {- // // if it is a malformed URL we just throw it away and continue with- // // extraction.- // if (LOG.isErrorEnabled()) { LOG.error("getOutlinks", ex); }- // }- //- // pos = re.getParenEnd(0);- // }- //- // final Outlink[] retval;- //- // if (pos > 0) {- // retval = (Outlink[]) outlinks.toArray(new Outlink[0]);- // } else {- // retval = new Outlink[0];- // }- //- // return retval;-- }-- /**- * Extracts outlinks from a plain text. </p> This Method takes the JDK5 Regexp- * API.- *- * @param plainText- *- * @return Array of <code>Outlink</code> s within found in plainText- * @deprecated only for tests- */- @Deprecated- private Outlink[] getOutlinksJDK5Impl(final String plainText) {-- throw new UnsupportedOperationException(- "Implementation commented out. Please uncomment to use it.");-- // final List outlinks = new ArrayList();- // String url;- // Outlink link;- //- // final Pattern urlPattern = Pattern.compile(URL_PATTERN);- // final RE re = new RE(urlPattern);- //- // int pos = 0;- //- // while (re.match(plainText, pos)) {- //- // url = re.getParen(0);- //- // try {- //- // link = new Outlink(url, null);- // outlinks.add(link);- // } catch (MalformedURLException ex) {- // // if it is a malformed URL we just throw it away and continue with- // // extraction.- // if (LOG.isErrorEnabled()) { LOG.error("getOutlinks", ex); }- // }- //- // pos = re.getParenEnd(0);- // }- //- // final Outlink[] retval;- //- // if (pos > 0) {- // retval = (Outlink[]) outlinks.toArray(new Outlink[0]);- // } else {- // retval = new Outlink[0];- // }- //- // return retval;- }-}diff --git a/src/java/org/apache/nutch/parse/ParseOutputFormat.java b/src/java/org/apache/nutch/parse/ParseOutputFormat.javaindex 3c8f4c53f..ccaf8b562 100644--- a/src/java/org/apache/nutch/parse/ParseOutputFormat.java+++ b/src/java/org/apache/nutch/parse/ParseOutputFormat.java@@ -20,13 +20,13 @@ package org.apache.nutch.parse;// Commons Logging importsimport org.slf4j.Logger;import org.slf4j.LoggerFactory;--import org.apache.hadoop.conf.*;import org.apache.hadoop.io.*;+import org.apache.hadoop.io.MapFile.Writer.Option;import org.apache.hadoop.io.SequenceFile.CompressionType;+import org.apache.hadoop.io.SequenceFile.Metadata;+import org.apache.hadoop.io.compress.DefaultCodec;import org.apache.hadoop.fs.*;import org.apache.hadoop.mapred.*;-import org.apache.hadoop.util.StringUtils;import org.apache.nutch.crawl.CrawlDatum;import org.apache.nutch.fetcher.Fetcher;import org.apache.nutch.scoring.ScoringFilterException;@@ -119,14 +119,33 @@ public class ParseOutputFormat implements OutputFormat<Text, Parse> {final String[] parseMDtoCrawlDB = job.get("db.parsemeta.to.crawldb", "").split(" *, *");- final MapFile.Writer textOut = new MapFile.Writer(job, fs, text.toString(),- Text.class, ParseText.class, CompressionType.RECORD, progress);-- final MapFile.Writer dataOut = new MapFile.Writer(job, fs, data.toString(),- Text.class, ParseData.class, compType, progress);-- final SequenceFile.Writer crawlOut = SequenceFile.createWriter(fs, job,- crawl, Text.class, CrawlDatum.class, compType, progress);+ // textOut Options+ Option tKeyClassOpt = (Option) MapFile.Writer.keyClass(Text.class);+ org.apache.hadoop.io.SequenceFile.Writer.Option tValClassOpt = SequenceFile.Writer.valueClass(ParseText.class);+ org.apache.hadoop.io.SequenceFile.Writer.Option tProgressOpt = SequenceFile.Writer.progressable(progress);+ org.apache.hadoop.io.SequenceFile.Writer.Option tCompOpt = SequenceFile.Writer.compression(CompressionType.RECORD);++ final MapFile.Writer textOut = new MapFile.Writer(job, text,+ tKeyClassOpt, tValClassOpt, tCompOpt, tProgressOpt);++ // dataOut Options+ Option dKeyClassOpt = (Option) MapFile.Writer.keyClass(Text.class);+ org.apache.hadoop.io.SequenceFile.Writer.Option dValClassOpt = SequenceFile.Writer.valueClass(ParseData.class);+ org.apache.hadoop.io.SequenceFile.Writer.Option dProgressOpt = SequenceFile.Writer.progressable(progress);+ org.apache.hadoop.io.SequenceFile.Writer.Option dCompOpt = SequenceFile.Writer.compression(compType);++ final MapFile.Writer dataOut = new MapFile.Writer(job, data,+ dKeyClassOpt, dValClassOpt, dCompOpt, dProgressOpt);++ final SequenceFile.Writer crawlOut = SequenceFile.createWriter(job, SequenceFile.Writer.file(crawl),+ SequenceFile.Writer.keyClass(Text.class),+ SequenceFile.Writer.valueClass(CrawlDatum.class),+ SequenceFile.Writer.bufferSize(fs.getConf().getInt("io.file.buffer.size",4096)),+ SequenceFile.Writer.replication(fs.getDefaultReplication(crawl)),+ SequenceFile.Writer.blockSize(1073741824),+ SequenceFile.Writer.compression(compType, new DefaultCodec()),+ SequenceFile.Writer.progressable(progress),+ SequenceFile.Writer.metadata(new Metadata()));return new RecordWriter<Text, Parse>() {diff --git a/src/java/org/apache/nutch/parse/ParseSegment.java b/src/java/org/apache/nutch/parse/ParseSegment.javaindex b1ed1092c..87713604f 100644--- a/src/java/org/apache/nutch/parse/ParseSegment.java+++ b/src/java/org/apache/nutch/parse/ParseSegment.java@@ -33,7 +33,6 @@ import org.apache.nutch.net.protocols.Response;import org.apache.nutch.protocol.*;import org.apache.nutch.scoring.ScoringFilterException;import org.apache.nutch.scoring.ScoringFilters;-import org.apache.hadoop.fs.FileSystem;import org.apache.nutch.util.*;import org.apache.hadoop.fs.Path;diff --git a/src/java/org/apache/nutch/parse/ParserChecker.java b/src/java/org/apache/nutch/parse/ParserChecker.javaindex 1b44270e4..7e5b146d2 100644--- a/src/java/org/apache/nutch/parse/ParserChecker.java+++ b/src/java/org/apache/nutch/parse/ParserChecker.java@@ -34,7 +34,6 @@ import org.apache.nutch.protocol.Content;import org.apache.nutch.protocol.Protocol;import org.apache.nutch.protocol.ProtocolFactory;import org.apache.nutch.protocol.ProtocolOutput;-import org.apache.nutch.protocol.ProtocolStatus;import org.apache.nutch.scoring.ScoringFilters;import org.apache.nutch.util.NutchConfiguration;import org.apache.nutch.util.URLUtil;diff --git a/src/java/org/apache/nutch/plugin/Extension.java b/src/java/org/apache/nutch/plugin/Extension.javaindex de96c73d6..b0ee0af25 100644--- a/src/java/org/apache/nutch/plugin/Extension.java+++ b/src/java/org/apache/nutch/plugin/Extension.java@@ -153,7 +153,7 @@ public class Extension {synchronized (getId()) {try {PluginRepository pluginRepository = PluginRepository.get(conf);- Class extensionClazz = pluginRepository.getCachedClass(fDescriptor,+ Class<?> extensionClazz = pluginRepository.getCachedClass(fDescriptor,getClazz());// lazy loading of Plugin in case there is no instance of the plugin// already.diff --git a/src/java/org/apache/nutch/plugin/PluginManifestParser.java b/src/java/org/apache/nutch/plugin/PluginManifestParser.javaindex 3d9fbd061..bd2a4900d 100644--- a/src/java/org/apache/nutch/plugin/PluginManifestParser.java+++ b/src/java/org/apache/nutch/plugin/PluginManifestParser.java@@ -21,7 +21,6 @@ import java.io.IOException;import java.io.UnsupportedEncodingException;import java.net.MalformedURLException;import java.net.URL;-import java.net.URI;import java.net.URLDecoder;import java.util.HashMap;import java.util.Map;diff --git a/src/java/org/apache/nutch/segment/ContentAsTextInputFormat.java b/src/java/org/apache/nutch/segment/ContentAsTextInputFormat.javaindex 6a682ce53..d67b59086 100644--- a/src/java/org/apache/nutch/segment/ContentAsTextInputFormat.java+++ b/src/java/org/apache/nutch/segment/ContentAsTextInputFormat.java@@ -65,7 +65,6 @@ public class ContentAsTextInputFormat extends// convert the content object to textText tKey = key;- Text tValue = value;if (!sequenceFileRecordReader.next(innerKey, innerValue)) {return false;}diff --git a/src/java/org/apache/nutch/segment/SegmentMerger.java b/src/java/org/apache/nutch/segment/SegmentMerger.javaindex c45450fc8..cd843b4e3 100644--- a/src/java/org/apache/nutch/segment/SegmentMerger.java+++ b/src/java/org/apache/nutch/segment/SegmentMerger.java@@ -34,7 +34,10 @@ import org.apache.hadoop.io.MapFile;import org.apache.hadoop.io.SequenceFile;import org.apache.hadoop.io.Text;import org.apache.hadoop.io.Writable;+import org.apache.hadoop.io.MapFile.Writer.Option;import org.apache.hadoop.io.SequenceFile.CompressionType;+import org.apache.hadoop.io.SequenceFile.Metadata;+import org.apache.hadoop.io.compress.DefaultCodec;import org.apache.hadoop.mapred.FileInputFormat;import org.apache.hadoop.mapred.FileOutputFormat;import org.apache.hadoop.mapred.FileSplit;@@ -160,8 +163,7 @@ public class SegmentMerger extends Configured implements Tool,throw new RuntimeException("Cannot identify segment:", e);}- SequenceFile.Reader reader = new SequenceFile.Reader(FileSystem.get(job),- fSplit.getPath(), job);+ SequenceFile.Reader reader = new SequenceFile.Reader(job, SequenceFile.Reader.file(fSplit.getPath()));final Writable w;try {@@ -284,9 +286,26 @@ public class SegmentMerger extends Configured implements Tool,wname = new Path(new Path(new Path(out, segmentName + "-" + slice),dirName), name);}- res = SequenceFile.createWriter(fs, job, wname, Text.class,- CrawlDatum.class,- SequenceFileOutputFormat.getOutputCompressionType(job), progress);++// Option rKeyClassOpt = MapFile.Writer.keyClass(Text.class);+// org.apache.hadoop.io.SequenceFile.Writer.Option rValClassOpt = SequenceFile.Writer.valueClass(CrawlDatum.class);+// Option rProgressOpt = (Option) SequenceFile.Writer.progressable(progress);+// Option rCompOpt = (Option) SequenceFile.Writer.compression(SequenceFileOutputFormat.getOutputCompressionType(job));+// Option rFileOpt = (Option) SequenceFile.Writer.file(wname);++ //res = SequenceFile.createWriter(job, rFileOpt, rKeyClassOpt,+ // rValClassOpt, rCompOpt, rProgressOpt);++ res = SequenceFile.createWriter(job, SequenceFile.Writer.file(wname),+ SequenceFile.Writer.keyClass(Text.class),+ SequenceFile.Writer.valueClass(CrawlDatum.class),+ SequenceFile.Writer.bufferSize(fs.getConf().getInt("io.file.buffer.size",4096)),+ SequenceFile.Writer.replication(fs.getDefaultReplication(wname)),+ SequenceFile.Writer.blockSize(1073741824),+ SequenceFile.Writer.compression(SequenceFileOutputFormat.getOutputCompressionType(job), new DefaultCodec()),+ SequenceFile.Writer.progressable(progress),+ SequenceFile.Writer.metadata(new Metadata()));+sliceWriters.put(slice + dirName, res);return res;}@@ -314,8 +333,14 @@ public class SegmentMerger extends Configured implements Tool,if (clazz.isAssignableFrom(ParseText.class)) {compType = CompressionType.RECORD;}- res = new MapFile.Writer(job, fs, wname.toString(), Text.class,- clazz, compType, progress);++ Option rKeyClassOpt = (Option) MapFile.Writer.keyClass(Text.class);+ org.apache.hadoop.io.SequenceFile.Writer.Option rValClassOpt = SequenceFile.Writer.valueClass(clazz);+ org.apache.hadoop.io.SequenceFile.Writer.Option rProgressOpt = SequenceFile.Writer.progressable(progress);+ org.apache.hadoop.io.SequenceFile.Writer.Option rCompOpt = SequenceFile.Writer.compression(compType);++ res = new MapFile.Writer(job, wname, rKeyClassOpt,+ rValClassOpt, rCompOpt, rProgressOpt);sliceWriters.put(slice + dirName, res);return res;}diff --git a/src/java/org/apache/nutch/segment/SegmentReader.java b/src/java/org/apache/nutch/segment/SegmentReader.javaindex acae904d9..d00d1e2af 100644--- a/src/java/org/apache/nutch/segment/SegmentReader.java+++ b/src/java/org/apache/nutch/segment/SegmentReader.java@@ -523,7 +523,7 @@ public class SegmentReader extends Configured implementsif (fe) {Path fetchDir = new Path(segment, CrawlDatum.FETCH_DIR_NAME);- if (fs.exists(fetchDir) && fs.getFileStatus(fetchDir).isDir()) {+ if (fs.exists(fetchDir) && fs.getFileStatus(fetchDir).isDirectory()) {cnt = 0L;long start = Long.MAX_VALUE;long end = Long.MIN_VALUE;@@ -548,7 +548,7 @@ public class SegmentReader extends Configured implementsif (pd) {Path parseDir = new Path(segment, ParseData.DIR_NAME);- if (fs.exists(parseDir) && fs.getFileStatus(parseDir).isDir()) {+ if (fs.exists(parseDir) && fs.getFileStatus(parseDir).isDirectory()) {cnt = 0L;long errors = 0L;ParseData value = new ParseData();diff --git a/src/java/org/apache/nutch/service/JobManager.java b/src/java/org/apache/nutch/service/JobManager.javaindex ca5903083..20346fc34 100644--- a/src/java/org/apache/nutch/service/JobManager.java+++ b/src/java/org/apache/nutch/service/JobManager.java@@ -18,8 +18,6 @@package org.apache.nutch.service;import java.util.Collection;-import java.util.Map;-import org.apache.nutch.service.model.request.JobConfig;import org.apache.nutch.service.model.response.JobInfo;import org.apache.nutch.service.model.response.JobInfo.State;diff --git a/src/java/org/apache/nutch/tools/CommonCrawlDataDumper.java b/src/java/org/apache/nutch/tools/CommonCrawlDataDumper.javaindex 57bf3cc6a..3374dacfd 100644--- a/src/java/org/apache/nutch/tools/CommonCrawlDataDumper.java+++ b/src/java/org/apache/nutch/tools/CommonCrawlDataDumper.java@@ -380,7 +380,7 @@ public class CommonCrawlDataDumper {LOG.warn("Skipping segment: [" + segmentContentPath + "]: no data directory present");continue;}- SequenceFile.Reader reader = new SequenceFile.Reader(fs, file, nutchConfig);+ SequenceFile.Reader reader = new SequenceFile.Reader(nutchConfig, SequenceFile.Reader.file(file));if (!new File(file.toString()).exists()) {LOG.warn("Skipping segment: [" + segmentContentPath + "]: no data directory present");diff --git a/src/java/org/apache/nutch/tools/FileDumper.java b/src/java/org/apache/nutch/tools/FileDumper.javaindex ad6dafd02..4c36eb462 100644--- a/src/java/org/apache/nutch/tools/FileDumper.java+++ b/src/java/org/apache/nutch/tools/FileDumper.java@@ -167,7 +167,7 @@ public class FileDumper {+ "]: no data directory present");continue;}- SequenceFile.Reader reader = new SequenceFile.Reader(fs, file, conf);+ SequenceFile.Reader reader = new SequenceFile.Reader(conf, SequenceFile.Reader.file(file));Writable key = (Writable) reader.getKeyClass().newInstance();Content content = null;@@ -209,7 +209,7 @@ public class FileDumper {}if (filter) {- if (!mimeTypeStats) {+ if (!mimeTypeStats) {String md5Ofurl = DumpFileUtil.getUrlMD5(url);String fullDir = DumpFileUtil.createTwoLevelsDirectory(outputDir.getAbsolutePath(), md5Ofurl);diff --git a/src/java/org/apache/nutch/util/HadoopFSUtil.java b/src/java/org/apache/nutch/util/HadoopFSUtil.javaindex 92af7f7a0..6f471c1e5 100644--- a/src/java/org/apache/nutch/util/HadoopFSUtil.java+++ b/src/java/org/apache/nutch/util/HadoopFSUtil.java@@ -43,7 +43,7 @@ public class HadoopFSUtil {return new PathFilter() {public boolean accept(final Path path) {try {- return fs.getFileStatus(path).isDir();+ return fs.getFileStatus(path).isDirectory();} catch (IOException ioe) {return false;}diff --git a/src/java/org/apache/nutch/util/LockUtil.java b/src/java/org/apache/nutch/util/LockUtil.javaindex 053f694ce..7e3bb972b 100644--- a/src/java/org/apache/nutch/util/LockUtil.java+++ b/src/java/org/apache/nutch/util/LockUtil.java@@ -48,7 +48,7 @@ public class LockUtil {if (fs.exists(lockFile)) {if (!accept)throw new IOException("lock file " + lockFile + " already exists.");- if (fs.getFileStatus(lockFile).isDir())+ if (fs.getFileStatus(lockFile).isDirectory())throw new IOException("lock file " + lockFile+ " already exists and is a directory.");// do nothing - the file already exists.@@ -76,7 +76,7 @@ public class LockUtil {throws IOException {if (!fs.exists(lockFile))return false;- if (fs.getFileStatus(lockFile).isDir())+ if (fs.getFileStatus(lockFile).isDirectory())throw new IOException("lock file " + lockFile+ " exists but is a directory!");return fs.delete(lockFile, false);diff --git a/src/java/org/apache/nutch/util/domain/DomainStatistics.java b/src/java/org/apache/nutch/util/domain/DomainStatistics.javaindex b9bd21ff4..9ee60fb6f 100644--- a/src/java/org/apache/nutch/util/domain/DomainStatistics.java+++ b/src/java/org/apache/nutch/util/domain/DomainStatistics.java@@ -20,8 +20,6 @@ package org.apache.nutch.util.domain;import java.io.IOException;import java.net.URL;import java.text.SimpleDateFormat;-import java.util.Iterator;-import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.apache.hadoop.conf.Configuration;@@ -103,7 +101,7 @@ public class DomainStatistics extends Configured implements Tool {conf.setInt("domain.statistics.mode", mode);conf.setBoolean("mapreduce.fileoutputcommitter.marksuccessfuljobs", false);- Job job = new Job(conf, jobName);+ Job job = Job.getInstance(conf, jobName);job.setJarByClass(DomainStatistics.class);String[] inputDirsSpecs = inputDir.split(",");diff --git a/src/plugin/parsefilter-naivebayes/src/java/org/apache/nutch/parsefilter/naivebayes/NaiveBayesClassifier.java b/src/plugin/parsefilter-naivebayes/src/java/org/apache/nutch/parsefilter/naivebayes/NaiveBayesClassifier.javaindex 9740fae60..f218c82f6 100644--- a/src/plugin/parsefilter-naivebayes/src/java/org/apache/nutch/parsefilter/naivebayes/NaiveBayesClassifier.java+++ b/src/plugin/parsefilter-naivebayes/src/java/org/apache/nutch/parsefilter/naivebayes/NaiveBayesClassifier.java@@ -29,8 +29,10 @@ import org.apache.hadoop.fs.Path;import org.apache.hadoop.io.IntWritable;import org.apache.hadoop.io.LongWritable;import org.apache.hadoop.io.SequenceFile;+import org.apache.hadoop.io.SequenceFile.Metadata;import org.apache.hadoop.io.SequenceFile.Writer;import org.apache.hadoop.io.Text;+import org.apache.hadoop.io.compress.DefaultCodec;import org.apache.lucene.analysis.Analyzer;import org.apache.lucene.analysis.TokenStream;import org.apache.lucene.analysis.standard.StandardAnalyzer;@@ -46,6 +48,7 @@ import org.apache.mahout.math.Vector;import org.apache.mahout.math.Vector.Element;import org.apache.mahout.vectorizer.SparseVectorsFromSequenceFiles;import org.apache.mahout.vectorizer.TFIDF;+import com.google.common.collect.ConcurrentHashMultiset;import com.google.common.collect.Multiset;@@ -190,8 +193,16 @@ public class NaiveBayesClassifier {throws IOException {Configuration configuration = new Configuration();FileSystem fs = FileSystem.get(configuration);- Writer writer = new SequenceFile.Writer(fs, configuration, new Path(- outputDirName + "/chunk-0"), Text.class, Text.class);+ SequenceFile.Writer writer = SequenceFile.createWriter(configuration,+ Writer.file(new Path(outputDirName + "/chunk-0")),+ Writer.keyClass(Text.class),+ Writer.valueClass(Text.class),+ Writer.bufferSize(fs.getConf().getInt("io.file.buffer.size",4096)),+ Writer.replication(fs.getDefaultReplication(new Path(outputDirName + "/chunk-0"))),+ Writer.blockSize(1073741824),+ Writer.compression(SequenceFile.CompressionType.BLOCK, new DefaultCodec()),+ Writer.progressable(null),+ Writer.metadata(new Metadata()));BufferedReader reader = null;reader = new BufferedReader(configuration.getConfResourceAsReader(inputFileName));diff --git a/src/plugin/parsefilter-naivebayes/src/java/org/apache/nutch/parsefilter/naivebayes/NaiveBayesParseFilter.java b/src/plugin/parsefilter-naivebayes/src/java/org/apache/nutch/parsefilter/naivebayes/NaiveBayesParseFilter.javaindex 056c6fbdc..947f1a540 100644--- a/src/plugin/parsefilter-naivebayes/src/java/org/apache/nutch/parsefilter/naivebayes/NaiveBayesParseFilter.java+++ b/src/plugin/parsefilter-naivebayes/src/java/org/apache/nutch/parsefilter/naivebayes/NaiveBayesParseFilter.java@@ -27,10 +27,7 @@ import org.apache.nutch.parse.HTMLMetaTags;import org.apache.nutch.parse.HtmlParseFilter;import org.apache.nutch.parse.Outlink;import org.apache.nutch.parse.Parse;-import org.apache.nutch.parse.ParseData;import org.apache.nutch.parse.ParseResult;-import org.apache.nutch.parse.ParseStatus;-import org.apache.nutch.parse.ParseText;import org.apache.nutch.protocol.Content;import java.io.Reader;diff --git a/src/test/crawl-tests.xml b/src/test/crawl-tests.xmlindex deb4c3af0..01fc68301 100644--- a/src/test/crawl-tests.xml+++ b/src/test/crawl-tests.xml@@ -48,5 +48,15 @@</description></property>+<property>+ <name>io.serializations</name>+ <value>org.apache.hadoop.io.serializer.WritableSerialization,org.apache.hadoop.io.serializer.JavaSerialization</value>+ <!-- org.apache.hadoop.io.serializer.avro.AvroSpecificSerialization,+ org.apache.hadoop.io.serializer.avro.AvroReflectSerialization,+ org.apache.hadoop.io.serializer.avro.AvroGenericSerialization, -->+ <description>A list of serialization classes that can be used for+ obtaining serializers and deserializers.</description>+</property>+</configuration>diff --git a/src/test/org/apache/nutch/crawl/CrawlDBTestUtil.java b/src/test/org/apache/nutch/crawl/CrawlDBTestUtil.javaindex 4aa7c7831..86ba76c57 100644--- a/src/test/org/apache/nutch/crawl/CrawlDBTestUtil.java+++ b/src/test/org/apache/nutch/crawl/CrawlDBTestUtil.java@@ -29,8 +29,9 @@ import org.apache.hadoop.fs.FSDataOutputStream;import org.apache.hadoop.fs.FileSystem;import org.apache.hadoop.fs.Path;import org.apache.hadoop.io.MapFile;+import org.apache.hadoop.io.SequenceFile;+import org.apache.hadoop.io.MapFile.Writer.Option;import org.apache.hadoop.io.Text;-import org.mortbay.jetty.Server;import org.mortbay.jetty.bio.SocketConnector;import org.mortbay.jetty.handler.ContextHandler;@@ -56,8 +57,10 @@ public class CrawlDBTestUtil {Path crawldb, List<URLCrawlDatum> init) throws Exception {LOG.trace("* creating crawldb: " + crawldb);Path dir = new Path(crawldb, CrawlDb.CURRENT_NAME);- MapFile.Writer writer = new MapFile.Writer(conf, fs, new Path(dir,- "part-00000").toString(), Text.class, CrawlDatum.class);+ Option wKeyOpt = MapFile.Writer.keyClass(Text.class);+ org.apache.hadoop.io.SequenceFile.Writer.Option wValueOpt = SequenceFile.Writer.valueClass(CrawlDatum.class);+ MapFile.Writer writer = new MapFile.Writer(conf, new Path(dir,+ "part-00000"), wKeyOpt, wValueOpt);Iterator<URLCrawlDatum> it = init.iterator();while (it.hasNext()) {URLCrawlDatum row = it.next();diff --git a/src/test/org/apache/nutch/crawl/TestCrawlDbFilter.java b/src/test/org/apache/nutch/crawl/TestCrawlDbFilter.javaindex 6b762fe18..38c38ed4d 100644--- a/src/test/org/apache/nutch/crawl/TestCrawlDbFilter.java+++ b/src/test/org/apache/nutch/crawl/TestCrawlDbFilter.java@@ -24,6 +24,7 @@ import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.fs.FileSystem;import org.apache.hadoop.fs.Path;import org.apache.hadoop.io.SequenceFile;+import org.apache.hadoop.io.SequenceFile.Reader.Option;import org.apache.hadoop.io.Text;import org.apache.hadoop.mapred.*;import org.apache.nutch.crawl.CrawlDBTestUtil.URLCrawlDatum;@@ -124,7 +125,8 @@ public class TestCrawlDbFilter {private ArrayList<URLCrawlDatum> readContents(Path fetchlist)throws IOException {// verify results- SequenceFile.Reader reader = new SequenceFile.Reader(fs, fetchlist, conf);+ Option fFile = SequenceFile.Reader.file(fetchlist);+ SequenceFile.Reader reader = new SequenceFile.Reader(conf, fFile);ArrayList<URLCrawlDatum> l = new ArrayList<URLCrawlDatum>();diff --git a/src/test/org/apache/nutch/crawl/TestCrawlDbMerger.java b/src/test/org/apache/nutch/crawl/TestCrawlDbMerger.javaindex b0cb4cc65..c80061065 100644--- a/src/test/org/apache/nutch/crawl/TestCrawlDbMerger.java+++ b/src/test/org/apache/nutch/crawl/TestCrawlDbMerger.java@@ -26,7 +26,9 @@ import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.fs.FileSystem;import org.apache.hadoop.fs.Path;import org.apache.hadoop.io.MapFile;+import org.apache.hadoop.io.SequenceFile;import org.apache.hadoop.io.Text;+import org.apache.hadoop.io.MapFile.Writer.Option;import org.apache.hadoop.mapred.JobConf;import org.apache.nutch.util.NutchConfiguration;import org.junit.After;@@ -96,6 +98,17 @@ public class TestCrawlDbMerger {}}+ /**+ * Test creates two sample {@link org.apache.nutch.crawl.CrawlDb}'s+ * populating entries for keys as {@link org.apache.hadoop.io.Text} e.g. URLs+ * and values as {@link org.apache.nutch.crawl.CrawlDatum} e.g. record data.+ * It then simulates a merge process for the two CrawlDb's via the {@link org.apache.nutch.crawl.CrawlDbMerger}+ * tool. The merged CrawlDb is then written to an arbitrary output location and the results+ * read using the {@link org.apache.nutch.crawl.CrawlDbReader} tool.+ * Test assertions include comparing expected CrawlDb key, value (URL, CrawlDatum) values+ * with actual results based on the merge process.+ * @throws Exception+ */@Testpublic void testMerge() throws Exception {Path crawldb1 = new Path(testDir, "crawldb1");@@ -131,8 +144,12 @@ public class TestCrawlDbMerger {TreeSet<String> init, CrawlDatum cd) throws Exception {LOG.fine("* creating crawldb: " + crawldb);Path dir = new Path(crawldb, CrawlDb.CURRENT_NAME);- MapFile.Writer writer = new MapFile.Writer(config, fs, new Path(dir,- "part-00000").toString(), Text.class, CrawlDatum.class);++ Option wKeyOpt = MapFile.Writer.keyClass(Text.class);+ org.apache.hadoop.io.SequenceFile.Writer.Option wValueOpt = SequenceFile.Writer.valueClass(CrawlDatum.class);++ MapFile.Writer writer = new MapFile.Writer(config, new Path(dir,+ "part-00000"), wKeyOpt, wValueOpt);Iterator<String> it = init.iterator();while (it.hasNext()) {String key = it.next();diff --git a/src/test/org/apache/nutch/crawl/TestGenerator.java b/src/test/org/apache/nutch/crawl/TestGenerator.javaindex d2f68ca9e..84e6b2882 100644--- a/src/test/org/apache/nutch/crawl/TestGenerator.java+++ b/src/test/org/apache/nutch/crawl/TestGenerator.java@@ -26,6 +26,7 @@ import org.apache.hadoop.fs.FileSystem;import org.apache.hadoop.fs.Path;import org.apache.hadoop.io.SequenceFile;import org.apache.hadoop.io.Text;+import org.apache.hadoop.io.SequenceFile.Reader.Option;import org.apache.nutch.crawl.CrawlDBTestUtil.URLCrawlDatum;import org.junit.After;import org.junit.Assert;@@ -292,7 +293,8 @@ public class TestGenerator {private ArrayList<URLCrawlDatum> readContents(Path fetchlist)throws IOException {// verify results- SequenceFile.Reader reader = new SequenceFile.Reader(fs, fetchlist, conf);+ Option rFile = SequenceFile.Reader.file(fetchlist);+ SequenceFile.Reader reader = new SequenceFile.Reader(conf, rFile);ArrayList<URLCrawlDatum> l = new ArrayList<URLCrawlDatum>();diff --git a/src/test/org/apache/nutch/crawl/TestInjector.java b/src/test/org/apache/nutch/crawl/TestInjector.javaindex 20e0ffab1..ade6494e4 100644--- a/src/test/org/apache/nutch/crawl/TestInjector.java+++ b/src/test/org/apache/nutch/crawl/TestInjector.java@@ -28,6 +28,7 @@ import org.apache.hadoop.fs.FileSystem;import org.apache.hadoop.fs.Path;import org.apache.hadoop.io.SequenceFile;import org.apache.hadoop.io.Text;+import org.apache.hadoop.io.SequenceFile.Reader.Option;import org.junit.After;import org.junit.Assert;import org.junit.Before;@@ -141,8 +142,9 @@ public class TestInjector {Path dbfile = new Path(crawldbPath, CrawlDb.CURRENT_NAME+ "/part-00000/data");System.out.println("reading:" + dbfile);+ Option rFile = SequenceFile.Reader.file(dbfile);@SuppressWarnings("resource")- SequenceFile.Reader reader = new SequenceFile.Reader(fs, dbfile, conf);+ SequenceFile.Reader reader = new SequenceFile.Reader(conf, rFile);ArrayList<String> read = new ArrayList<String>();READ: do {@@ -160,8 +162,9 @@ public class TestInjector {Path dbfile = new Path(crawldbPath, CrawlDb.CURRENT_NAME+ "/part-00000/data");System.out.println("reading:" + dbfile);+ Option rFile = SequenceFile.Reader.file(dbfile);@SuppressWarnings("resource")- SequenceFile.Reader reader = new SequenceFile.Reader(fs, dbfile, conf);+ SequenceFile.Reader reader = new SequenceFile.Reader(conf, rFile);HashMap<String, CrawlDatum> read = new HashMap<String, CrawlDatum>();READ: do {diff --git a/src/test/org/apache/nutch/crawl/TestLinkDbMerger.java b/src/test/org/apache/nutch/crawl/TestLinkDbMerger.javaindex 79e96ac95..23aaa8862 100644--- a/src/test/org/apache/nutch/crawl/TestLinkDbMerger.java+++ b/src/test/org/apache/nutch/crawl/TestLinkDbMerger.java@@ -27,7 +27,9 @@ import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.fs.FileSystem;import org.apache.hadoop.fs.Path;import org.apache.hadoop.io.MapFile;+import org.apache.hadoop.io.SequenceFile;import org.apache.hadoop.io.Text;+import org.apache.hadoop.io.MapFile.Writer.Option;import org.apache.nutch.util.NutchConfiguration;import org.junit.After;import org.junit.Assert;@@ -137,8 +139,11 @@ public class TestLinkDbMerger {TreeMap<String, String[]> init) throws Exception {LOG.fine("* creating linkdb: " + linkdb);Path dir = new Path(linkdb, LinkDb.CURRENT_NAME);- MapFile.Writer writer = new MapFile.Writer(config, fs, new Path(dir,- "part-00000").toString(), Text.class, Inlinks.class);++ Option wKeyOpt = MapFile.Writer.keyClass(Text.class);+ org.apache.hadoop.io.SequenceFile.Writer.Option wValueOpt = SequenceFile.Writer.valueClass(Inlinks.class);+ MapFile.Writer writer = new MapFile.Writer(config, new Path(dir,+ "part-00000"), wKeyOpt, wValueOpt);Iterator<String> it = init.keySet().iterator();while (it.hasNext()) {String key = it.next();diff --git a/src/test/org/apache/nutch/fetcher/TestFetcher.java b/src/test/org/apache/nutch/fetcher/TestFetcher.javaindex b625d887d..1196284b0 100644--- a/src/test/org/apache/nutch/fetcher/TestFetcher.java+++ b/src/test/org/apache/nutch/fetcher/TestFetcher.java@@ -122,7 +122,7 @@ public class TestFetcher {Path content = new Path(new Path(generatedSegment[0], Content.DIR_NAME),"part-00000/data");@SuppressWarnings("resource")- SequenceFile.Reader reader = new SequenceFile.Reader(fs, content, conf);+ SequenceFile.Reader reader = new SequenceFile.Reader(conf, SequenceFile.Reader.file(content));ArrayList<String> handledurls = new ArrayList<String>();@@ -154,7 +154,7 @@ public class TestFetcher {// verify parse dataPath parseData = new Path(new Path(generatedSegment[0], ParseData.DIR_NAME), "part-00000/data");- reader = new SequenceFile.Reader(fs, parseData, conf);+ reader = new SequenceFile.Reader(conf, SequenceFile.Reader.file(parseData));READ_PARSE_DATA: do {Text key = new Text();diff --git a/src/test/org/apache/nutch/net/TestURLNormalizers.java b/src/test/org/apache/nutch/net/TestURLNormalizers.javaindex 71275b283..6fdbb9d88 100644--- a/src/test/org/apache/nutch/net/TestURLNormalizers.java+++ b/src/test/org/apache/nutch/net/TestURLNormalizers.java@@ -60,7 +60,7 @@ public class TestURLNormalizers {"http://www.example.org//path/to//somewhere.html",URLNormalizers.SCOPE_DEFAULT);Assert.assertEquals(normalizedHost,- "http://example.org/path/to/somewhere.html");+ "http://www.example.org/path/to/somewhere.html");} catch (MalformedURLException mue) {Assert.fail(mue.toString());}diff --git a/src/test/org/apache/nutch/segment/TestSegmentMerger.java b/src/test/org/apache/nutch/segment/TestSegmentMerger.javaindex 351b97cb6..6657c4260 100644--- a/src/test/org/apache/nutch/segment/TestSegmentMerger.java+++ b/src/test/org/apache/nutch/segment/TestSegmentMerger.java@@ -23,6 +23,8 @@ import org.apache.hadoop.fs.FileStatus;import org.apache.hadoop.fs.FileSystem;import org.apache.hadoop.fs.Path;import org.apache.hadoop.io.MapFile;+import org.apache.hadoop.io.MapFile.Writer.Option;+import org.apache.hadoop.io.SequenceFile;import org.apache.hadoop.io.Text;import org.apache.hadoop.mapred.MapFileOutputFormat;import org.apache.nutch.parse.ParseText;@@ -56,8 +58,9 @@ public class TestSegmentMerger {DecimalFormat df = new DecimalFormat("0000000");Text k = new Text();Path ptPath = new Path(new Path(seg1, ParseText.DIR_NAME), "part-00000");- MapFile.Writer w = new MapFile.Writer(conf, fs, ptPath.toString(),- Text.class, ParseText.class);+ Option kOpt = MapFile.Writer.keyClass(Text.class);+ org.apache.hadoop.io.SequenceFile.Writer.Option vOpt = SequenceFile.Writer.valueClass(ParseText.class);+ MapFile.Writer w = new MapFile.Writer(conf, ptPath, kOpt, vOpt);long curSize = 0;countSeg1 = 0;FileStatus fileStatus = fs.getFileStatus(ptPath);@@ -73,8 +76,9 @@ public class TestSegmentMerger {System.err.println(" - done: " + countSeg1 + " records.");System.err.println("Creating large segment 2...");ptPath = new Path(new Path(seg2, ParseText.DIR_NAME), "part-00000");- w = new MapFile.Writer(conf, fs, ptPath.toString(), Text.class,- ParseText.class);+ Option wKeyOpt = MapFile.Writer.keyClass(Text.class);+ org.apache.hadoop.io.SequenceFile.Writer.Option wValueOpt = SequenceFile.Writer.valueClass(ParseText.class);+ w = new MapFile.Writer(conf, ptPath, wKeyOpt, wValueOpt);curSize = 0;countSeg2 = 0;while (curSize < blkSize * 2) {diff --git a/src/test/org/apache/nutch/segment/TestSegmentMergerCrawlDatums.java b/src/test/org/apache/nutch/segment/TestSegmentMergerCrawlDatums.javaindex c8ab8ba31..aaed8bc74 100644--- a/src/test/org/apache/nutch/segment/TestSegmentMergerCrawlDatums.java+++ b/src/test/org/apache/nutch/segment/TestSegmentMergerCrawlDatums.java@@ -24,6 +24,8 @@ import org.apache.hadoop.fs.FileStatus;import org.apache.hadoop.fs.FileSystem;import org.apache.hadoop.fs.Path;import org.apache.hadoop.io.MapFile;+import org.apache.hadoop.io.SequenceFile;+import org.apache.hadoop.io.MapFile.Writer.Option;import org.apache.hadoop.io.Text;import org.apache.hadoop.mapred.MapFileOutputFormat;import org.apache.nutch.crawl.CrawlDatum;@@ -381,8 +383,9 @@ public class TestSegmentMergerCrawlDatums {new Path(segment, CrawlDatum.FETCH_DIR_NAME), "part-00000");// Get a writer for map files containing <Text,CrawlDatum> pairs- MapFile.Writer writer = new MapFile.Writer(conf, fs,- crawlFetchPath.toString(), Text.class, CrawlDatum.class);+ Option wKeyOpt = MapFile.Writer.keyClass(Text.class);+ org.apache.hadoop.io.SequenceFile.Writer.Option wValueOpt = SequenceFile.Writer.valueClass(CrawlDatum.class);+ MapFile.Writer writer = new MapFile.Writer(conf, crawlFetchPath, wKeyOpt, wValueOpt);// Whether we're handling a redirect now// first add the linked datumdiff --git a/src/test/org/apache/nutch/tools/proxy/SegmentHandler.java b/src/test/org/apache/nutch/tools/proxy/SegmentHandler.javaindex 55877cec3..5d198b4c0 100644--- a/src/test/org/apache/nutch/tools/proxy/SegmentHandler.java+++ b/src/test/org/apache/nutch/tools/proxy/SegmentHandler.java@@ -145,7 +145,7 @@ public class SegmentHandler extends AbstractTestbedHandler {MapFile.Reader[] parts = new MapFile.Reader[names.length];for (int i = 0; i < names.length; i++) {- parts[i] = new MapFile.Reader(fs, names[i].toString(), conf);+ parts[i] = new MapFile.Reader(names[i], conf);}return parts;}