Removed remote connections from UI thread during Carbide startup; fix for Bug 8917.
--- a/core/com.nokia.carbide.cpp.news.reader/src/com/nokia/carbide/cpp/internal/news/reader/feed/FeedManager.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/feed/FeedManager.java Tue Apr 21 01:15:45 2009 -0500
@@ -95,7 +95,7 @@
@SuppressWarnings("static-access")
public void loadFeeds() {
try {
- if (!loadFeedListing()) {
+ if (!loadFeedListing(false)) {
return;
}
@@ -251,7 +251,7 @@
@SuppressWarnings("static-access")
public void updateFeeds() {
try {
- if (!loadFeedListing()) {
+ if (!loadFeedListing(false)) {
return;
}
@@ -383,11 +383,12 @@
}
/**
- * Load feed information from feed listing file.
+ * Load feed information from feed listing file.
+ * @param useLocal - use local copy of feed listing file?
* @return true on success; false otherwise
*/
- private boolean loadFeedListing() throws Exception {
- URL url = feedListingManager.getFeedInfoFileURL();
+ private boolean loadFeedListing(boolean useLocalCopy) throws Exception {
+ URL url = feedListingManager.getFeedInfoFileURL(useLocalCopy);
if (url != null) {
return feedListingManager.loadFeedInfo(url);
}
@@ -459,7 +460,7 @@
private void validateFeeds() {
if ((newsFeeds == null || newsFeeds.size() == 0) && resourceFeed == null) {
try {
- if (!loadFeedListing()) {
+ if (!loadFeedListing(true)) {
return;
}
--- 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;
}