//# 0 errors, 192 messages
//#
/*
    //#WeblogFeedCache.java:1:1: class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
 * Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  The ASF licenses this file to You
 * under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.  For additional information regarding
 * copyright in this work, please see the NOTICE file in the top level
 * directory of this distribution.
 */

package org.apache.roller.weblogger.ui.rendering.util.cache;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.weblogger.config.WebloggerConfig;
import org.apache.roller.weblogger.ui.rendering.util.WeblogFeedRequest;
import org.apache.roller.weblogger.util.Utilities;
import org.apache.roller.weblogger.util.cache.Cache;
import org.apache.roller.weblogger.util.cache.CacheManager;
import org.apache.roller.weblogger.util.cache.LazyExpiringCacheEntry;


/**
 * Cache for weblog feed content.
 */
public class WeblogFeedCache {
    
    private static Log log = LogFactory.getLog(WeblogFeedCache.class);
    //#WeblogFeedCache.java:43: method: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache.org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init
    //#WeblogFeedCache.java:43: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/rendering/util/cache/WeblogFeedCache]
    //#output(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): __Dispatch_Table.clear()V
    //#output(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): __Dispatch_Table.generateKey(Lorg/apache/roller/weblogger/ui/rendering/util/WeblogFeedRequest;)Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): __Dispatch_Table.get(Ljava/lang/String;J)Ljava/lang/Object;
    //#output(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): __Dispatch_Table.put(Ljava/lang/String;Ljava/lang/Object;)V
    //#output(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): __Dispatch_Table.remove(Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): log
    //#output(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): new WeblogFeedCache(WeblogFeedCache__static_init#1) num objects
    //#output(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): singletonInstance.__Tag
    //#output(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): singletonInstance.cacheEnabled
    //#output(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): singletonInstance.contentCache
    //#output(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): singletonInstance
    //#new obj(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): new WeblogFeedCache(WeblogFeedCache__static_init#1)
    //#presumption(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): org.apache.commons.logging.LogFactory:getLog(...)@43 != null
    //#post(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/rendering/util/cache/WeblogFeedCache] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): __Dispatch_Table.clear()V == &clear
    //#post(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): __Dispatch_Table.generateKey(Lorg/apache/roller/weblogger/ui/rendering/util/WeblogFeedRequest;)Ljava/lang/String; == &generateKey
    //#post(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): __Dispatch_Table.get(Ljava/lang/String;J)Ljava/lang/Object; == &get
    //#post(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): __Dispatch_Table.put(Ljava/lang/String;Ljava/lang/Object;)V == &put
    //#post(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): __Dispatch_Table.remove(Ljava/lang/String;)V == &remove
    //#post(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): (soft) log != null
    //#post(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): singletonInstance == &new WeblogFeedCache(WeblogFeedCache__static_init#1)
    //#post(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): new WeblogFeedCache(WeblogFeedCache__static_init#1) num objects == 1
    //#post(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): singletonInstance.__Tag == org/apache/roller/weblogger/ui/rendering/util/cache/WeblogFeedCache
    //#post(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): init'ed(singletonInstance.cacheEnabled)
    //#post(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): init'ed(singletonInstance.contentCache)
    //#unanalyzed(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): Effects-of-calling:org.apache.roller.weblogger.config.WebloggerConfig:getBooleanProperty
    //#unanalyzed(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): Effects-of-calling:java.util.HashMap
    //#unanalyzed(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): Effects-of-calling:java.util.Map:put
    //#unanalyzed(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): Effects-of-calling:org.apache.roller.weblogger.config.WebloggerConfig:keys
    //#unanalyzed(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): Effects-of-calling:java.util.Enumeration:hasMoreElements
    //#unanalyzed(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): Effects-of-calling:java.util.Enumeration:nextElement
    //#unanalyzed(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): Effects-of-calling:java.lang.String:startsWith
    //#unanalyzed(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): Effects-of-calling:java.lang.String:length
    //#unanalyzed(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): Effects-of-calling:org.apache.roller.weblogger.config.WebloggerConfig:getProperty
    //#unanalyzed(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): Effects-of-calling:org.apache.commons.logging.Log:info
    //#unanalyzed(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): Effects-of-calling:org.apache.roller.weblogger.util.cache.CacheManager:constructCache
    //#unanalyzed(org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init): Effects-of-calling:org.apache.commons.logging.Log:warn
    
    // a unique identifier for this cache, this is used as the prefix for
    // roller config properties that apply to this cache
    public static final String CACHE_ID = "cache.weblogfeed";
    
    // keep cached content
    private boolean cacheEnabled = true;
    private Cache contentCache = null;
    
    // reference to our singleton instance
    private static WeblogFeedCache singletonInstance = new WeblogFeedCache();
    //#WeblogFeedCache.java:54: end of method: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache.org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache__static_init
    
    
    private WeblogFeedCache() {
    //#WeblogFeedCache.java:57: method: void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache.org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()
    //#input(void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()): log
    //#input(void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()): this
    //#output(void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()): this.cacheEnabled
    //#output(void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()): this.contentCache
    //#pre[1] (void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()): log != null
    //#presumption(void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()): java.lang.String:length(...)@70 <= 4_294_967_294
    //#presumption(void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()): java.util.Enumeration:nextElement(...)@66 != null
    //#presumption(void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()): org.apache.roller.weblogger.config.WebloggerConfig:keys(...)@63 != null
    //#post(void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()): init'ed(this.cacheEnabled)
    //#post(void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()): init'ed(this.contentCache)
    //#test_vector(void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()): java.lang.String:startsWith(...)@69: {0}, {1}
    //#test_vector(void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()): java.util.Enumeration:hasMoreElements(...)@65: {0}, {1}
    //#test_vector(void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()): org.apache.roller.weblogger.config.WebloggerConfig:getBooleanProperty(...)@59: {0}, {1}
        
        cacheEnabled = WebloggerConfig.getBooleanProperty(CACHE_ID+".enabled");
    //#WeblogFeedCache.java:59: Warning: method not available
    //#    -- call on bool org.apache.roller.weblogger.config.WebloggerConfig:getBooleanProperty(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()
    //#    unanalyzed callee: bool org.apache.roller.weblogger.config.WebloggerConfig:getBooleanProperty(String)
        
        Map cacheProps = new HashMap();
        cacheProps.put("id", CACHE_ID);
        Enumeration allProps = WebloggerConfig.keys();
    //#WeblogFeedCache.java:63: Warning: method not available
    //#    -- call on Enumeration org.apache.roller.weblogger.config.WebloggerConfig:keys()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()
    //#    unanalyzed callee: Enumeration org.apache.roller.weblogger.config.WebloggerConfig:keys()
        String prop = null;
        while(allProps.hasMoreElements()) {
            prop = (String) allProps.nextElement();
            
            // we are only interested in props for this cache
            if(prop.startsWith(CACHE_ID+".")) {
                cacheProps.put(prop.substring(CACHE_ID.length()+1), 
    //#WeblogFeedCache.java:70: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.config.WebloggerConfig:getProperty(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()
    //#    unanalyzed callee: String org.apache.roller.weblogger.config.WebloggerConfig:getProperty(String)
                        WebloggerConfig.getProperty(prop));
            }
        }
        
        log.info(cacheProps);
    //#WeblogFeedCache.java:75: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:info(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:info(Object)
        
        if(cacheEnabled) {
            contentCache = CacheManager.constructCache(null, cacheProps);
    //#WeblogFeedCache.java:78: Warning: method not available
    //#    -- call on Cache org.apache.roller.weblogger.util.cache.CacheManager:constructCache(CacheHandler, Map)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()
    //#    unanalyzed callee: Cache org.apache.roller.weblogger.util.cache.CacheManager:constructCache(CacheHandler, Map)
        } else {
            log.warn("Caching has been DISABLED");
    //#WeblogFeedCache.java:80: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:warn(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:warn(Object)
        }
    }
    //#WeblogFeedCache.java:82: end of method: void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache.org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache()
    
    
    public static WeblogFeedCache getInstance() {
        return singletonInstance;
    //#WeblogFeedCache.java:86: method: WeblogFeedCache org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache.getInstance()
    //#input(WeblogFeedCache getInstance()): singletonInstance
    //#output(WeblogFeedCache getInstance()): return_value
    //#pre[1] (WeblogFeedCache getInstance()): init'ed(singletonInstance)
    //#post(WeblogFeedCache getInstance()): return_value == singletonInstance
    //#post(WeblogFeedCache getInstance()): init'ed(return_value)
    //#WeblogFeedCache.java:86: end of method: WeblogFeedCache org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache.getInstance()
    }
    
    
    public Object get(String key, long lastModified) {
        
        if(!cacheEnabled)
    //#WeblogFeedCache.java:92: method: Object org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache.get(String, long)
    //#input(Object get(String, long)): "HIT "._tainted
    //#input(Object get(String, long)): "HIT-EXPIRED "._tainted
    //#input(Object get(String, long)): "MISS "._tainted
    //#input(Object get(String, long)): key
    //#input(Object get(String, long)): key._tainted
    //#input(Object get(String, long)): lastModified
    //#input(Object get(String, long)): log
    //#input(Object get(String, long)): this
    //#input(Object get(String, long)): this.cacheEnabled
    //#input(Object get(String, long)): this.contentCache
    //#output(Object get(String, long)): return_value
    //#pre[6] (Object get(String, long)): init'ed(this.cacheEnabled)
    //#pre[4] (Object get(String, long)): (soft) log != null
    //#pre[7] (Object get(String, long)): (soft) this.contentCache != null
    //#post(Object get(String, long)): init'ed(return_value)
    //#test_vector(Object get(String, long)): this.cacheEnabled: {1}, {0}
    //#test_vector(Object get(String, long)): org.apache.roller.weblogger.util.cache.Cache:get(...)@97: Addr_Set{null}, Inverse{null}
    //#test_vector(Object get(String, long)): org.apache.roller.weblogger.util.cache.LazyExpiringCacheEntry:getValue(...)@100: Addr_Set{null}, Inverse{null}
            return null;
        
        Object entry = null;
        
        LazyExpiringCacheEntry lazyEntry =
    //#WeblogFeedCache.java:97: Warning: method not available
    //#    -- call on Object org.apache.roller.weblogger.util.cache.Cache:get(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: Object get(String, long)
    //#    unanalyzed callee: Object org.apache.roller.weblogger.util.cache.Cache:get(String)
                (LazyExpiringCacheEntry) this.contentCache.get(key);
        if(lazyEntry != null) {
            entry = lazyEntry.getValue(lastModified);
    //#WeblogFeedCache.java:100: Warning: method not available
    //#    -- call on Object org.apache.roller.weblogger.util.cache.LazyExpiringCacheEntry:getValue(long)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: Object get(String, long)
    //#    unanalyzed callee: Object org.apache.roller.weblogger.util.cache.LazyExpiringCacheEntry:getValue(long)
            
            if(entry != null) {
                log.debug("HIT "+key);
    //#WeblogFeedCache.java:103: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: Object get(String, long)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
            } else {
                log.debug("HIT-EXPIRED "+key);
    //#WeblogFeedCache.java:105: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: Object get(String, long)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
            }
            
        } else {
            log.debug("MISS "+key);
    //#WeblogFeedCache.java:109: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: Object get(String, long)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
        }
        
        return entry;
    //#WeblogFeedCache.java:112: end of method: Object org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache.get(String, long)
    }
    
    
    public void put(String key, Object value) {
        
        if(!cacheEnabled)
    //#WeblogFeedCache.java:118: method: void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache.put(String, Object)
    //#input(void put(String, Object)): "PUT "._tainted
    //#input(void put(String, Object)): key
    //#input(void put(String, Object)): key._tainted
    //#input(void put(String, Object)): log
    //#input(void put(String, Object)): this
    //#input(void put(String, Object)): this.cacheEnabled
    //#input(void put(String, Object)): this.contentCache
    //#input(void put(String, Object)): value
    //#pre[5] (void put(String, Object)): init'ed(this.cacheEnabled)
    //#pre[3] (void put(String, Object)): (soft) log != null
    //#pre[6] (void put(String, Object)): (soft) this.contentCache != null
    //#test_vector(void put(String, Object)): this.cacheEnabled: {1}, {0}
            return;
        
        contentCache.put(key, new LazyExpiringCacheEntry(value));
    //#WeblogFeedCache.java:121: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.util.cache.LazyExpiringCacheEntry(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: void put(String, Object)
    //#    unanalyzed callee: void org.apache.roller.weblogger.util.cache.LazyExpiringCacheEntry(Object)
    //#WeblogFeedCache.java:121: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.util.cache.Cache:put(String, Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: void put(String, Object)
    //#    unanalyzed callee: void org.apache.roller.weblogger.util.cache.Cache:put(String, Object)
        log.debug("PUT "+key);
    //#WeblogFeedCache.java:122: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: void put(String, Object)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
    }
    //#WeblogFeedCache.java:123: end of method: void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache.put(String, Object)
    
    
    public void remove(String key) {
        
        if(!cacheEnabled)
    //#WeblogFeedCache.java:128: method: void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache.remove(String)
    //#input(void remove(String)): "REMOVE "._tainted
    //#input(void remove(String)): key
    //#input(void remove(String)): key._tainted
    //#input(void remove(String)): log
    //#input(void remove(String)): this
    //#input(void remove(String)): this.cacheEnabled
    //#input(void remove(String)): this.contentCache
    //#pre[5] (void remove(String)): init'ed(this.cacheEnabled)
    //#pre[3] (void remove(String)): (soft) log != null
    //#pre[6] (void remove(String)): (soft) this.contentCache != null
    //#test_vector(void remove(String)): this.cacheEnabled: {1}, {0}
            return;
        
        contentCache.remove(key);
    //#WeblogFeedCache.java:131: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.util.cache.Cache:remove(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: void remove(String)
    //#    unanalyzed callee: void org.apache.roller.weblogger.util.cache.Cache:remove(String)
        log.debug("REMOVE "+key);
    //#WeblogFeedCache.java:132: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: void remove(String)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
    }
    //#WeblogFeedCache.java:133: end of method: void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache.remove(String)
    
    
    public void clear() {
        
        if(!cacheEnabled)
    //#WeblogFeedCache.java:138: method: void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache.clear()
    //#input(void clear()): log
    //#input(void clear()): this
    //#input(void clear()): this.cacheEnabled
    //#input(void clear()): this.contentCache
    //#pre[3] (void clear()): init'ed(this.cacheEnabled)
    //#pre[1] (void clear()): (soft) log != null
    //#pre[4] (void clear()): (soft) this.contentCache != null
    //#test_vector(void clear()): this.cacheEnabled: {1}, {0}
            return;
        
        contentCache.clear();
    //#WeblogFeedCache.java:141: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.util.cache.Cache:clear()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: void clear()
    //#    unanalyzed callee: void org.apache.roller.weblogger.util.cache.Cache:clear()
        log.debug("CLEAR");
    //#WeblogFeedCache.java:142: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: void clear()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
    }
    //#WeblogFeedCache.java:143: end of method: void org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache.clear()
    
    
    /**
     * Generate a cache key from a parsed weblog feed request.
     * This generates a key of the form ...
     *
     * <handle>/<type>/<format>/[/category][/language][/excerpts]
     *
     * examples ...
     *
     * foo/entries/rss/en
     * foo/comments/rss/MyCategory/en
     * foo/entries/atom/en/excerpts
     *
     */
    public String generateKey(WeblogFeedRequest feedRequest) {
        
        StringBuffer key = new StringBuffer();
    //#WeblogFeedCache.java:161: method: String org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache.generateKey(WeblogFeedRequest)
    //#input(String generateKey(WeblogFeedRequest)): "."._tainted
    //#input(String generateKey(WeblogFeedRequest)): ".excerpts"._tainted
    //#input(String generateKey(WeblogFeedRequest)): ".tags."._tainted
    //#input(String generateKey(WeblogFeedRequest)): ":"._tainted
    //#input(String generateKey(WeblogFeedRequest)): "cache.weblogfeed"._tainted
    //#input(String generateKey(WeblogFeedRequest)): feedRequest
    //#input(String generateKey(WeblogFeedRequest)): feedRequest.__Tag
    //#input(String generateKey(WeblogFeedRequest)): feedRequest.excerpts
    //#input(String generateKey(WeblogFeedRequest)): feedRequest.format
    //#input(String generateKey(WeblogFeedRequest)): feedRequest.format._tainted
    //#input(String generateKey(WeblogFeedRequest)): feedRequest.locale
    //#input(String generateKey(WeblogFeedRequest)): feedRequest.locale._tainted
    //#input(String generateKey(WeblogFeedRequest)): feedRequest.tags
    //#input(String generateKey(WeblogFeedRequest)): feedRequest.type
    //#input(String generateKey(WeblogFeedRequest)): feedRequest.type._tainted
    //#input(String generateKey(WeblogFeedRequest)): feedRequest.weblogCategoryName
    //#input(String generateKey(WeblogFeedRequest)): feedRequest.weblogCategoryName._tainted
    //#input(String generateKey(WeblogFeedRequest)): feedRequest.weblogHandle
    //#input(String generateKey(WeblogFeedRequest)): feedRequest.weblogHandle._tainted
    //#input(String generateKey(WeblogFeedRequest)): org/apache/roller/weblogger/ui/rendering/util/WeblogFeedRequest.__Descendant_Table[org/apache/roller/weblogger/ui/rendering/util/WeblogFeedRequest]
    //#input(String generateKey(WeblogFeedRequest)): org/apache/roller/weblogger/ui/rendering/util/WeblogFeedRequest.__Descendant_Table[others]
    //#input(String generateKey(WeblogFeedRequest)): org/apache/roller/weblogger/ui/rendering/util/WeblogFeedRequest.__Dispatch_Table.getFormat()Ljava/lang/String;
    //#input(String generateKey(WeblogFeedRequest)): org/apache/roller/weblogger/ui/rendering/util/WeblogFeedRequest.__Dispatch_Table.getLocale()Ljava/lang/String;
    //#input(String generateKey(WeblogFeedRequest)): org/apache/roller/weblogger/ui/rendering/util/WeblogFeedRequest.__Dispatch_Table.getTags()Ljava/util/List;
    //#input(String generateKey(WeblogFeedRequest)): org/apache/roller/weblogger/ui/rendering/util/WeblogFeedRequest.__Dispatch_Table.getType()Ljava/lang/String;
    //#input(String generateKey(WeblogFeedRequest)): org/apache/roller/weblogger/ui/rendering/util/WeblogFeedRequest.__Dispatch_Table.getWeblogCategoryName()Ljava/lang/String;
    //#input(String generateKey(WeblogFeedRequest)): org/apache/roller/weblogger/ui/rendering/util/WeblogFeedRequest.__Dispatch_Table.getWeblogHandle()Ljava/lang/String;
    //#input(String generateKey(WeblogFeedRequest)): org/apache/roller/weblogger/ui/rendering/util/WeblogFeedRequest.__Dispatch_Table.isExcerpts()Z
    //#output(String generateKey(WeblogFeedRequest)): java.lang.StringBuffer:toString(...)._tainted
    //#output(String generateKey(WeblogFeedRequest)): return_value
    //#new obj(String generateKey(WeblogFeedRequest)): java.lang.StringBuffer:toString(...)
    //#pre[1] (String generateKey(WeblogFeedRequest)): feedRequest != null
    //#pre[2] (String generateKey(WeblogFeedRequest)): feedRequest.__Tag == org/apache/roller/weblogger/ui/rendering/util/WeblogFeedRequest
    //#pre[3] (String generateKey(WeblogFeedRequest)): init'ed(feedRequest.excerpts)
    //#pre[4] (String generateKey(WeblogFeedRequest)): init'ed(feedRequest.format)
    //#pre[7] (String generateKey(WeblogFeedRequest)): init'ed(feedRequest.locale)
    //#pre[9] (String generateKey(WeblogFeedRequest)): init'ed(feedRequest.tags)
    //#pre[10] (String generateKey(WeblogFeedRequest)): init'ed(feedRequest.type)
    //#pre[12] (String generateKey(WeblogFeedRequest)): init'ed(feedRequest.weblogCategoryName)
    //#pre[14] (String generateKey(WeblogFeedRequest)): init'ed(feedRequest.weblogHandle)
    //#presumption(String generateKey(WeblogFeedRequest)): java.util.Set:size(...)@182 >= 0
    //#post(String generateKey(WeblogFeedRequest)): init'ed(java.lang.StringBuffer:toString(...)._tainted)
    //#post(String generateKey(WeblogFeedRequest)): return_value == &java.lang.StringBuffer:toString(...)
    //#test_vector(String generateKey(WeblogFeedRequest)): feedRequest.excerpts: {0}, {1}
    //#test_vector(String generateKey(WeblogFeedRequest)): feedRequest.locale: Addr_Set{null}, Inverse{null}
    //#test_vector(String generateKey(WeblogFeedRequest)): feedRequest.tags: Addr_Set{null}, Inverse{null}
    //#test_vector(String generateKey(WeblogFeedRequest)): feedRequest.weblogCategoryName: Addr_Set{null}, Inverse{null}
    //#test_vector(String generateKey(WeblogFeedRequest)): java.util.List:size(...)@180: {-2_147_483_648..0}, {1..4_294_967_295}
        
        key.append(this.CACHE_ID).append(":");
        key.append(feedRequest.getWeblogHandle());
        
        key.append("/").append(feedRequest.getType());
        key.append("/").append(feedRequest.getFormat());
        
        if(feedRequest.getWeblogCategoryName() != null) {
            String cat = feedRequest.getWeblogCategoryName();
            try {
                cat = URLEncoder.encode(cat, "UTF-8");
            } catch (UnsupportedEncodingException ex) {
                // should never happen, utf-8 is always supported
            }
            
            key.append("/").append(cat);
        }
        
        if(feedRequest.getTags() != null && feedRequest.getTags().size() > 0) {
          Set ordered = new TreeSet(feedRequest.getTags());
          String[] tags = (String[]) ordered.toArray(new String[ordered.size()]);  
          key.append("/tags/").append(Utilities.stringArrayToString(tags,"+"));
    //#WeblogFeedCache.java:183: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.util.Utilities:stringArrayToString(String[], String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
    //#    method: String generateKey(WeblogFeedRequest)
    //#    unanalyzed callee: String org.apache.roller.weblogger.util.Utilities:stringArrayToString(String[], String)
        }        
        
        if(feedRequest.getLocale() != null) {
            key.append("/").append(feedRequest.getLocale());
        }
        
        if(feedRequest.isExcerpts()) {
            key.append("/excerpts");
        }
        
        return key.toString();
    //#WeblogFeedCache.java:194: end of method: String org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache.generateKey(WeblogFeedRequest)
    }
    
}
    //#WeblogFeedCache.java:: end of class: org.apache.roller.weblogger.ui.rendering.util.cache.WeblogFeedCache
