roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r575974 - /roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/velocity/deprecated/NewsfeedCache.java
Date Sat, 15 Sep 2007 20:55:48 GMT
Author: snoopdave
Date: Sat Sep 15 13:55:48 2007
New Revision: 575974

URL: http://svn.apache.org/viewvc?rev=575974&view=rev
Log:
Don't complain about bad config value unless value is set

Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/velocity/deprecated/NewsfeedCache.java

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/velocity/deprecated/NewsfeedCache.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/velocity/deprecated/NewsfeedCache.java?rev=575974&r1=575973&r2=575974&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/velocity/deprecated/NewsfeedCache.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/velocity/deprecated/NewsfeedCache.java
Sat Sep 15 13:55:48 2007
@@ -38,15 +38,15 @@
  */
 public class NewsfeedCache {
     
-    private static Log mLogger = LogFactory.getLog(NewsfeedCache.class);
+    private static Log log = LogFactory.getLog(NewsfeedCache.class);
     
     /** Static singleton * */
-    private static NewsfeedCache mInstance = null;
+    private static NewsfeedCache instance = null;
     
     /** Instance vars * */
     private boolean aggregator_enabled = true;
     private boolean aggregator_cache_enabled = true;
-    private int aggregator_cache_timeout = 14400;
+    private int     aggregator_cache_timeout = 14400;
     
     /** LRU cache */
     LRUCache2 mCache = null;
@@ -66,8 +66,12 @@
             this.aggregator_cache_enabled = true;
         
         try {
-            this.aggregator_cache_timeout = Integer.parseInt(cachetime);
-        } catch(Exception e) { mLogger.warn(e); }
+            if (cachetime != null) {
+                this.aggregator_cache_timeout = Integer.parseInt(cachetime);
+            }
+        } catch(NumberFormatException e) { 
+            log.error("ERROR 'aggregator.cache.timeout'not a valid integer: " + cachetime);
+        }
         
         // finally ... create the cache
         this.mCache = new LRUCache2(100, 1000 * this.aggregator_cache_timeout);
@@ -77,14 +81,14 @@
     /** static singleton retriever */
     public static NewsfeedCache getInstance() {
         synchronized (NewsfeedCache.class) {
-            if (mInstance == null) {
-                if (mLogger.isDebugEnabled()) {
-                    mLogger.debug("Instantiating new NewsfeedCache");
+            if (instance == null) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Instantiating new NewsfeedCache");
                 }
-                mInstance = new NewsfeedCache();
+                instance = new NewsfeedCache();
             }
         }
-        return mInstance;
+        return instance;
     }
     
     
@@ -104,14 +108,14 @@
             }
             
             if (aggregator_cache_enabled) {
-                if (mLogger.isDebugEnabled()) {
-                    mLogger.debug("Newsfeed: use Cache for " + feedUrl);
+                if (log.isDebugEnabled()) {
+                    log.debug("Newsfeed: use Cache for " + feedUrl);
                 }
                 
                 // Get pre-parsed feed from the cache
                 feed = (SyndFeed) mCache.get(feedUrl);
-                if (mLogger.isDebugEnabled()) {
-                    mLogger.debug("Newsfeed: got from Cache");
+                if (log.isDebugEnabled()) {
+                    log.debug("Newsfeed: got from Cache");
                 }
                 
                 if (feed == null) {
@@ -121,16 +125,16 @@
                         feed = feedInput.build(new InputStreamReader(
                                 new URL(feedUrl).openStream()));
                     } catch (Exception e1) {
-                        mLogger.info("Error parsing RSS: " + feedUrl);
+                        log.info("Error parsing RSS: " + feedUrl);
                     }
                 }
                 // Store parsed feed in the cache
                 mCache.put(feedUrl, feed);
-                mLogger.debug("Newsfeed: not in Cache");
+                log.debug("Newsfeed: not in Cache");
                 
             } else {
-                if (mLogger.isDebugEnabled()) {
-                    mLogger.debug("Newsfeed: not using Cache for " + feedUrl);
+                if (log.isDebugEnabled()) {
+                    log.debug("Newsfeed: not using Cache for " + feedUrl);
                 }
                 try {
                     // charset fix from Jason Rumney (see ROL-766)
@@ -160,13 +164,13 @@
                     feed = feedInput.build(new InputStreamReader(
                             connection.getInputStream(), charset));
                 } catch (Exception e1) {
-                    mLogger.info("Error parsing RSS: " + feedUrl);
+                    log.info("Error parsing RSS: " + feedUrl);
                 }
             }
             
         } catch (Exception ioe) {
-            if (mLogger.isDebugEnabled()) {
-                mLogger.debug("Newsfeed: Unexpected exception", ioe);
+            if (log.isDebugEnabled()) {
+                log.debug("Newsfeed: Unexpected exception", ioe);
             }
         }
         



Mime
View raw message