//# 1 errors, 202 messages
//#
/*
    //#WebloggerConfig.java:1:1: class: org.apache.roller.weblogger.config.WebloggerConfig
 * 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.config;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.PropertyConfigurator;
import org.apache.roller.util.PropertyExpander;


/**
 * This is the single entry point for accessing configuration properties in Roller.
 */
public class WebloggerConfig {
    
    private static String default_config = "/org/apache/roller/weblogger/config/roller.properties";
    //#WebloggerConfig.java:37: method: org.apache.roller.weblogger.config.WebloggerConfig.org.apache.roller.weblogger.config.WebloggerConfig__static_init
    //#input(org.apache.roller.weblogger.config.WebloggerConfig__static_init): java.lang.System.out
    //#output(org.apache.roller.weblogger.config.WebloggerConfig__static_init): "="._tainted
    //#output(org.apache.roller.weblogger.config.WebloggerConfig__static_init): "Roller Weblogger: Failed to load custom properties from "._tainted
    //#output(org.apache.roller.weblogger.config.WebloggerConfig__static_init): "Roller Weblogger: Successfully loaded custom properties from "._tainted
    //#output(org.apache.roller.weblogger.config.WebloggerConfig__static_init): __Descendant_Table[org/apache/roller/weblogger/config/WebloggerConfig]
    //#output(org.apache.roller.weblogger.config.WebloggerConfig__static_init): config
    //#output(org.apache.roller.weblogger.config.WebloggerConfig__static_init): custom_config
    //#output(org.apache.roller.weblogger.config.WebloggerConfig__static_init): custom_config_file
    //#output(org.apache.roller.weblogger.config.WebloggerConfig__static_init): custom_jvm_param
    //#output(org.apache.roller.weblogger.config.WebloggerConfig__static_init): default_config
    //#output(org.apache.roller.weblogger.config.WebloggerConfig__static_init): log
    //#output(org.apache.roller.weblogger.config.WebloggerConfig__static_init): new File(WebloggerConfig__static_init#2) num objects
    //#output(org.apache.roller.weblogger.config.WebloggerConfig__static_init): new Properties(WebloggerConfig__static_init#1) num objects
    //#new obj(org.apache.roller.weblogger.config.WebloggerConfig__static_init): new File(WebloggerConfig__static_init#2)
    //#new obj(org.apache.roller.weblogger.config.WebloggerConfig__static_init): new Properties(WebloggerConfig__static_init#1)
    //#presumption(org.apache.roller.weblogger.config.WebloggerConfig__static_init): java.lang.Class:forName(...)@57 != null
    //#presumption(org.apache.roller.weblogger.config.WebloggerConfig__static_init): java.lang.System.out != null
    //#presumption(org.apache.roller.weblogger.config.WebloggerConfig__static_init): java.util.Properties:keys(...)@116 != null
    //#presumption(org.apache.roller.weblogger.config.WebloggerConfig__static_init): org.apache.commons.logging.LogFactory:getLog(...)@44 != null
    //#post(org.apache.roller.weblogger.config.WebloggerConfig__static_init): "="._tainted == 0
    //#post(org.apache.roller.weblogger.config.WebloggerConfig__static_init): "Roller Weblogger: Failed to load custom properties from "._tainted == 0
    //#post(org.apache.roller.weblogger.config.WebloggerConfig__static_init): "Roller Weblogger: Successfully loaded custom properties from "._tainted == 0
    //#post(org.apache.roller.weblogger.config.WebloggerConfig__static_init): __Descendant_Table[org/apache/roller/weblogger/config/WebloggerConfig] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.config.WebloggerConfig__static_init): config == &new Properties(WebloggerConfig__static_init#1)
    //#post(org.apache.roller.weblogger.config.WebloggerConfig__static_init): custom_config == &".roller-custom.properties"
    //#post(org.apache.roller.weblogger.config.WebloggerConfig__static_init): custom_config_file in Addr_Set{null,&new File(WebloggerConfig__static_init#2)}
    //#post(org.apache.roller.weblogger.config.WebloggerConfig__static_init): custom_jvm_param == &"roller.custom.config"
    //#post(org.apache.roller.weblogger.config.WebloggerConfig__static_init): default_config == &".org.apache.roller.weblogger.config.roller.properties"
    //#post(org.apache.roller.weblogger.config.WebloggerConfig__static_init): (soft) log != null
    //#post(org.apache.roller.weblogger.config.WebloggerConfig__static_init): new File(WebloggerConfig__static_init#2) num objects <= 1
    //#post(org.apache.roller.weblogger.config.WebloggerConfig__static_init): new Properties(WebloggerConfig__static_init#1) num objects == 1
    //#unanalyzed(org.apache.roller.weblogger.config.WebloggerConfig__static_init): Effects-of-calling:java.util.Properties
    //#unanalyzed(org.apache.roller.weblogger.config.WebloggerConfig__static_init): Effects-of-calling:java.util.Properties:get
    //#unanalyzed(org.apache.roller.weblogger.config.WebloggerConfig__static_init): Effects-of-calling:java.util.Properties:put
    //#unanalyzed(org.apache.roller.weblogger.config.WebloggerConfig__static_init): Effects-of-calling:java.util.Properties:keys
    //#unanalyzed(org.apache.roller.weblogger.config.WebloggerConfig__static_init): Effects-of-calling:java.util.Enumeration:hasMoreElements
    //#unanalyzed(org.apache.roller.weblogger.config.WebloggerConfig__static_init): Effects-of-calling:java.util.Enumeration:nextElement
    //#test_vector(org.apache.roller.weblogger.config.WebloggerConfig__static_init): java.io.File:exists(...)@78: {0}, {1}
    //#test_vector(org.apache.roller.weblogger.config.WebloggerConfig__static_init): java.lang.Class:getResourceAsStream(...)@64: Addr_Set{null}, Inverse{null}
    //#test_vector(org.apache.roller.weblogger.config.WebloggerConfig__static_init): java.lang.String:length(...)@74: {0}, {1..4_294_967_295}
    //#test_vector(org.apache.roller.weblogger.config.WebloggerConfig__static_init): java.lang.System:getProperty(...)@73: Addr_Set{null}, Inverse{null}
    //#test_vector(org.apache.roller.weblogger.config.WebloggerConfig__static_init): java.util.Properties:get(...)@92: Addr_Set{null}, Inverse{null}
    private static String custom_config = "/roller-custom.properties";
    private static String custom_jvm_param = "roller.custom.config";
    private static File custom_config_file = null;

    private static Properties config;

    private static Log log = LogFactory.getLog(WebloggerConfig.class);
    //#WebloggerConfig.java:44: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.config.WebloggerConfig
    //#    method: org.apache.roller.weblogger.config.WebloggerConfig__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    

    /*
     * Static block run once at class loading
     *
     * We load the default properties and any custom properties we find
     */
    static {
        config = new Properties();

        try {
            // we'll need this to get at our properties files in the classpath
            Class config_class = Class.forName("org.apache.roller.weblogger.config.WebloggerConfig");

            // first, lets load our default properties
            InputStream is = config_class.getResourceAsStream(default_config);
            config.load(is);

            // now, see if we can find our custom config
            is = config_class.getResourceAsStream(custom_config);
            if(is != null) {
                config.load(is);
                System.out.println("Roller Weblogger: Successfully loaded custom properties file from classpath");
            } else {
                System.out.println("Roller Weblogger: No custom properties file found in classpath");
            }

            // finally, check for an external config file
            String env_file = System.getProperty(custom_jvm_param);
            if(env_file != null && env_file.length() > 0) {
                custom_config_file = new File(env_file);

                // make sure the file exists, then try and load it
                if(custom_config_file != null && custom_config_file.exists()) {
    //#WebloggerConfig.java:78: Warning: test always goes same way
    //#    test predetermined because custom_config_file != null
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.config.WebloggerConfig
    //#    method: org.apache.roller.weblogger.config.WebloggerConfig__static_init
    //#    from bb: bb_7
    //#    live edge: bb_7-->bb_8
    //#    tested vn: 0
    //#    tested vn values: {0}
                    is = new FileInputStream(custom_config_file);
                    config.load(is);
                    System.out.println("Roller Weblogger: Successfully loaded custom properties from "+
                            custom_config_file.getAbsolutePath());
                } else {
                    System.out.println("Roller Weblogger: Failed to load custom properties from "+
                            custom_config_file.getAbsolutePath());
                }

            } 

            // Now expand system properties for properties in the config.expandedProperties list,
            // replacing them by their expanded values.
            String expandedPropertiesDef = (String) config.get("config.expandedProperties");
            if (expandedPropertiesDef != null) {
                String[] expandedProperties = expandedPropertiesDef.split(",");
                for (int i = 0; i < expandedProperties.length; i++) {
    //#WebloggerConfig.java:95: ?use of default init
    //#    init'ed(expandedProperties.length)
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.config.WebloggerConfig
    //#    method: org.apache.roller.weblogger.config.WebloggerConfig__static_init
    //#    basic block: bb_13
    //#    assertion: init'ed(expandedProperties.length)
    //#    VN: undefined
    //#    Expected: {-Inf..+Inf}
    //#    Bad: {Invalid}
    //#    Attribs:  Int  Bad only invalid
    //#WebloggerConfig.java:95: Warning: test always goes same way
    //#    test predetermined because i == expandedProperties.length
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.config.WebloggerConfig
    //#    method: org.apache.roller.weblogger.config.WebloggerConfig__static_init
    //#    from bb: bb_13
    //#    live edge: bb_13-->bb_17
    //#    tested vn: i - undefined
    //#    tested vn values: {0}
    //#WebloggerConfig.java:95: Warning: dead code continues
    //#    dead code continues
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.config.WebloggerConfig
    //#    method: org.apache.roller.weblogger.config.WebloggerConfig__static_init
    //#    dead bb: bb_16
                    String propName = expandedProperties[i].trim();
    //#WebloggerConfig.java:96: Warning: dead code
    //#    dead code here because i == expandedProperties.length
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.config.WebloggerConfig
    //#    method: org.apache.roller.weblogger.config.WebloggerConfig__static_init
    //#    dead bb: bb_14
                    String initialValue = (String) config.get(propName);
                    if (initialValue != null) {
                        String expandedValue = PropertyExpander.expandSystemProperties(initialValue);
    //#WebloggerConfig.java:99: Warning: dead code continues
    //#    dead code continues
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.config.WebloggerConfig
    //#    method: org.apache.roller.weblogger.config.WebloggerConfig__static_init
    //#    dead bb: bb_15
                        config.put(propName,expandedValue);
                    }
                }
            }
            
            // initialize logging subsystem via WebloggerConfig
            Properties log4jprops = new Properties();
            PropertyConfigurator.configure(WebloggerConfig.getPropertiesStartingWith("log4j."));
    //#WebloggerConfig.java:107: Warning: method not available
    //#    -- call on void org.apache.log4j.PropertyConfigurator:configure(Properties)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.config.WebloggerConfig
    //#    method: org.apache.roller.weblogger.config.WebloggerConfig__static_init
    //#    unanalyzed callee: void org.apache.log4j.PropertyConfigurator:configure(Properties)
            
            // finally we can start logging...

            // some debugging for those that want it
            if(log.isDebugEnabled()) {
    //#WebloggerConfig.java:112: Warning: method not available
    //#    -- call on bool org.apache.commons.logging.Log:isDebugEnabled()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.config.WebloggerConfig
    //#    method: org.apache.roller.weblogger.config.WebloggerConfig__static_init
    //#    unanalyzed callee: bool org.apache.commons.logging.Log:isDebugEnabled()
                log.debug("WebloggerConfig looks like this ...");
    //#WebloggerConfig.java:113: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.config.WebloggerConfig
    //#    method: org.apache.roller.weblogger.config.WebloggerConfig__static_init
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)

                String key = null;
                Enumeration keys = config.keys();
                while(keys.hasMoreElements()) {
                    key = (String) keys.nextElement();
                    log.debug(key+"="+config.getProperty(key));
    //#WebloggerConfig.java:119: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.config.WebloggerConfig
    //#    method: org.apache.roller.weblogger.config.WebloggerConfig__static_init
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
                }
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

    }
    //#WebloggerConfig.java:127: end of method: org.apache.roller.weblogger.config.WebloggerConfig.org.apache.roller.weblogger.config.WebloggerConfig__static_init


    // no, you may not instantiate this class :p
    private WebloggerConfig() {}
    //#WebloggerConfig.java:131: method: void org.apache.roller.weblogger.config.WebloggerConfig.org.apache.roller.weblogger.config.WebloggerConfig()
    //#WebloggerConfig.java:131: end of method: void org.apache.roller.weblogger.config.WebloggerConfig.org.apache.roller.weblogger.config.WebloggerConfig()


    /**
     * Retrieve a property value
     * @param     key Name of the property
     * @return    String Value of property requested, null if not found
     */
    public static String getProperty(String key) {
        log.debug("Fetching property ["+key+"="+config.getProperty(key)+"]");
    //#WebloggerConfig.java:140: method: String org.apache.roller.weblogger.config.WebloggerConfig.getProperty(String)
    //#WebloggerConfig.java:140: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.config.WebloggerConfig
    //#    method: String getProperty(String)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
    //#input(String getProperty(String)): "="._tainted
    //#input(String getProperty(String)): "Fetching property ["._tainted
    //#input(String getProperty(String)): "]"._tainted
    //#input(String getProperty(String)): config
    //#input(String getProperty(String)): key
    //#input(String getProperty(String)): key._tainted
    //#input(String getProperty(String)): log
    //#output(String getProperty(String)): return_value
    //#pre[1] (String getProperty(String)): config != null
    //#pre[4] (String getProperty(String)): log != null
    //#post(String getProperty(String)): init'ed(return_value)
        String value = config.getProperty(key);
        return value == null ? value : value.trim();
    //#WebloggerConfig.java:142: end of method: String org.apache.roller.weblogger.config.WebloggerConfig.getProperty(String)
    }
    
    /**
     * Retrieve a property value
     * @param     key Name of the property
     * @param     defaultValue Default value of property if not found     
     * @return    String Value of property requested or defaultValue
     */
    public static String getProperty(String key, String defaultValue) {
        log.debug("Fetching property ["+key+"="+config.getProperty(key)+",defaultValue="+defaultValue+"]");
    //#WebloggerConfig.java:152: method: String org.apache.roller.weblogger.config.WebloggerConfig.getProperty(String, String)
    //#WebloggerConfig.java:152: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.config.WebloggerConfig
    //#    method: String getProperty(String, String)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
    //#input(String getProperty(String, String)): ",defaultValue="._tainted
    //#input(String getProperty(String, String)): "="._tainted
    //#input(String getProperty(String, String)): "Fetching property ["._tainted
    //#input(String getProperty(String, String)): "]"._tainted
    //#input(String getProperty(String, String)): config
    //#input(String getProperty(String, String)): defaultValue
    //#input(String getProperty(String, String)): defaultValue._tainted
    //#input(String getProperty(String, String)): key
    //#input(String getProperty(String, String)): key._tainted
    //#input(String getProperty(String, String)): log
    //#output(String getProperty(String, String)): return_value
    //#pre[1] (String getProperty(String, String)): config != null
    //#pre[7] (String getProperty(String, String)): log != null
    //#post(String getProperty(String, String)): init'ed(return_value)
    //#test_vector(String getProperty(String, String)): java.util.Properties:getProperty(...)@153: Inverse{null}, Addr_Set{null}
        String value = config.getProperty(key);
        if(value == null)
          return defaultValue;
        
        return value.trim();
    //#WebloggerConfig.java:157: end of method: String org.apache.roller.weblogger.config.WebloggerConfig.getProperty(String, String)
    }

    /**
     * Retrieve a property as a boolean ... defaults to false if not present.
     */
    public static boolean getBooleanProperty(String name) {
        return getBooleanProperty(name,false);
    //#WebloggerConfig.java:164: method: bool org.apache.roller.weblogger.config.WebloggerConfig.getBooleanProperty(String)
    //#input(bool getBooleanProperty(String)): "="._tainted
    //#input(bool getBooleanProperty(String)): "Fetching property ["._tainted
    //#input(bool getBooleanProperty(String)): "]"._tainted
    //#input(bool getBooleanProperty(String)): config
    //#input(bool getBooleanProperty(String)): log
    //#input(bool getBooleanProperty(String)): name
    //#input(bool getBooleanProperty(String)): name._tainted
    //#output(bool getBooleanProperty(String)): return_value
    //#pre[1] (bool getBooleanProperty(String)): config != null
    //#pre[2] (bool getBooleanProperty(String)): log != null
    //#post(bool getBooleanProperty(String)): init'ed(return_value)
    //#unanalyzed(bool getBooleanProperty(String)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(bool getBooleanProperty(String)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(bool getBooleanProperty(String)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(bool getBooleanProperty(String)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(bool getBooleanProperty(String)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(bool getBooleanProperty(String)): Effects-of-calling:java.util.Properties:getProperty
    //#unanalyzed(bool getBooleanProperty(String)): Effects-of-calling:java.lang.Boolean
    //#unanalyzed(bool getBooleanProperty(String)): Effects-of-calling:java.lang.Boolean:booleanValue
    //#WebloggerConfig.java:164: end of method: bool org.apache.roller.weblogger.config.WebloggerConfig.getBooleanProperty(String)
    }

    /**
     * Retrieve a property as a boolean ... with specified default if not present.
     */
    public static boolean getBooleanProperty(String name, boolean defaultValue) {
        // get the value first, then convert
        String value = WebloggerConfig.getProperty(name);
    //#WebloggerConfig.java:172: method: bool org.apache.roller.weblogger.config.WebloggerConfig.getBooleanProperty(String, bool)
    //#input(bool getBooleanProperty(String, bool)): "="._tainted
    //#input(bool getBooleanProperty(String, bool)): "Fetching property ["._tainted
    //#input(bool getBooleanProperty(String, bool)): "]"._tainted
    //#input(bool getBooleanProperty(String, bool)): config
    //#input(bool getBooleanProperty(String, bool)): defaultValue
    //#input(bool getBooleanProperty(String, bool)): log
    //#input(bool getBooleanProperty(String, bool)): name
    //#input(bool getBooleanProperty(String, bool)): name._tainted
    //#output(bool getBooleanProperty(String, bool)): return_value
    //#pre[1] (bool getBooleanProperty(String, bool)): config != null
    //#pre[3] (bool getBooleanProperty(String, bool)): log != null
    //#post(bool getBooleanProperty(String, bool)): init'ed(return_value)
    //#unanalyzed(bool getBooleanProperty(String, bool)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(bool getBooleanProperty(String, bool)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(bool getBooleanProperty(String, bool)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(bool getBooleanProperty(String, bool)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(bool getBooleanProperty(String, bool)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(bool getBooleanProperty(String, bool)): Effects-of-calling:java.util.Properties:getProperty

        if(value == null)
            return defaultValue;

        return (new Boolean(value)).booleanValue();
    //#WebloggerConfig.java:177: end of method: bool org.apache.roller.weblogger.config.WebloggerConfig.getBooleanProperty(String, bool)
    }

    /**
     * Retrieve a property as an int ... defaults to 0 if not present.
     */
    public static int getIntProperty(String name) {
        return getIntProperty(name, 0);
    //#WebloggerConfig.java:184: method: int org.apache.roller.weblogger.config.WebloggerConfig.getIntProperty(String)
    //#input(int getIntProperty(String)): "="._tainted
    //#input(int getIntProperty(String)): "Fetching property ["._tainted
    //#input(int getIntProperty(String)): "]"._tainted
    //#input(int getIntProperty(String)): config
    //#input(int getIntProperty(String)): log
    //#input(int getIntProperty(String)): name
    //#input(int getIntProperty(String)): name._tainted
    //#output(int getIntProperty(String)): return_value
    //#pre[1] (int getIntProperty(String)): config != null
    //#pre[2] (int getIntProperty(String)): log != null
    //#post(int getIntProperty(String)): init'ed(return_value)
    //#unanalyzed(int getIntProperty(String)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(int getIntProperty(String)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(int getIntProperty(String)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(int getIntProperty(String)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(int getIntProperty(String)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(int getIntProperty(String)): Effects-of-calling:java.util.Properties:getProperty
    //#unanalyzed(int getIntProperty(String)): Effects-of-calling:java.lang.Integer
    //#unanalyzed(int getIntProperty(String)): Effects-of-calling:java.lang.Integer:intValue
    //#WebloggerConfig.java:184: end of method: int org.apache.roller.weblogger.config.WebloggerConfig.getIntProperty(String)
    }

    /**
     * Retrieve a property as a int ... with specified default if not present.
     */
    public static int getIntProperty(String name, int defaultValue) {
        // get the value first, then convert
        String value = WebloggerConfig.getProperty(name);
    //#WebloggerConfig.java:192: method: int org.apache.roller.weblogger.config.WebloggerConfig.getIntProperty(String, int)
    //#input(int getIntProperty(String, int)): "="._tainted
    //#input(int getIntProperty(String, int)): "Fetching property ["._tainted
    //#input(int getIntProperty(String, int)): "]"._tainted
    //#input(int getIntProperty(String, int)): config
    //#input(int getIntProperty(String, int)): defaultValue
    //#input(int getIntProperty(String, int)): log
    //#input(int getIntProperty(String, int)): name
    //#input(int getIntProperty(String, int)): name._tainted
    //#output(int getIntProperty(String, int)): return_value
    //#pre[1] (int getIntProperty(String, int)): config != null
    //#pre[3] (int getIntProperty(String, int)): log != null
    //#post(int getIntProperty(String, int)): init'ed(return_value)
    //#unanalyzed(int getIntProperty(String, int)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(int getIntProperty(String, int)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(int getIntProperty(String, int)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(int getIntProperty(String, int)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(int getIntProperty(String, int)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(int getIntProperty(String, int)): Effects-of-calling:java.util.Properties:getProperty

        if (value == null)
            return defaultValue;

        return (new Integer(value)).intValue();
    //#WebloggerConfig.java:197: end of method: int org.apache.roller.weblogger.config.WebloggerConfig.getIntProperty(String, int)
    }

    /**
     * Retrieve all property keys
     * @return Enumeration A list of all keys
     **/
    public static Enumeration keys() {
        return config.keys();
    //#WebloggerConfig.java:205: method: Enumeration org.apache.roller.weblogger.config.WebloggerConfig.keys()
    //#input(Enumeration keys()): config
    //#output(Enumeration keys()): return_value
    //#pre[1] (Enumeration keys()): config != null
    //#post(Enumeration keys()): init'ed(return_value)
    //#WebloggerConfig.java:205: end of method: Enumeration org.apache.roller.weblogger.config.WebloggerConfig.keys()
    }
    
    
    /**
     * Get properties starting with a specified string.
     */
    public static Properties getPropertiesStartingWith(String startingWith) {
        Properties props = new Properties();
    //#WebloggerConfig.java:213: method: Properties org.apache.roller.weblogger.config.WebloggerConfig.getPropertiesStartingWith(String)
    //#input(Properties getPropertiesStartingWith(String)): config
    //#output(Properties getPropertiesStartingWith(String)): new Properties(getPropertiesStartingWith#1) num objects
    //#output(Properties getPropertiesStartingWith(String)): return_value
    //#new obj(Properties getPropertiesStartingWith(String)): new Properties(getPropertiesStartingWith#1)
    //#pre[1] (Properties getPropertiesStartingWith(String)): config != null
    //#presumption(Properties getPropertiesStartingWith(String)): java.util.Properties:keys(...)@214 != null
    //#post(Properties getPropertiesStartingWith(String)): return_value == &new Properties(getPropertiesStartingWith#1)
    //#post(Properties getPropertiesStartingWith(String)): new Properties(getPropertiesStartingWith#1) num objects == 1
    //#test_vector(Properties getPropertiesStartingWith(String)): java.util.Enumeration:hasMoreElements(...)@214: {0}, {1}
        for (Enumeration it = config.keys(); it.hasMoreElements();) {
            String key = (String)it.nextElement();
            props.put(key, config.get(key));
        }
        return props;
    //#WebloggerConfig.java:218: end of method: Properties org.apache.roller.weblogger.config.WebloggerConfig.getPropertiesStartingWith(String)
    }
    

    /**
     * Set the "uploads.dir" property at runtime.
     * <p />
     * Properties are meant to be read-only, but we make this exception because  
     * we know that some people are still writing their uploads to the webapp  
     * context and we can only get that path at runtime (and for unit testing).
     * <p />
     * This property is *not* persisted in any way.
     */
    public static void setUploadsDir(String path) {
        // only do this if the user wants to use the webapp context
        if("${webapp.context}".equals(config.getProperty("uploads.dir")))
    //#WebloggerConfig.java:233: method: void org.apache.roller.weblogger.config.WebloggerConfig.setUploadsDir(String)
    //#input(void setUploadsDir(String)): config
    //#input(void setUploadsDir(String)): path
    //#pre[1] (void setUploadsDir(String)): config != null
    //#test_vector(void setUploadsDir(String)): java.lang.String:equals(...)@233: {0}, {1}
            config.setProperty("uploads.dir", path);
    }
    //#WebloggerConfig.java:235: end of method: void org.apache.roller.weblogger.config.WebloggerConfig.setUploadsDir(String)
    
    /**
     * Set the "themes.dir" property at runtime.
     * <p />
     * Properties are meant to be read-only, but we make this exception because  
     * we know that some people are still using their themes in the webapp  
     * context and we can only get that path at runtime (and for unit testing).
     * <p />
     * This property is *not* persisted in any way.
     */
    public static void setThemesDir(String path) {
        // only do this if the user wants to use the webapp context
        if("${webapp.context}".equals(config.getProperty("themes.dir")))
    //#WebloggerConfig.java:248: method: void org.apache.roller.weblogger.config.WebloggerConfig.setThemesDir(String)
    //#input(void setThemesDir(String)): config
    //#input(void setThemesDir(String)): path
    //#pre[1] (void setThemesDir(String)): config != null
    //#test_vector(void setThemesDir(String)): java.lang.String:equals(...)@248: {0}, {1}
            config.setProperty("themes.dir", path);
    }
    //#WebloggerConfig.java:250: end of method: void org.apache.roller.weblogger.config.WebloggerConfig.setThemesDir(String)
    
}
    //#WebloggerConfig.java:: end of class: org.apache.roller.weblogger.config.WebloggerConfig
