- *
+ *
* @param responseCode the HTTP response code
* @throws FetcherException if response code is in the range 400 to 599 inclusive
*/
@@ -192,11 +182,11 @@ public abstract class AbstractFeedFetcher implements FeedFetcher {
*
* Combine the entries in two feeds into a single feed.
*
- *
+ *
*
* The returned feed will have the same data as the newFeed parameter, with the entries from originalFeed appended to the end of its entries.
*
- *
+ *
* @param originalFeed
* @param newFeed
* @return
@@ -205,9 +195,7 @@ public abstract class AbstractFeedFetcher implements FeedFetcher {
SyndFeed result;
try {
result = (SyndFeed) newFeed.clone();
-
result.getEntries().addAll(result.getEntries().size(), originalFeed.getEntries());
-
return result;
} catch (final CloneNotSupportedException e) {
final IllegalArgumentException iae = new IllegalArgumentException("Cannot clone feed");
From 950dd2f5d4d26e61648352ce4995d1191ab16147 Mon Sep 17 00:00:00 2001
From: Patrick Gotthard
Date: Mon, 14 Apr 2014 19:13:40 +0200
Subject: [PATCH 08/12] Migrated logging to SLF4J
---
pom.xml | 5 ++++
.../fetcher/impl/AbstractFeedFetcher.java | 9 +++++--
.../org/rometools/test/AbstractJettyTest.java | 25 +++++++++++--------
src/test/resources/logback-test.xml | 13 ++++++++++
4 files changed, 40 insertions(+), 12 deletions(-)
create mode 100644 src/test/resources/logback-test.xml
diff --git a/pom.xml b/pom.xml
index 0c79d56..7173ac7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -71,6 +71,11 @@
jettytest
+
+ ch.qos.logback
+ logback-classic
+ test
+ junitjunit
diff --git a/src/main/java/org/rometools/fetcher/impl/AbstractFeedFetcher.java b/src/main/java/org/rometools/fetcher/impl/AbstractFeedFetcher.java
index 7478d86..499caf7 100644
--- a/src/main/java/org/rometools/fetcher/impl/AbstractFeedFetcher.java
+++ b/src/main/java/org/rometools/fetcher/impl/AbstractFeedFetcher.java
@@ -29,10 +29,15 @@ import org.rometools.fetcher.FeedFetcher;
import org.rometools.fetcher.FetcherEvent;
import org.rometools.fetcher.FetcherException;
import org.rometools.fetcher.FetcherListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.sun.syndication.feed.synd.SyndFeed;
public abstract class AbstractFeedFetcher implements FeedFetcher {
+
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractFeedFetcher.class);
+
private final Set fetcherEventListeners;
private String userAgent;
private boolean usingDeltaEncoding;
@@ -54,11 +59,11 @@ public abstract class AbstractFeedFetcher implements FeedFetcher {
System.getProperties().putAll(props);
inputStream.close();
} else {
- System.err.println("Could not find " + resourceName + " on classpath");
+ LOG.warn("Could not find {} on classpath", resourceName);
}
} catch (final IOException e) {
// do nothing - we don't want to fail just because we could not find the version
- System.err.println("Error reading " + resourceName + " from classpath: " + e.getMessage());
+ LOG.error("Error reading {} from classpath: {}", resourceName, e.getMessage());
}
setUserAgent(DEFAULT_USER_AGENT + " Ver: " + System.getProperty("rome.fetcher.version", "UNKNOWN"));
diff --git a/src/test/java/org/rometools/test/AbstractJettyTest.java b/src/test/java/org/rometools/test/AbstractJettyTest.java
index 90e8276..03bfe6e 100644
--- a/src/test/java/org/rometools/test/AbstractJettyTest.java
+++ b/src/test/java/org/rometools/test/AbstractJettyTest.java
@@ -35,6 +35,8 @@ import org.rometools.fetcher.FetcherException;
import org.rometools.fetcher.FetcherListener;
import org.rometools.fetcher.impl.FeedFetcherCache;
import org.rometools.fetcher.impl.HashMapFeedInfoCache;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.feed.synd.SyndEntry;
@@ -45,6 +47,8 @@ import com.sun.syndication.feed.synd.SyndFeed;
*/
public abstract class AbstractJettyTest extends TestCase {
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractJettyTest.class);
+
private HttpServer server;
private final int testPort = 8283;
@@ -84,6 +88,7 @@ public abstract class AbstractJettyTest extends TestCase {
* @throws InterruptedException
*/
private void setupServer() throws InterruptedException {
+
// Create the server
if (server != null) {
server.stop();
@@ -146,13 +151,13 @@ public abstract class AbstractJettyTest extends TestCase {
public void fetcherEvent(final FetcherEvent event) {
final String eventType = event.getEventType();
if (FetcherEvent.EVENT_TYPE_FEED_POLLED.equals(eventType)) {
- System.err.println("\tEVENT: Feed Polled. URL = " + event.getUrlString());
+ LOG.debug("\tEVENT: Feed Polled. URL = " + event.getUrlString());
polled = true;
} else if (FetcherEvent.EVENT_TYPE_FEED_RETRIEVED.equals(eventType)) {
- System.err.println("\tEVENT: Feed Retrieved. URL = " + event.getUrlString());
+ LOG.debug("\tEVENT: Feed Retrieved. URL = " + event.getUrlString());
retrieved = true;
} else if (FetcherEvent.EVENT_TYPE_FEED_UNCHANGED.equals(eventType)) {
- System.err.println("\tEVENT: Feed Unchanged. URL = " + event.getUrlString());
+ LOG.debug("\tEVENT: Feed Unchanged. URL = " + event.getUrlString());
unchanged = true;
}
}
@@ -215,7 +220,7 @@ public abstract class AbstractJettyTest extends TestCase {
/**
* Test getting a feed via a http 301 redirect
- *
+ *
*/
public void testRetrieveRedirectedFeed() {
final FeedFetcher feedFetcher = getFeedFetcher();
@@ -231,7 +236,7 @@ public abstract class AbstractJettyTest extends TestCase {
/**
* Test error handling
- *
+ *
*/
public void testErrorHandling() {
final FeedFetcher feedFetcher = getFeedFetcher();
@@ -260,14 +265,14 @@ public abstract class AbstractJettyTest extends TestCase {
public void testUserAgent() {
final FeedFetcher feedFetcher = getFeedFetcher();
- // System.out.println(feedFetcher.getUserAgent());
- // System.out.println(System.getProperty("rome.fetcher.version", "UNKNOWN"));
+ // LOG.debug(feedFetcher.getUserAgent());
+ // LOG.debug(System.getProperty("rome.fetcher.version", "UNKNOWN"));
assertEquals("Rome Client (http://tinyurl.com/64t5n) Ver: " + System.getProperty("rome.fetcher.version", "UNKNOWN"), feedFetcher.getUserAgent());
}
/**
* Test events fired when there is no cache in use
- *
+ *
*/
public void testFetchEvents() {
final FeedFetcher feedFetcher = getFeedFetcher();
@@ -297,7 +302,7 @@ public abstract class AbstractJettyTest extends TestCase {
/**
* Test events fired when there is a cache in use
- *
+ *
*/
public void testFetchEventsWithCache() {
final FeedFetcherCache feedInfoCache = new HashMapFeedInfoCache();
@@ -336,7 +341,7 @@ public abstract class AbstractJettyTest extends TestCase {
/**
* Test handling of GZipped feed
- *
+ *
*/
public void testGZippedFeed() {
final FeedFetcher feedFetcher = getFeedFetcher();
diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml
new file mode 100644
index 0000000..44dea42
--- /dev/null
+++ b/src/test/resources/logback-test.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n
+
+
+
+
+
+
+
+
\ No newline at end of file
From 20351c2deca48a37dc283c5a08abdc9459574912 Mon Sep 17 00:00:00 2001
From: Dave Johnson
Date: Sun, 27 Apr 2014 16:40:29 -0400
Subject: [PATCH 09/12] Renamed packages to match new Maven group id of
"org.rometools"
---
.../rometools/fetcher/FeedFetcher.java | 2 +-
.../rometools/fetcher/FetcherEvent.java | 2 +-
.../rometools/fetcher/FetcherException.java | 2 +-
.../rometools/fetcher/FetcherListener.java | 2 +-
.../fetcher/impl/AbstractFeedFetcher.java | 10 +++++-----
.../impl/AbstractFeedFetcherBeanInfo.java | 6 +++---
.../fetcher/impl/DiskFeedInfoCache.java | 2 +-
.../fetcher/impl/FeedFetcherCache.java | 4 ++--
.../fetcher/impl/HashMapFeedInfoCache.java | 4 ++--
.../fetcher/impl/HttpClientFeedFetcher.java | 8 ++++----
.../fetcher/impl/HttpURLFeedFetcher.java | 8 ++++----
.../impl/LinkedHashMapFeedInfoCache.java | 4 ++--
.../fetcher/impl/ResponseHandler.java | 2 +-
.../rometools/fetcher/impl/SyndFeedInfo.java | 2 +-
.../fetcher/samples/FeedAggregator.java | 10 +++++-----
.../rometools/fetcher/samples/FeedReader.java | 14 +++++++-------
.../rometools/test/AbstractJettyTest.java | 18 +++++++++---------
.../rometools/test/DiskFeedInfoCacheTest.java | 6 +++---
.../rometools/test/FetcherTestServlet.java | 2 +-
.../test/HashMapFeedInfoCacheTest.java | 6 +++---
.../test/HttpClientFeedFetcherTest.java | 8 ++++----
.../rometools/test/HttpURLFeedFetcherTest.java | 8 ++++----
.../rometools/test/ResponseHandlerTest.java | 4 ++--
.../rometools/test/TestBasicAuthenticator.java | 2 +-
24 files changed, 68 insertions(+), 68 deletions(-)
rename src/main/java/{org => com}/rometools/fetcher/FeedFetcher.java (99%)
rename src/main/java/{org => com}/rometools/fetcher/FetcherEvent.java (98%)
rename src/main/java/{org => com}/rometools/fetcher/FetcherException.java (97%)
rename src/main/java/{org => com}/rometools/fetcher/FetcherListener.java (89%)
rename src/main/java/{org => com}/rometools/fetcher/impl/AbstractFeedFetcher.java (97%)
rename src/main/java/{org => com}/rometools/fetcher/impl/AbstractFeedFetcherBeanInfo.java (91%)
rename src/main/java/{org => com}/rometools/fetcher/impl/DiskFeedInfoCache.java (99%)
rename src/main/java/{org => com}/rometools/fetcher/impl/FeedFetcherCache.java (93%)
rename src/main/java/{org => com}/rometools/fetcher/impl/HashMapFeedInfoCache.java (97%)
rename src/main/java/{org => com}/rometools/fetcher/impl/HttpClientFeedFetcher.java (98%)
rename src/main/java/{org => com}/rometools/fetcher/impl/HttpURLFeedFetcher.java (98%)
rename src/main/java/{org => com}/rometools/fetcher/impl/LinkedHashMapFeedInfoCache.java (95%)
rename src/main/java/{org => com}/rometools/fetcher/impl/ResponseHandler.java (98%)
rename src/main/java/{org => com}/rometools/fetcher/impl/SyndFeedInfo.java (99%)
rename src/main/java/{org => com}/rometools/fetcher/samples/FeedAggregator.java (92%)
rename src/main/java/{org => com}/rometools/fetcher/samples/FeedReader.java (91%)
rename src/test/java/{org => com}/rometools/test/AbstractJettyTest.java (97%)
rename src/test/java/{org => com}/rometools/test/DiskFeedInfoCacheTest.java (90%)
rename src/test/java/{org => com}/rometools/test/FetcherTestServlet.java (99%)
rename src/test/java/{org => com}/rometools/test/HashMapFeedInfoCacheTest.java (89%)
rename src/test/java/{org => com}/rometools/test/HttpClientFeedFetcherTest.java (91%)
rename src/test/java/{org => com}/rometools/test/HttpURLFeedFetcherTest.java (89%)
rename src/test/java/{org => com}/rometools/test/ResponseHandlerTest.java (95%)
rename src/test/java/{org => com}/rometools/test/TestBasicAuthenticator.java (97%)
diff --git a/src/main/java/org/rometools/fetcher/FeedFetcher.java b/src/main/java/com/rometools/fetcher/FeedFetcher.java
similarity index 99%
rename from src/main/java/org/rometools/fetcher/FeedFetcher.java
rename to src/main/java/com/rometools/fetcher/FeedFetcher.java
index 0ccdd06..d5569ae 100644
--- a/src/main/java/org/rometools/fetcher/FeedFetcher.java
+++ b/src/main/java/com/rometools/fetcher/FeedFetcher.java
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.rometools.fetcher;
+package com.rometools.fetcher;
import java.io.IOException;
import java.net.URL;
diff --git a/src/main/java/org/rometools/fetcher/FetcherEvent.java b/src/main/java/com/rometools/fetcher/FetcherEvent.java
similarity index 98%
rename from src/main/java/org/rometools/fetcher/FetcherEvent.java
rename to src/main/java/com/rometools/fetcher/FetcherEvent.java
index 8010113..ec1f461 100644
--- a/src/main/java/org/rometools/fetcher/FetcherEvent.java
+++ b/src/main/java/com/rometools/fetcher/FetcherEvent.java
@@ -1,4 +1,4 @@
-package org.rometools.fetcher;
+package com.rometools.fetcher;
import java.util.EventObject;
diff --git a/src/main/java/org/rometools/fetcher/FetcherException.java b/src/main/java/com/rometools/fetcher/FetcherException.java
similarity index 97%
rename from src/main/java/org/rometools/fetcher/FetcherException.java
rename to src/main/java/com/rometools/fetcher/FetcherException.java
index afaf432..eb58a6e 100644
--- a/src/main/java/org/rometools/fetcher/FetcherException.java
+++ b/src/main/java/com/rometools/fetcher/FetcherException.java
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.rometools.fetcher;
+package com.rometools.fetcher;
/**
* @author Nick Lothian
diff --git a/src/main/java/org/rometools/fetcher/FetcherListener.java b/src/main/java/com/rometools/fetcher/FetcherListener.java
similarity index 89%
rename from src/main/java/org/rometools/fetcher/FetcherListener.java
rename to src/main/java/com/rometools/fetcher/FetcherListener.java
index d5640b5..e21f79f 100644
--- a/src/main/java/org/rometools/fetcher/FetcherListener.java
+++ b/src/main/java/com/rometools/fetcher/FetcherListener.java
@@ -1,4 +1,4 @@
-package org.rometools.fetcher;
+package com.rometools.fetcher;
import java.util.EventListener;
diff --git a/src/main/java/org/rometools/fetcher/impl/AbstractFeedFetcher.java b/src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcher.java
similarity index 97%
rename from src/main/java/org/rometools/fetcher/impl/AbstractFeedFetcher.java
rename to src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcher.java
index 499caf7..a3ec297 100644
--- a/src/main/java/org/rometools/fetcher/impl/AbstractFeedFetcher.java
+++ b/src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcher.java
@@ -15,7 +15,7 @@
*
*/
-package org.rometools.fetcher.impl;
+package com.rometools.fetcher.impl;
import java.io.IOException;
import java.io.InputStream;
@@ -25,10 +25,10 @@ import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
-import org.rometools.fetcher.FeedFetcher;
-import org.rometools.fetcher.FetcherEvent;
-import org.rometools.fetcher.FetcherException;
-import org.rometools.fetcher.FetcherListener;
+import com.rometools.fetcher.FeedFetcher;
+import com.rometools.fetcher.FetcherEvent;
+import com.rometools.fetcher.FetcherException;
+import com.rometools.fetcher.FetcherListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/org/rometools/fetcher/impl/AbstractFeedFetcherBeanInfo.java b/src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcherBeanInfo.java
similarity index 91%
rename from src/main/java/org/rometools/fetcher/impl/AbstractFeedFetcherBeanInfo.java
rename to src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcherBeanInfo.java
index 9d8bf17..37b2203 100644
--- a/src/main/java/org/rometools/fetcher/impl/AbstractFeedFetcherBeanInfo.java
+++ b/src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcherBeanInfo.java
@@ -1,11 +1,11 @@
-package org.rometools.fetcher.impl;
+package com.rometools.fetcher.impl;
import java.beans.EventSetDescriptor;
import java.beans.SimpleBeanInfo;
import java.lang.reflect.Method;
-import org.rometools.fetcher.FetcherEvent;
-import org.rometools.fetcher.FetcherListener;
+import com.rometools.fetcher.FetcherEvent;
+import com.rometools.fetcher.FetcherListener;
public class AbstractFeedFetcherBeanInfo extends SimpleBeanInfo {
diff --git a/src/main/java/org/rometools/fetcher/impl/DiskFeedInfoCache.java b/src/main/java/com/rometools/fetcher/impl/DiskFeedInfoCache.java
similarity index 99%
rename from src/main/java/org/rometools/fetcher/impl/DiskFeedInfoCache.java
rename to src/main/java/com/rometools/fetcher/impl/DiskFeedInfoCache.java
index 4177490..c8fd021 100644
--- a/src/main/java/org/rometools/fetcher/impl/DiskFeedInfoCache.java
+++ b/src/main/java/com/rometools/fetcher/impl/DiskFeedInfoCache.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.rometools.fetcher.impl;
+package com.rometools.fetcher.impl;
import java.io.File;
import java.io.FileInputStream;
diff --git a/src/main/java/org/rometools/fetcher/impl/FeedFetcherCache.java b/src/main/java/com/rometools/fetcher/impl/FeedFetcherCache.java
similarity index 93%
rename from src/main/java/org/rometools/fetcher/impl/FeedFetcherCache.java
rename to src/main/java/com/rometools/fetcher/impl/FeedFetcherCache.java
index 2369cb6..786faed 100644
--- a/src/main/java/org/rometools/fetcher/impl/FeedFetcherCache.java
+++ b/src/main/java/com/rometools/fetcher/impl/FeedFetcherCache.java
@@ -14,13 +14,13 @@
* limitations under the License.
*
*/
-package org.rometools.fetcher.impl;
+package com.rometools.fetcher.impl;
import java.net.URL;
/**
*
- * An interface to allow caching of feed details. Implementing this allows the {@link org.rometools.fetcher.io.HttpURLFeedFetcher} class to enable conditional
+ * An interface to allow caching of feed details. Implementing this allows the {@link com.rometools.fetcher.io.HttpURLFeedFetcher} class to enable conditional
* gets
*
*
diff --git a/src/main/java/org/rometools/fetcher/impl/HashMapFeedInfoCache.java b/src/main/java/com/rometools/fetcher/impl/HashMapFeedInfoCache.java
similarity index 97%
rename from src/main/java/org/rometools/fetcher/impl/HashMapFeedInfoCache.java
rename to src/main/java/com/rometools/fetcher/impl/HashMapFeedInfoCache.java
index 32877f1..49a22cb 100644
--- a/src/main/java/org/rometools/fetcher/impl/HashMapFeedInfoCache.java
+++ b/src/main/java/com/rometools/fetcher/impl/HashMapFeedInfoCache.java
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.rometools.fetcher.impl;
+package com.rometools.fetcher.impl;
import java.io.Serializable;
import java.net.URL;
@@ -24,7 +24,7 @@ import java.util.Map;
/**
*
- * A very simple implementation of the {@link org.rometools.fetcher.impl.FeedFetcherCache} interface.
+ * A very simple implementation of the {@link com.rometools.fetcher.impl.FeedFetcherCache} interface.
*
- * If passed a {@link org.rometools.fetcher.impl.FeedFetcherCache} in the constructor it will use conditional gets to only retrieve modified content.
+ * If passed a {@link com.rometools.fetcher.impl.FeedFetcherCache} in the constructor it will use conditional gets to only retrieve modified content.
*
*
*
diff --git a/src/main/java/org/rometools/fetcher/impl/LinkedHashMapFeedInfoCache.java b/src/main/java/com/rometools/fetcher/impl/LinkedHashMapFeedInfoCache.java
similarity index 95%
rename from src/main/java/org/rometools/fetcher/impl/LinkedHashMapFeedInfoCache.java
rename to src/main/java/com/rometools/fetcher/impl/LinkedHashMapFeedInfoCache.java
index aeb9abf..3e2e5f1 100644
--- a/src/main/java/org/rometools/fetcher/impl/LinkedHashMapFeedInfoCache.java
+++ b/src/main/java/com/rometools/fetcher/impl/LinkedHashMapFeedInfoCache.java
@@ -1,4 +1,4 @@
-package org.rometools.fetcher.impl;
+package com.rometools.fetcher.impl;
import java.util.Collections;
import java.util.LinkedHashMap;
@@ -6,7 +6,7 @@ import java.util.Map;
/**
*
- * An implementation of the {@link org.rometools.fetcher.impl.FeedFetcherCache} interface.
+ * An implementation of the {@link com.rometools.fetcher.impl.FeedFetcherCache} interface.
*
*
*
diff --git a/src/main/java/org/rometools/fetcher/impl/ResponseHandler.java b/src/main/java/com/rometools/fetcher/impl/ResponseHandler.java
similarity index 98%
rename from src/main/java/org/rometools/fetcher/impl/ResponseHandler.java
rename to src/main/java/com/rometools/fetcher/impl/ResponseHandler.java
index 432e3bd..4ce757e 100644
--- a/src/main/java/org/rometools/fetcher/impl/ResponseHandler.java
+++ b/src/main/java/com/rometools/fetcher/impl/ResponseHandler.java
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.rometools.fetcher.impl;
+package com.rometools.fetcher.impl;
import java.net.URLConnection;
import java.util.regex.Matcher;
diff --git a/src/main/java/org/rometools/fetcher/impl/SyndFeedInfo.java b/src/main/java/com/rometools/fetcher/impl/SyndFeedInfo.java
similarity index 99%
rename from src/main/java/org/rometools/fetcher/impl/SyndFeedInfo.java
rename to src/main/java/com/rometools/fetcher/impl/SyndFeedInfo.java
index 1f9eb73..1c45c86 100644
--- a/src/main/java/org/rometools/fetcher/impl/SyndFeedInfo.java
+++ b/src/main/java/com/rometools/fetcher/impl/SyndFeedInfo.java
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.rometools.fetcher.impl;
+package com.rometools.fetcher.impl;
import java.io.Serializable;
import java.net.URL;
diff --git a/src/main/java/org/rometools/fetcher/samples/FeedAggregator.java b/src/main/java/com/rometools/fetcher/samples/FeedAggregator.java
similarity index 92%
rename from src/main/java/org/rometools/fetcher/samples/FeedAggregator.java
rename to src/main/java/com/rometools/fetcher/samples/FeedAggregator.java
index 590b157..a55f6ba 100644
--- a/src/main/java/org/rometools/fetcher/samples/FeedAggregator.java
+++ b/src/main/java/com/rometools/fetcher/samples/FeedAggregator.java
@@ -14,17 +14,17 @@
* limitations under the License.
*
*/
-package org.rometools.fetcher.samples;
+package com.rometools.fetcher.samples;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
-import org.rometools.fetcher.FeedFetcher;
-import org.rometools.fetcher.impl.FeedFetcherCache;
-import org.rometools.fetcher.impl.HashMapFeedInfoCache;
-import org.rometools.fetcher.impl.HttpURLFeedFetcher;
+import com.rometools.fetcher.FeedFetcher;
+import com.rometools.fetcher.impl.FeedFetcherCache;
+import com.rometools.fetcher.impl.HashMapFeedInfoCache;
+import com.rometools.fetcher.impl.HttpURLFeedFetcher;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
diff --git a/src/main/java/org/rometools/fetcher/samples/FeedReader.java b/src/main/java/com/rometools/fetcher/samples/FeedReader.java
similarity index 91%
rename from src/main/java/org/rometools/fetcher/samples/FeedReader.java
rename to src/main/java/com/rometools/fetcher/samples/FeedReader.java
index a8fddea..dc4832b 100644
--- a/src/main/java/org/rometools/fetcher/samples/FeedReader.java
+++ b/src/main/java/com/rometools/fetcher/samples/FeedReader.java
@@ -15,16 +15,16 @@
*
*/
-package org.rometools.fetcher.samples;
+package com.rometools.fetcher.samples;
import java.net.URL;
-import org.rometools.fetcher.FeedFetcher;
-import org.rometools.fetcher.FetcherEvent;
-import org.rometools.fetcher.FetcherListener;
-import org.rometools.fetcher.impl.FeedFetcherCache;
-import org.rometools.fetcher.impl.HashMapFeedInfoCache;
-import org.rometools.fetcher.impl.HttpURLFeedFetcher;
+import com.rometools.fetcher.FeedFetcher;
+import com.rometools.fetcher.FetcherEvent;
+import com.rometools.fetcher.FetcherListener;
+import com.rometools.fetcher.impl.FeedFetcherCache;
+import com.rometools.fetcher.impl.HashMapFeedInfoCache;
+import com.rometools.fetcher.impl.HttpURLFeedFetcher;
import com.sun.syndication.feed.synd.SyndFeed;
diff --git a/src/test/java/org/rometools/test/AbstractJettyTest.java b/src/test/java/com/rometools/test/AbstractJettyTest.java
similarity index 97%
rename from src/test/java/org/rometools/test/AbstractJettyTest.java
rename to src/test/java/com/rometools/test/AbstractJettyTest.java
index 03bfe6e..32bba49 100644
--- a/src/test/java/org/rometools/test/AbstractJettyTest.java
+++ b/src/test/java/com/rometools/test/AbstractJettyTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.rometools.test;
+package com.rometools.test;
import java.net.URL;
@@ -29,12 +29,12 @@ import org.mortbay.http.SocketListener;
import org.mortbay.http.UserRealm;
import org.mortbay.http.handler.SecurityHandler;
import org.mortbay.jetty.servlet.ServletHandler;
-import org.rometools.fetcher.FeedFetcher;
-import org.rometools.fetcher.FetcherEvent;
-import org.rometools.fetcher.FetcherException;
-import org.rometools.fetcher.FetcherListener;
-import org.rometools.fetcher.impl.FeedFetcherCache;
-import org.rometools.fetcher.impl.HashMapFeedInfoCache;
+import com.rometools.fetcher.FeedFetcher;
+import com.rometools.fetcher.FetcherEvent;
+import com.rometools.fetcher.FetcherException;
+import com.rometools.fetcher.FetcherListener;
+import com.rometools.fetcher.impl.FeedFetcherCache;
+import com.rometools.fetcher.impl.HashMapFeedInfoCache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -107,8 +107,8 @@ public abstract class AbstractJettyTest extends TestCase {
*/
private ServletHandler createServletHandler() {
final ServletHandler servlets = new ServletHandler();
- servlets.addServlet("FetcherTestServlet", FetcherTestServlet.SERVLET_MAPPING, "org.rometools.test.FetcherTestServlet");
- servlets.addServlet("FetcherTestServlet", FetcherTestServlet.SERVLET_MAPPING2, "org.rometools.test.FetcherTestServlet");
+ servlets.addServlet("FetcherTestServlet", FetcherTestServlet.SERVLET_MAPPING, "com.rometools.test.FetcherTestServlet");
+ servlets.addServlet("FetcherTestServlet", FetcherTestServlet.SERVLET_MAPPING2, "com.rometools.test.FetcherTestServlet");
return servlets;
}
diff --git a/src/test/java/org/rometools/test/DiskFeedInfoCacheTest.java b/src/test/java/com/rometools/test/DiskFeedInfoCacheTest.java
similarity index 90%
rename from src/test/java/org/rometools/test/DiskFeedInfoCacheTest.java
rename to src/test/java/com/rometools/test/DiskFeedInfoCacheTest.java
index 1952d1e..37a2a43 100644
--- a/src/test/java/org/rometools/test/DiskFeedInfoCacheTest.java
+++ b/src/test/java/com/rometools/test/DiskFeedInfoCacheTest.java
@@ -1,12 +1,12 @@
-package org.rometools.test;
+package com.rometools.test;
import java.io.File;
import java.net.URL;
import junit.framework.TestCase;
-import org.rometools.fetcher.impl.DiskFeedInfoCache;
-import org.rometools.fetcher.impl.SyndFeedInfo;
+import com.rometools.fetcher.impl.DiskFeedInfoCache;
+import com.rometools.fetcher.impl.SyndFeedInfo;
public class DiskFeedInfoCacheTest extends TestCase {
diff --git a/src/test/java/org/rometools/test/FetcherTestServlet.java b/src/test/java/com/rometools/test/FetcherTestServlet.java
similarity index 99%
rename from src/test/java/org/rometools/test/FetcherTestServlet.java
rename to src/test/java/com/rometools/test/FetcherTestServlet.java
index fa67d59..9b4e31a 100644
--- a/src/test/java/org/rometools/test/FetcherTestServlet.java
+++ b/src/test/java/com/rometools/test/FetcherTestServlet.java
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.rometools.test;
+package com.rometools.test;
import java.io.BufferedReader;
import java.io.IOException;
diff --git a/src/test/java/org/rometools/test/HashMapFeedInfoCacheTest.java b/src/test/java/com/rometools/test/HashMapFeedInfoCacheTest.java
similarity index 89%
rename from src/test/java/org/rometools/test/HashMapFeedInfoCacheTest.java
rename to src/test/java/com/rometools/test/HashMapFeedInfoCacheTest.java
index 8f3d3a8..5f7caf7 100644
--- a/src/test/java/org/rometools/test/HashMapFeedInfoCacheTest.java
+++ b/src/test/java/com/rometools/test/HashMapFeedInfoCacheTest.java
@@ -1,11 +1,11 @@
-package org.rometools.test;
+package com.rometools.test;
import java.net.URL;
import junit.framework.TestCase;
-import org.rometools.fetcher.impl.HashMapFeedInfoCache;
-import org.rometools.fetcher.impl.SyndFeedInfo;
+import com.rometools.fetcher.impl.HashMapFeedInfoCache;
+import com.rometools.fetcher.impl.SyndFeedInfo;
public class HashMapFeedInfoCacheTest extends TestCase {
diff --git a/src/test/java/org/rometools/test/HttpClientFeedFetcherTest.java b/src/test/java/com/rometools/test/HttpClientFeedFetcherTest.java
similarity index 91%
rename from src/test/java/org/rometools/test/HttpClientFeedFetcherTest.java
rename to src/test/java/com/rometools/test/HttpClientFeedFetcherTest.java
index 13938ab..ac5505a 100644
--- a/src/test/java/org/rometools/test/HttpClientFeedFetcherTest.java
+++ b/src/test/java/com/rometools/test/HttpClientFeedFetcherTest.java
@@ -14,13 +14,13 @@
* limitations under the License.
*
*/
-package org.rometools.test;
+package com.rometools.test;
import org.apache.commons.httpclient.Credentials;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
-import org.rometools.fetcher.FeedFetcher;
-import org.rometools.fetcher.impl.FeedFetcherCache;
-import org.rometools.fetcher.impl.HttpClientFeedFetcher;
+import com.rometools.fetcher.FeedFetcher;
+import com.rometools.fetcher.impl.FeedFetcherCache;
+import com.rometools.fetcher.impl.HttpClientFeedFetcher;
/**
* @author Nick Lothian
diff --git a/src/test/java/org/rometools/test/HttpURLFeedFetcherTest.java b/src/test/java/com/rometools/test/HttpURLFeedFetcherTest.java
similarity index 89%
rename from src/test/java/org/rometools/test/HttpURLFeedFetcherTest.java
rename to src/test/java/com/rometools/test/HttpURLFeedFetcherTest.java
index abc497a..69d5b61 100644
--- a/src/test/java/org/rometools/test/HttpURLFeedFetcherTest.java
+++ b/src/test/java/com/rometools/test/HttpURLFeedFetcherTest.java
@@ -14,11 +14,11 @@
* limitations under the License.
*
*/
-package org.rometools.test;
+package com.rometools.test;
-import org.rometools.fetcher.FeedFetcher;
-import org.rometools.fetcher.impl.FeedFetcherCache;
-import org.rometools.fetcher.impl.HttpURLFeedFetcher;
+import com.rometools.fetcher.FeedFetcher;
+import com.rometools.fetcher.impl.FeedFetcherCache;
+import com.rometools.fetcher.impl.HttpURLFeedFetcher;
public class HttpURLFeedFetcherTest extends AbstractJettyTest {
diff --git a/src/test/java/org/rometools/test/ResponseHandlerTest.java b/src/test/java/com/rometools/test/ResponseHandlerTest.java
similarity index 95%
rename from src/test/java/org/rometools/test/ResponseHandlerTest.java
rename to src/test/java/com/rometools/test/ResponseHandlerTest.java
index d164372..650a6e5 100644
--- a/src/test/java/org/rometools/test/ResponseHandlerTest.java
+++ b/src/test/java/com/rometools/test/ResponseHandlerTest.java
@@ -14,11 +14,11 @@
* limitations under the License.
*
*/
-package org.rometools.test;
+package com.rometools.test;
import junit.framework.TestCase;
-import org.rometools.fetcher.impl.ResponseHandler;
+import com.rometools.fetcher.impl.ResponseHandler;
public class ResponseHandlerTest extends TestCase {
diff --git a/src/test/java/org/rometools/test/TestBasicAuthenticator.java b/src/test/java/com/rometools/test/TestBasicAuthenticator.java
similarity index 97%
rename from src/test/java/org/rometools/test/TestBasicAuthenticator.java
rename to src/test/java/com/rometools/test/TestBasicAuthenticator.java
index 0016bbf..402a865 100644
--- a/src/test/java/org/rometools/test/TestBasicAuthenticator.java
+++ b/src/test/java/com/rometools/test/TestBasicAuthenticator.java
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.rometools.test;
+package com.rometools.test;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
From c5274d1ab0aac1a8b7c8ef7d54470c212c7387d3 Mon Sep 17 00:00:00 2001
From: Patrick Gotthard
Date: Mon, 28 Apr 2014 17:48:55 +0200
Subject: [PATCH 10/12] Added snapshot repository
---
pom.xml | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/pom.xml b/pom.xml
index 7173ac7..dc0db69 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,6 +36,19 @@
+
+
+ sonatype-nexus-snapshots
+ https://oss.sonatype.org/content/repositories/snapshots
+
+ false
+
+
+ true
+
+
+
+
From eb42124975bbb77e65095ec1b972f7813eee2b81 Mon Sep 17 00:00:00 2001
From: Patrick Gotthard
Date: Tue, 13 May 2014 19:26:02 +0200
Subject: [PATCH 11/12] Harmonized serialVersionIds
---
src/main/java/com/rometools/fetcher/FetcherEvent.java | 2 +-
src/main/java/com/rometools/fetcher/FetcherException.java | 2 +-
.../java/com/rometools/fetcher/impl/HashMapFeedInfoCache.java | 2 +-
.../rometools/fetcher/impl/LinkedHashMapFeedInfoCache.java | 4 ++--
src/main/java/com/rometools/fetcher/impl/SyndFeedInfo.java | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/main/java/com/rometools/fetcher/FetcherEvent.java b/src/main/java/com/rometools/fetcher/FetcherEvent.java
index ec1f461..f12b700 100644
--- a/src/main/java/com/rometools/fetcher/FetcherEvent.java
+++ b/src/main/java/com/rometools/fetcher/FetcherEvent.java
@@ -12,7 +12,7 @@ import com.sun.syndication.feed.synd.SyndFeed;
*/
public class FetcherEvent extends EventObject {
- private static final long serialVersionUID = 3985600601904140103L;
+ private static final long serialVersionUID = 1L;
public static final String EVENT_TYPE_FEED_POLLED = "FEED_POLLED";
public static final String EVENT_TYPE_FEED_RETRIEVED = "FEED_RETRIEVED";
diff --git a/src/main/java/com/rometools/fetcher/FetcherException.java b/src/main/java/com/rometools/fetcher/FetcherException.java
index eb58a6e..1d1659e 100644
--- a/src/main/java/com/rometools/fetcher/FetcherException.java
+++ b/src/main/java/com/rometools/fetcher/FetcherException.java
@@ -21,7 +21,7 @@ package com.rometools.fetcher;
*
*/
public class FetcherException extends Exception {
- private static final long serialVersionUID = -7479645796948092380L;
+ private static final long serialVersionUID = 1L;
int responseCode;
diff --git a/src/main/java/com/rometools/fetcher/impl/HashMapFeedInfoCache.java b/src/main/java/com/rometools/fetcher/impl/HashMapFeedInfoCache.java
index 49a22cb..c51d231 100644
--- a/src/main/java/com/rometools/fetcher/impl/HashMapFeedInfoCache.java
+++ b/src/main/java/com/rometools/fetcher/impl/HashMapFeedInfoCache.java
@@ -36,7 +36,7 @@ import java.util.Map;
*
*/
public class HashMapFeedInfoCache implements FeedFetcherCache, Serializable {
- private static final long serialVersionUID = -1594665619950916222L;
+ private static final long serialVersionUID = 1L;
static HashMapFeedInfoCache _instance;
diff --git a/src/main/java/com/rometools/fetcher/impl/LinkedHashMapFeedInfoCache.java b/src/main/java/com/rometools/fetcher/impl/LinkedHashMapFeedInfoCache.java
index 3e2e5f1..03f6443 100644
--- a/src/main/java/com/rometools/fetcher/impl/LinkedHashMapFeedInfoCache.java
+++ b/src/main/java/com/rometools/fetcher/impl/LinkedHashMapFeedInfoCache.java
@@ -21,7 +21,7 @@ public class LinkedHashMapFeedInfoCache extends HashMapFeedInfoCache {
private final class CacheImpl extends LinkedHashMap {
- private static final long serialVersionUID = -6977191330127794920L;
+ private static final long serialVersionUID = 1L;
public CacheImpl() {
super(16, 0.75F, true);
@@ -35,7 +35,7 @@ public class LinkedHashMapFeedInfoCache extends HashMapFeedInfoCache {
}
private static final int DEFAULT_MAX_ENTRIES = 20;
- private static final long serialVersionUID = 1694228973357997417L;
+ private static final long serialVersionUID = 1L;
private static final LinkedHashMapFeedInfoCache _instance = new LinkedHashMapFeedInfoCache();
private int maxEntries = DEFAULT_MAX_ENTRIES;
diff --git a/src/main/java/com/rometools/fetcher/impl/SyndFeedInfo.java b/src/main/java/com/rometools/fetcher/impl/SyndFeedInfo.java
index 1c45c86..f36ae91 100644
--- a/src/main/java/com/rometools/fetcher/impl/SyndFeedInfo.java
+++ b/src/main/java/com/rometools/fetcher/impl/SyndFeedInfo.java
@@ -34,7 +34,7 @@ import com.sun.syndication.feed.synd.SyndFeed;
* @author Nick Lothian
*/
public class SyndFeedInfo implements Cloneable, Serializable {
- private static final long serialVersionUID = -1874786860901426015L;
+ private static final long serialVersionUID = 1L;
private final ObjectBean _objBean;
private String id;
From d23d1c2d3c1f7d834c60a3671bf9e2a9692cb358 Mon Sep 17 00:00:00 2001
From: Patrick Gotthard
Date: Tue, 13 May 2014 19:28:22 +0200
Subject: [PATCH 12/12] Formatted and cleaned up sources
---
.../com/rometools/fetcher/FeedFetcher.java | 37 +++++++++--------
.../com/rometools/fetcher/FetcherEvent.java | 11 ++---
.../rometools/fetcher/FetcherException.java | 2 +-
.../rometools/fetcher/FetcherListener.java | 2 +-
.../fetcher/impl/AbstractFeedFetcher.java | 9 ++--
.../impl/AbstractFeedFetcherBeanInfo.java | 7 +++-
.../fetcher/impl/FeedFetcherCache.java | 14 +++----
.../fetcher/impl/HashMapFeedInfoCache.java | 28 +++++++------
.../fetcher/impl/HttpClientFeedFetcher.java | 26 +++++++-----
.../fetcher/impl/HttpURLFeedFetcher.java | 41 +++++++++++--------
.../impl/LinkedHashMapFeedInfoCache.java | 15 +++----
.../fetcher/impl/ResponseHandler.java | 12 +++---
.../rometools/fetcher/impl/SyndFeedInfo.java | 29 +++++++------
.../fetcher/samples/FeedAggregator.java | 10 ++---
.../rometools/fetcher/samples/FeedReader.java | 5 +--
.../com/rometools/test/AbstractJettyTest.java | 6 +--
.../rometools/test/FetcherTestServlet.java | 3 +-
.../test/HttpClientFeedFetcherTest.java | 1 +
18 files changed, 145 insertions(+), 113 deletions(-)
diff --git a/src/main/java/com/rometools/fetcher/FeedFetcher.java b/src/main/java/com/rometools/fetcher/FeedFetcher.java
index d5569ae..32d307a 100644
--- a/src/main/java/com/rometools/fetcher/FeedFetcher.java
+++ b/src/main/java/com/rometools/fetcher/FeedFetcher.java
@@ -25,13 +25,15 @@ import com.sun.syndication.io.FeedException;
public interface FeedFetcher {
/**
*
- * The default user agent. It is not marked final so buggy java compiler will not write this string into all classes that reference it.
+ * The default user agent. It is not marked final so buggy java compiler will not write this
+ * string into all classes that reference it.
*
- *
+ *
*
- * http://tinyurl.com/64t5n points to https://rome.dev.java.net Some servers ban user agents with "Java" in the name.
+ * http://tinyurl.com/64t5n points to https://rome.dev.java.net Some servers ban user agents
+ * with "Java" in the name.
*
- * See http://www.ietf.org/rfc/rfc3229.txt and http://bobwyman.pubsub.com/main/2004/09/using_rfc3229_w.html
+ * See http://www.ietf.org/rfc/rfc3229.txt and
+ * http://bobwyman.pubsub.com/main/2004/09/using_rfc3229_w.html
*
- *
+ *
*
* NOTE: This is experimental and feedback is welcome!
*
- *
+ *
* @return
*/
public abstract boolean isUsingDeltaEncoding();
@@ -75,11 +78,12 @@ public interface FeedFetcher {
*
* Add a FetcherListener.
*
- *
+ *
*
- * The FetcherListener will receive an FetcherEvent when a Fetcher event (feed polled, retrieved, etc) occurs
+ * The FetcherListener will receive an FetcherEvent when a Fetcher event (feed polled,
+ * retrieved, etc) occurs
*
- *
+ *
* @param listener The FetcherListener to recieve the event
*/
public abstract void addFetcherEventListener(FetcherListener listener);
@@ -88,14 +92,14 @@ public interface FeedFetcher {
*
* Remove a FetcherListener
*
- *
+ *
* @param listener The FetcherListener to remove
*/
public abstract void removeFetcherEventListener(FetcherListener listener);
/**
* Retrieve a feed over HTTP
- *
+ *
* @param feedUrl A non-null URL of a RSS/Atom feed to retrieve
* @return A {@link com.sun.syndication.feed.synd.SyndFeed} object
* @throws IllegalArgumentException if the URL is null;
@@ -108,8 +112,9 @@ public interface FeedFetcher {
public SyndFeed retrieveFeed(String userAgent, URL url) throws IllegalArgumentException, IOException, FeedException, FetcherException;
/**
- * If set to true, the WireFeed will be made accessible from the SyndFeed object returned from the Fetcher via the originalWireFeed() method. Each Entry in
- * the feed will have the corresponding wireEntry property set.
+ * If set to true, the WireFeed will be made accessible from the SyndFeed object returned from
+ * the Fetcher via the originalWireFeed() method. Each Entry in the feed will have the
+ * corresponding wireEntry property set.
*/
void setPreserveWireFeed(boolean preserveWireFeed);
}
diff --git a/src/main/java/com/rometools/fetcher/FetcherEvent.java b/src/main/java/com/rometools/fetcher/FetcherEvent.java
index f12b700..26358de 100644
--- a/src/main/java/com/rometools/fetcher/FetcherEvent.java
+++ b/src/main/java/com/rometools/fetcher/FetcherEvent.java
@@ -5,9 +5,10 @@ import java.util.EventObject;
import com.sun.syndication.feed.synd.SyndFeed;
/**
- * Implementation note: FetcherEvent is not thread safe. Make sure that they are only ever accessed by one thread. If necessary, make all getters and setters
- * synchronized, or alternatively make all fields final.
- *
+ * Implementation note: FetcherEvent is not thread safe. Make sure that they are only ever accessed
+ * by one thread. If necessary, make all getters and setters synchronized, or alternatively make all
+ * fields final.
+ *
* @author nl
*/
public class FetcherEvent extends EventObject {
@@ -39,7 +40,7 @@ public class FetcherEvent extends EventObject {
/**
* @return Returns the feed.
- *
+ *
*
* The feed will only be set if the eventType is EVENT_TYPE_FEED_RETRIEVED
*
@@ -50,7 +51,7 @@ public class FetcherEvent extends EventObject {
/**
* @param feed The feed to set.
- *
+ *
*
* The feed will only be set if the eventType is EVENT_TYPE_FEED_RETRIEVED
*
diff --git a/src/main/java/com/rometools/fetcher/FetcherException.java b/src/main/java/com/rometools/fetcher/FetcherException.java
index 1d1659e..447ab2f 100644
--- a/src/main/java/com/rometools/fetcher/FetcherException.java
+++ b/src/main/java/com/rometools/fetcher/FetcherException.java
@@ -18,7 +18,7 @@ package com.rometools.fetcher;
/**
* @author Nick Lothian
- *
+ *
*/
public class FetcherException extends Exception {
private static final long serialVersionUID = 1L;
diff --git a/src/main/java/com/rometools/fetcher/FetcherListener.java b/src/main/java/com/rometools/fetcher/FetcherListener.java
index e21f79f..617532c 100644
--- a/src/main/java/com/rometools/fetcher/FetcherListener.java
+++ b/src/main/java/com/rometools/fetcher/FetcherListener.java
@@ -8,7 +8,7 @@ public interface FetcherListener extends EventListener {
*
* Called when a fetcher event occurs
*
- *
+ *
* @param event the event that fired
*/
public void fetcherEvent(FetcherEvent event);
diff --git a/src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcher.java b/src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcher.java
index a3ec297..6d5a1b1 100644
--- a/src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcher.java
+++ b/src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcher.java
@@ -25,13 +25,13 @@ import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.rometools.fetcher.FeedFetcher;
import com.rometools.fetcher.FetcherEvent;
import com.rometools.fetcher.FetcherException;
import com.rometools.fetcher.FetcherListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import com.sun.syndication.feed.synd.SyndFeed;
public abstract class AbstractFeedFetcher implements FeedFetcher {
@@ -189,7 +189,8 @@ public abstract class AbstractFeedFetcher implements FeedFetcher {
*
*
*
- * The returned feed will have the same data as the newFeed parameter, with the entries from originalFeed appended to the end of its entries.
+ * The returned feed will have the same data as the newFeed parameter, with the entries from
+ * originalFeed appended to the end of its entries.
*
*
* @param originalFeed
diff --git a/src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcherBeanInfo.java b/src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcherBeanInfo.java
index 37b2203..a040745 100644
--- a/src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcherBeanInfo.java
+++ b/src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcherBeanInfo.java
@@ -12,7 +12,9 @@ public class AbstractFeedFetcherBeanInfo extends SimpleBeanInfo {
@Override
public EventSetDescriptor[] getEventSetDescriptors() {
try {
- final Class clz = AbstractFeedFetcher.class; // get the class object which we'll describe
+ final Class clz = AbstractFeedFetcher.class; // get the class
+ // object which we'll
+ // describe
final Method addMethod = clz.getMethod("addFetcherEventListener", new Class[] { FetcherListener.class });
final Method removeMethod = clz.getMethod("removeFetcherEventListener", new Class[] { FetcherListener.class });
final Method listenerMethod = FetcherListener.class.getMethod("fetcherEvent", new Class[] { FetcherEvent.class });
@@ -20,7 +22,8 @@ public class AbstractFeedFetcherBeanInfo extends SimpleBeanInfo {
final EventSetDescriptor[] results = new EventSetDescriptor[] { est };
return results;
} catch (final Exception e) {
- // IntrospectionException, SecurityException and/or NoSuchMethodException can be thrown here
+ // IntrospectionException, SecurityException and/or NoSuchMethodException can be thrown
+ // here
// the best we can do is to convert them to runtime exceptions
throw new RuntimeException(e);
}
diff --git a/src/main/java/com/rometools/fetcher/impl/FeedFetcherCache.java b/src/main/java/com/rometools/fetcher/impl/FeedFetcherCache.java
index 786faed..c71b519 100644
--- a/src/main/java/com/rometools/fetcher/impl/FeedFetcherCache.java
+++ b/src/main/java/com/rometools/fetcher/impl/FeedFetcherCache.java
@@ -20,17 +20,17 @@ import java.net.URL;
/**
*
- * An interface to allow caching of feed details. Implementing this allows the {@link com.rometools.fetcher.io.HttpURLFeedFetcher} class to enable conditional
- * gets
+ * An interface to allow caching of feed details. Implementing this allows the
+ * {@link com.rometools.fetcher.io.HttpURLFeedFetcher} class to enable conditional gets
*
- *
+ *
* @author Nick Lothian
- *
+ *
*/
public interface FeedFetcherCache {
/**
* Get a SyndFeedInfo object from the cache.
- *
+ *
* @param feedUrl The url of the feed
* @return A SyndFeedInfo or null if it is not in the cache
*/
@@ -38,7 +38,7 @@ public interface FeedFetcherCache {
/**
* Add a SyndFeedInfo object to the cache
- *
+ *
* @param feedUrl The url of the feed
* @param syndFeedInfo A SyndFeedInfo for the feed
*/
@@ -51,7 +51,7 @@ public interface FeedFetcherCache {
/**
* Removes the SyndFeedInfo identified by the url from the cache.
- *
+ *
* @return The removed SyndFeedInfo
*/
public SyndFeedInfo remove(URL feedUrl);
diff --git a/src/main/java/com/rometools/fetcher/impl/HashMapFeedInfoCache.java b/src/main/java/com/rometools/fetcher/impl/HashMapFeedInfoCache.java
index c51d231..989ab91 100644
--- a/src/main/java/com/rometools/fetcher/impl/HashMapFeedInfoCache.java
+++ b/src/main/java/com/rometools/fetcher/impl/HashMapFeedInfoCache.java
@@ -24,16 +24,18 @@ import java.util.Map;
/**
*
- * A very simple implementation of the {@link com.rometools.fetcher.impl.FeedFetcherCache} interface.
+ * A very simple implementation of the {@link com.rometools.fetcher.impl.FeedFetcherCache}
+ * interface.
*
- *
+ *
*
- * This implementation uses a HashMap to cache retrieved feeds. This implementation is most suitible for sort term (client aggregator?) use, as the memory usage
- * will increase over time as the number of feeds in the cache increases.
+ * This implementation uses a HashMap to cache retrieved feeds. This implementation is most suitible
+ * for sort term (client aggregator?) use, as the memory usage will increase over time as the number
+ * of feeds in the cache increases.
*
- *
+ *
* @author Nick Lothian
- *
+ *
*/
public class HashMapFeedInfoCache implements FeedFetcherCache, Serializable {
private static final long serialVersionUID = 1L;
@@ -46,11 +48,12 @@ public class HashMapFeedInfoCache implements FeedFetcherCache, Serializable {
*
* Constructor for HashMapFeedInfoCache
*
- *
+ *
*
- * Only use this if you want multiple instances of the cache. Usually getInstance() is more appropriate.
+ * Only use this if you want multiple instances of the cache. Usually getInstance() is more
+ * appropriate.
*
- *
+ *
*/
public HashMapFeedInfoCache() {
setInfoCache(createInfoCache());
@@ -58,7 +61,7 @@ public class HashMapFeedInfoCache implements FeedFetcherCache, Serializable {
/**
* Get the global instance of the cache
- *
+ *
* @return an implementation of FeedFetcherCache
*/
public static synchronized FeedFetcherCache getInstance() {
@@ -101,8 +104,9 @@ public class HashMapFeedInfoCache implements FeedFetcherCache, Serializable {
}
/**
- * The API of this class indicates that map must thread safe. In other words, be sure to wrap it in a synchronized map unless you know what you are doing.
- *
+ * The API of this class indicates that map must thread safe. In other words, be sure to wrap it
+ * in a synchronized map unless you know what you are doing.
+ *
* @param map the map to use as the info cache.
*/
protected synchronized final void setInfoCache(final Map map) {
diff --git a/src/main/java/com/rometools/fetcher/impl/HttpClientFeedFetcher.java b/src/main/java/com/rometools/fetcher/impl/HttpClientFeedFetcher.java
index 81df80d..bf808b3 100644
--- a/src/main/java/com/rometools/fetcher/impl/HttpClientFeedFetcher.java
+++ b/src/main/java/com/rometools/fetcher/impl/HttpClientFeedFetcher.java
@@ -31,9 +31,9 @@ import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.params.HttpClientParams;
+
import com.rometools.fetcher.FetcherEvent;
import com.rometools.fetcher.FetcherException;
-
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedInput;
@@ -67,8 +67,9 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher {
}
/**
- * @param timeout Sets the connect timeout for the HttpClient but using the URLConnection method name. Uses the HttpClientParams method
- * setConnectionManagerTimeout instead of setConnectTimeout
+ * @param timeout Sets the connect timeout for the HttpClient but using the URLConnection method
+ * name. Uses the HttpClientParams method setConnectionManagerTimeout instead of
+ * setConnectTimeout
*
*/
public synchronized void setConnectTimeout(final int timeout) {
@@ -76,8 +77,9 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher {
}
/**
- * @return The currently used connect timeout for the HttpClient but using the URLConnection method name. Uses the HttpClientParams method
- * getConnectionManagerTimeout instead of getConnectTimeout
+ * @return The currently used connect timeout for the HttpClient but using the URLConnection
+ * method name. Uses the HttpClientParams method getConnectionManagerTimeout instead of
+ * getConnectTimeout
*
*/
public int getConnectTimeout() {
@@ -135,14 +137,16 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher {
}
/**
- * @return The currently used read timeout for the URLConnection, 0 is unlimited, i.e. no timeout
+ * @return The currently used read timeout for the URLConnection, 0 is unlimited, i.e. no
+ * timeout
*/
public synchronized void setReadTimeout(final int timeout) {
httpClientParams.setSoTimeout(timeout);
}
/**
- * @return timeout the read timeout for the URLConnection to a specified timeout, in milliseconds.
+ * @return timeout the read timeout for the URLConnection to a specified timeout, in
+ * milliseconds.
*/
public int getReadTimeout() {
return getHttpClientParams().getSoTimeout();
@@ -284,7 +288,8 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher {
final FeedFetcherCache cache = getFeedInfoCache();
if (cache != null && statusCode == 226) {
- // client is setup to use http delta encoding and the server supports it and has returned a delta encoded response
+ // client is setup to use http delta encoding and the server supports it and has
+ // returned a delta encoded response
// This response only includes new items
final SyndFeedInfo cachedInfo = cache.getFeedInfo(feedUrl);
@@ -360,8 +365,9 @@ public class HttpClientFeedFetcher extends AbstractFeedFetcher {
public interface HttpClientMethodCallbackIntf {
/**
- * Allows access to the underlying HttpClient HttpMethod object. Note that in most cases, method.setRequestHeader(String, String) is what you want to do
- * (rather than method.addRequestHeader(String, String))
+ * Allows access to the underlying HttpClient HttpMethod object. Note that in most cases,
+ * method.setRequestHeader(String, String) is what you want to do (rather than
+ * method.addRequestHeader(String, String))
*
* @param method
*/
diff --git a/src/main/java/com/rometools/fetcher/impl/HttpURLFeedFetcher.java b/src/main/java/com/rometools/fetcher/impl/HttpURLFeedFetcher.java
index 8f5b5ef..9255f61 100644
--- a/src/main/java/com/rometools/fetcher/impl/HttpURLFeedFetcher.java
+++ b/src/main/java/com/rometools/fetcher/impl/HttpURLFeedFetcher.java
@@ -26,7 +26,6 @@ import java.util.zip.GZIPInputStream;
import com.rometools.fetcher.FetcherEvent;
import com.rometools.fetcher.FetcherException;
-
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedInput;
@@ -36,18 +35,20 @@ import com.sun.syndication.io.XmlReader;
*
* Class to retrieve syndication files via HTTP.
*
- *
+ *
*
- * If passed a {@link com.rometools.fetcher.impl.FeedFetcherCache} in the constructor it will use conditional gets to only retrieve modified content.
+ * If passed a {@link com.rometools.fetcher.impl.FeedFetcherCache} in the constructor it will use
+ * conditional gets to only retrieve modified content.
*
- *
+ *
*
- * The class uses the Accept-Encoding: gzip header to retrieve gzipped feeds where supported by the server.
+ * The class uses the Accept-Encoding: gzip header to retrieve gzipped feeds where supported by the
+ * server.
*
- *
+ *
*
* Simple usage:
- *
+ *
*
* // create the cache
* FeedFetcherCache feedInfoCache = HashMapFeedInfoCache.getFeedInfoCache();
@@ -56,14 +57,15 @@ import com.sun.syndication.io.XmlReader;
* // retrieve the resource if it has changed
* SyndFeed feed = new HttpURLFeedFetcher(feedInfoCache).retrieveFeed(feedUrl);
*
- *
+ *
*
- *
+ *
* @see http://fishbowl.pastiche.org/2002/10/21/http_conditional_get_for_rss_hackers
* @see http://diveintomark.org/archives/2003/07/21/atom_aggregator_behavior_http_level
- * @see http://bobwyman.pubsub.com/main/2004/09/using_rfc3229_w.html
+ * @see http://bobwyman.pubsub.com/main/2004/09/using_rfc3229_w.html
* @author Nick Lothian
*/
public class HttpURLFeedFetcher extends AbstractFeedFetcher {
@@ -76,7 +78,7 @@ public class HttpURLFeedFetcher extends AbstractFeedFetcher {
/**
* Constructor to use HttpURLFeedFetcher without caching of feeds
- *
+ *
*/
public HttpURLFeedFetcher() {
super();
@@ -84,7 +86,7 @@ public class HttpURLFeedFetcher extends AbstractFeedFetcher {
/**
* Constructor to enable HttpURLFeedFetcher to cache feeds
- *
+ *
* @param feedCache - an instance of the FeedFetcherCache interface
*/
public HttpURLFeedFetcher(final FeedFetcherCache feedInfoCache) {
@@ -99,7 +101,7 @@ public class HttpURLFeedFetcher extends AbstractFeedFetcher {
/**
* Retrieve a feed over HTTP
- *
+ *
* @param feedUrl A non-null URL of a RSS/Atom feed to retrieve
* @return A {@link com.sun.syndication.feed.synd.SyndFeed} object
* @throws IllegalArgumentException if the URL is null;
@@ -121,7 +123,8 @@ public class HttpURLFeedFetcher extends AbstractFeedFetcher {
if (connectTimeout >= 0) {
httpConnection.setConnectTimeout(connectTimeout);
}
- // httpConnection.setInstanceFollowRedirects(true); // this is true by default, but can be changed on a claswide basis
+ // httpConnection.setInstanceFollowRedirects(true); // this is true by default, but can be
+ // changed on a claswide basis
final FeedFetcherCache cache = getFeedInfoCache();
if (cache != null) {
@@ -217,7 +220,8 @@ public class HttpURLFeedFetcher extends AbstractFeedFetcher {
if (isUsingDeltaEncoding() && imHeader != null && imHeader.indexOf("feed") >= 0) {
final FeedFetcherCache cache = getFeedInfoCache();
if (cache != null && connection.getResponseCode() == 226) {
- // client is setup to use http delta encoding and the server supports it and has returned a delta encoded response
+ // client is setup to use http delta encoding and the server supports it and has
+ // returned a delta encoded response
// This response only includes new items
final SyndFeedInfo cachedInfo = cache.getFeedInfo(orignalUrl);
if (cachedInfo != null) {
@@ -241,7 +245,7 @@ public class HttpURLFeedFetcher extends AbstractFeedFetcher {
*
* Set appropriate HTTP headers, including conditional get and gzip encoding headers
*
- *
+ *
* @param connection A URLConnection
* @param syndFeedInfo The SyndFeedInfo for the feed to be retrieved. May be null
*/
@@ -278,7 +282,8 @@ public class HttpURLFeedFetcher extends AbstractFeedFetcher {
is = new BufferedInputStream(inputStream);
}
- // InputStreamReader reader = new InputStreamReader(is, ResponseHandler.getCharacterEncoding(connection));
+ // InputStreamReader reader = new InputStreamReader(is,
+ // ResponseHandler.getCharacterEncoding(connection));
// SyndFeedInput input = new SyndFeedInput();
@@ -322,5 +327,5 @@ public class HttpURLFeedFetcher extends AbstractFeedFetcher {
*/
public synchronized void setConnectTimeout(final int timeout) {
connectTimeout = timeout;
- }
+ }
}
diff --git a/src/main/java/com/rometools/fetcher/impl/LinkedHashMapFeedInfoCache.java b/src/main/java/com/rometools/fetcher/impl/LinkedHashMapFeedInfoCache.java
index 03f6443..a398bf6 100644
--- a/src/main/java/com/rometools/fetcher/impl/LinkedHashMapFeedInfoCache.java
+++ b/src/main/java/com/rometools/fetcher/impl/LinkedHashMapFeedInfoCache.java
@@ -8,14 +8,14 @@ import java.util.Map;
*
* An implementation of the {@link com.rometools.fetcher.impl.FeedFetcherCache} interface.
*
- *
+ *
*
* Unlike the HashMapFeedInfoCache this implementation will not grow unbound
*
- *
+ *
* @author Javier Kohen
* @author Nick Lothian
- *
+ *
*/
public class LinkedHashMapFeedInfoCache extends HashMapFeedInfoCache {
@@ -42,7 +42,7 @@ public class LinkedHashMapFeedInfoCache extends HashMapFeedInfoCache {
/**
* Get the global instance of the cache
- *
+ *
* @return an implementation of FeedFetcherCache
*/
public static final FeedFetcherCache getInstance() {
@@ -53,11 +53,12 @@ public class LinkedHashMapFeedInfoCache extends HashMapFeedInfoCache {
*
* Constructor for HashMapFeedInfoCache
*
- *
+ *
*
- * Only use this if you want multiple instances of the cache. Usually {@link #getInstance()} is more appropriate.
+ * Only use this if you want multiple instances of the cache. Usually {@link #getInstance()} is
+ * more appropriate.
*
- *
+ *
* @see #getInstance()
*/
public LinkedHashMapFeedInfoCache() {
diff --git a/src/main/java/com/rometools/fetcher/impl/ResponseHandler.java b/src/main/java/com/rometools/fetcher/impl/ResponseHandler.java
index 4ce757e..56b3ab8 100644
--- a/src/main/java/com/rometools/fetcher/impl/ResponseHandler.java
+++ b/src/main/java/com/rometools/fetcher/impl/ResponseHandler.java
@@ -22,7 +22,7 @@ import java.util.regex.Pattern;
/**
* Utility class to help deal with HTTP responses
- *
+ *
*/
public class ResponseHandler {
public static final String defaultCharacterEncoding = "ISO-8859-1";
@@ -34,12 +34,14 @@ public class ResponseHandler {
}
/**
- *
+ *
*
- * Gets the character encoding of a response. (Note that this is different to the content-encoding)
+ * Gets the character encoding of a response. (Note that this is different to the
+ * content-encoding)
*
- *
- * @param contentTypeHeader the value of the content-type HTTP header eg: text/html; charset=ISO-8859-4
+ *
+ * @param contentTypeHeader the value of the content-type HTTP header eg: text/html;
+ * charset=ISO-8859-4
* @return the character encoding, eg: ISO-8859-4
*/
public static String getCharacterEncoding(final String contentTypeHeader) {
diff --git a/src/main/java/com/rometools/fetcher/impl/SyndFeedInfo.java b/src/main/java/com/rometools/fetcher/impl/SyndFeedInfo.java
index f36ae91..4b9d604 100644
--- a/src/main/java/com/rometools/fetcher/impl/SyndFeedInfo.java
+++ b/src/main/java/com/rometools/fetcher/impl/SyndFeedInfo.java
@@ -24,13 +24,14 @@ import com.sun.syndication.feed.synd.SyndFeed;
/**
*
- * A class to represent a {@link com.sun.syndication.feed.synd.SyndFeed} and some useful information about it.
+ * A class to represent a {@link com.sun.syndication.feed.synd.SyndFeed} and some useful information
+ * about it.
*
- *
+ *
*
* This class is thread safe, as expected by the different feed fetcher implementations.
*
- *
+ *
* @author Nick Lothian
*/
public class SyndFeedInfo implements Cloneable, Serializable {
@@ -50,10 +51,10 @@ public class SyndFeedInfo implements Cloneable, Serializable {
/**
* Creates a deep 'bean' clone of the object.
*
- *
+ *
* @return a clone of the object.
* @throws CloneNotSupportedException thrown if an element of the object cannot be cloned.
- *
+ *
*/
@Override
public Object clone() throws CloneNotSupportedException {
@@ -61,12 +62,13 @@ public class SyndFeedInfo implements Cloneable, Serializable {
}
/**
- * Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
+ * Indicates whether some other object is "equal to" this one as defined by the Object equals()
+ * method.
*
- *
+ *
* @param other he reference object with which to compare.
* @return true if 'this' object is equal to the 'other' object.
- *
+ *
*/
@Override
public boolean equals(final Object other) {
@@ -78,9 +80,9 @@ public class SyndFeedInfo implements Cloneable, Serializable {
*
* It follows the contract defined by the Object hashCode() method.
*
- *
+ *
* @return the hashcode of the bean object.
- *
+ *
*/
@Override
public int hashCode() {
@@ -90,9 +92,9 @@ public class SyndFeedInfo implements Cloneable, Serializable {
/**
* Returns the String representation for the object.
*
- *
+ *
* @return String representation for the object.
- *
+ *
*/
@Override
public String toString() {
@@ -148,7 +150,8 @@ public class SyndFeedInfo implements Cloneable, Serializable {
}
/**
- * @param string A unique ID to identify the feed. Note that if the URL of the feed changes this will remain the same
+ * @param string A unique ID to identify the feed. Note that if the URL of the feed changes this
+ * will remain the same
*/
public synchronized void setId(final String string) {
id = string;
diff --git a/src/main/java/com/rometools/fetcher/samples/FeedAggregator.java b/src/main/java/com/rometools/fetcher/samples/FeedAggregator.java
index a55f6ba..8af007f 100644
--- a/src/main/java/com/rometools/fetcher/samples/FeedAggregator.java
+++ b/src/main/java/com/rometools/fetcher/samples/FeedAggregator.java
@@ -25,7 +25,6 @@ import com.rometools.fetcher.FeedFetcher;
import com.rometools.fetcher.impl.FeedFetcherCache;
import com.rometools.fetcher.impl.HashMapFeedInfoCache;
import com.rometools.fetcher.impl.HttpURLFeedFetcher;
-
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.feed.synd.SyndFeedImpl;
@@ -33,16 +32,17 @@ import com.sun.syndication.io.SyndFeedOutput;
/**
*
- * It aggregates a list of RSS/Atom feeds (they can be of different types) into a single feed of the specified type.
+ * It aggregates a list of RSS/Atom feeds (they can be of different types) into a single feed of the
+ * specified type.
*
- *
+ *
*
* Converted from the original FeedAggregator sample
*
- *
+ *
* @author Alejandro Abdelnur
* @author Nick Lothian
- *
+ *
*/
public class FeedAggregator {
diff --git a/src/main/java/com/rometools/fetcher/samples/FeedReader.java b/src/main/java/com/rometools/fetcher/samples/FeedReader.java
index dc4832b..4dc92f7 100644
--- a/src/main/java/com/rometools/fetcher/samples/FeedReader.java
+++ b/src/main/java/com/rometools/fetcher/samples/FeedReader.java
@@ -25,16 +25,15 @@ import com.rometools.fetcher.FetcherListener;
import com.rometools.fetcher.impl.FeedFetcherCache;
import com.rometools.fetcher.impl.HashMapFeedInfoCache;
import com.rometools.fetcher.impl.HttpURLFeedFetcher;
-
import com.sun.syndication.feed.synd.SyndFeed;
/**
* Reads and prints any RSS/Atom feed type. Converted from the original Rome sample FeedReader
*