core/com.nokia.carbide.cpp.news.reader/src/com/nokia/carbide/cpp/internal/news/reader/gen/FeedInfo/FeedInfoManager.java
branchRCL_2_0
changeset 104 4ca9a303c257
parent 99 3604ec4c983e
child 153 c847f1618fc8
--- a/core/com.nokia.carbide.cpp.news.reader/src/com/nokia/carbide/cpp/internal/news/reader/gen/FeedInfo/FeedInfoManager.java	Mon Apr 20 11:06:05 2009 -0500
+++ b/core/com.nokia.carbide.cpp.news.reader/src/com/nokia/carbide/cpp/internal/news/reader/gen/FeedInfo/FeedInfoManager.java	Tue Apr 21 01:15:45 2009 -0500
@@ -106,10 +106,26 @@
 	/**
 	 * Retrieve the feed info file from remote server, make a local copy of this file
 	 * and returns the URL to the local copy.
+	 * @param useLocal - use local copy of feed listing file? 
 	 * @return URL of local copy of feed info file
 	 * @throws Exception
 	 */
-	public URL getFeedInfoFileURL() throws Exception {
+	public URL getFeedInfoFileURL(boolean useLocalCopy) throws Exception {
+		if (feedInfoFile == null) {
+			feedInfoFile = createFeedInfoFile();
+		}
+
+		if (useLocalCopy) {
+			// try to use local copy of the fee info file if it exists.
+			if (feedInfoFile != null && feedInfoFile.exists()) {
+				return feedInfoFile.toURL();
+			}
+			else {
+				return null;
+			}
+		}
+
+		// retrieve the feed info file from remote server and make a local copy of this file
 		String pathStr = CarbideNewsReaderPlugin.getFeedManager().getProperty(FEED_INFO_FILE_KEY);
 		if (pathStr != null) {
 			URL fileUrl = new URL(pathStr);
@@ -124,9 +140,6 @@
 					handlesHttpErrorCode(responseCode);
 					inputStream = connection.getInputStream();
 					if (inputStream != null) {
-						if (feedInfoFile == null) {
-							feedInfoFile = createFeedInfoFile();
-						}
 						if (feedInfoFile != null) {
 							if (feedInfoFile.exists()) {
 								feedInfoFile.delete();
@@ -147,6 +160,7 @@
 				}
 			}
 		}
+
 		return null;
 	}