Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-2193 Upgrade feed parser plugin to use rome 1.5.1

Sebastian Nagelc1819539ba21
diff --git a/src/plugin/feed/ivy.xml b/src/plugin/feed/ivy.xml
index c29bd0357..02c95399f 100644
--- a/src/plugin/feed/ivy.xml
+++ b/src/plugin/feed/ivy.xml
@@ -36,8 +36,9 @@
</publications>
<dependencies>
- <dependency org="rome" name="rome" rev="0.9" conf="*->master"/>
- <dependency org="org.jdom" name="jdom" rev="1.1" conf="*->master"/>
+ <dependency org="com.rometools" name="rome" rev="1.5.1">
+ <exclude name="slf4j-api" />
+ </dependency>
</dependencies>
</ivy-module>
diff --git a/src/plugin/feed/plugin.xml b/src/plugin/feed/plugin.xml
index 3a68d8d19..41109c9d0 100644
--- a/src/plugin/feed/plugin.xml
+++ b/src/plugin/feed/plugin.xml
@@ -21,8 +21,9 @@
<library name="feed.jar">
<export name="*" />
</library>
- <library name="rome-0.9.jar" />
- <library name="jdom-1.1.jar" />
+ <library name="rome-1.5.1.jar" />
+ <library name="rome-utils-1.5.1.jar" />
+ <library name="jdom-2.0.2.jar" />
</runtime>
<requires>
diff --git a/src/plugin/feed/src/java/org/apache/nutch/parse/feed/FeedParser.java b/src/plugin/feed/src/java/org/apache/nutch/parse/feed/FeedParser.java
index 0936187a9..5ec1dcf7e 100644
--- a/src/plugin/feed/src/java/org/apache/nutch/parse/feed/FeedParser.java
+++ b/src/plugin/feed/src/java/org/apache/nutch/parse/feed/FeedParser.java
@@ -23,7 +23,6 @@ import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
@@ -54,12 +53,12 @@ import org.apache.nutch.util.NutchConfiguration;
import org.xml.sax.InputSource;
// ROME imports
-import com.sun.syndication.feed.synd.SyndCategory;
-import com.sun.syndication.feed.synd.SyndContent;
-import com.sun.syndication.feed.synd.SyndEntry;
-import com.sun.syndication.feed.synd.SyndFeed;
-import com.sun.syndication.feed.synd.SyndPerson;
-import com.sun.syndication.io.SyndFeedInput;
+import com.rometools.rome.feed.synd.SyndCategory;
+import com.rometools.rome.feed.synd.SyndContent;
+import com.rometools.rome.feed.synd.SyndEntry;
+import com.rometools.rome.feed.synd.SyndFeed;
+import com.rometools.rome.feed.synd.SyndPerson;
+import com.rometools.rome.io.SyndFeedInput;
/**
*
@@ -209,6 +208,7 @@ public class FeedParser implements Parser {
byte[] bytes = new byte[(int) file.length()];
DataInputStream in = new DataInputStream(new FileInputStream(file));
in.readFully(bytes);
+ in.close();
ParseResult parseResult = parser.getParse(new Content(url, url, bytes,
"application/rss+xml", new Metadata(), conf));
for (Entry<Text, Parse> entry : parseResult) {