//# 8 errors, 306 messages
//#
/*
    //#SmileysPlugin.java:1:1: class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
 * 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.business.plugins.entry;

import java.util.Enumeration;
import java.util.Map;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.weblogger.WebloggerException;
import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
import org.apache.roller.weblogger.business.plugins.entry.WeblogEntryPlugin;
import org.apache.roller.weblogger.pojos.WeblogEntry;
import org.apache.roller.weblogger.pojos.Weblog;

/**
 * Converts ascii emoticons into HTML image tags.
 */
public class SmileysPlugin implements WeblogEntryPlugin {
    
    private static Log log = LogFactory.getLog(SmileysPlugin.class);
    //#SmileysPlugin.java:40: method: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin.org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init
    //#SmileysPlugin.java:40: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): __Descendant_Table[org/apache/roller/weblogger/business/plugins/entry/SmileysPlugin]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): __Dispatch_Table.getDescription()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): __Dispatch_Table.getName()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): __Dispatch_Table.htmlEscape(Ljava/lang/String;)Ljava/lang/String;
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): __Dispatch_Table.init(Lorg/apache/roller/weblogger/pojos/Weblog;)V
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): __Dispatch_Table.regexEscape(Ljava/lang/String;)Ljava/lang/String;
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): __Dispatch_Table.render(Lorg/apache/roller/weblogger/pojos/WeblogEntry;Ljava/lang/String;)Ljava/lang/String;
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): imageTags
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): log
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): new Pattern[](SmileysPlugin__static_init#1) num objects
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): smileyPatterns.length
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): new Properties(SmileysPlugin__static_init#3) num objects
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): new String[](SmileysPlugin__static_init#2) num objects
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): imageTags.length
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): new char[](SmileysPlugin__static_init#4) num objects
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex.length
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[0]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[10]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[11]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[12]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[13]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[14]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[15]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[16]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[17]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[18]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[19]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[1]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[2]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[3]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[4]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[5]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[6]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[7]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[8]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[9]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): org/apache/roller/weblogger/business/plugins/entry/WeblogEntryPlugin.__Descendant_Table[org/apache/roller/weblogger/business/plugins/entry/SmileysPlugin]
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): smileyDefs
    //#output(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): smileyPatterns
    //#new obj(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): new Pattern[](SmileysPlugin__static_init#1)
    //#new obj(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): new Properties(SmileysPlugin__static_init#3)
    //#new obj(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): new String[](SmileysPlugin__static_init#2)
    //#new obj(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): new char[](SmileysPlugin__static_init#4)
    //#presumption(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): org.apache.commons.logging.LogFactory:getLog(...)@40 != null
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): __Descendant_Table[org/apache/roller/weblogger/business/plugins/entry/SmileysPlugin] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): org/apache/roller/weblogger/business/plugins/entry/WeblogEntryPlugin.__Descendant_Table[org/apache/roller/weblogger/business/plugins/entry/SmileysPlugin] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): __Dispatch_Table.getDescription()Ljava/lang/String; == &getDescription
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): __Dispatch_Table.getName()Ljava/lang/String; == &getName
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): __Dispatch_Table.htmlEscape(Ljava/lang/String;)Ljava/lang/String; == &htmlEscape
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): __Dispatch_Table.init(Lorg/apache/roller/weblogger/pojos/Weblog;)V == &init
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): __Dispatch_Table.regexEscape(Ljava/lang/String;)Ljava/lang/String; == &regexEscape
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): __Dispatch_Table.render(Lorg/apache/roller/weblogger/pojos/WeblogEntry;Ljava/lang/String;)Ljava/lang/String; == &render
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex == &new char[](SmileysPlugin__static_init#4)
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): imageTags == &new String[](SmileysPlugin__static_init#2)
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): (soft) log != null
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): smileyDefs == &new Properties(SmileysPlugin__static_init#3)
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): smileyPatterns == &new Pattern[](SmileysPlugin__static_init#1)
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): new Pattern[](SmileysPlugin__static_init#1) num objects == 1
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): new Properties(SmileysPlugin__static_init#3) num objects == 1
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): new String[](SmileysPlugin__static_init#2) num objects == 1
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): new char[](SmileysPlugin__static_init#4) num objects == 1
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): smileyPatterns.length == 0
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): imageTags.length == 0
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex.length == 20
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[0] == 45
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[10] == 63
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[11] == 123
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[12] == 125
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[13] == 33
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[14] == 61
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[15] == 60
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[16] == 62
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[17] == 38
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[18] == 91
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[19] == 93
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[1] == 40
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[2] == 41
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[3] == 92
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[4] == 124
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[5] == 58
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[6] == 94
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[7] == 36
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[8] == 42
    //#post(org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init): escape_regex[9] == 43
    
    public static Pattern[] smileyPatterns = new Pattern[0]; // public for tests
    static String[] imageTags = new String[0];
    private static Properties smileyDefs = new Properties();
    
    private String name = "Emoticons";
    private String description = "Change ASCII emoticons to graphics.  " +
            ":-) becomes <img src='./images/smileys/smile.gif'>";
    
    
    static {
        try {
            smileyDefs.load(SmileysPlugin.class.getResourceAsStream("smileys.properties"));
        } catch (Exception e) {
            log.error("Unable to load smileys.properties", e);
    //#SmileysPlugin.java:55: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
        }
    }

    
    public SmileysPlugin() {
    //#SmileysPlugin.java:60: method: void org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin.org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin()
    //#input(void org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin()): log
    //#input(void org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin()): this
    //#output(void org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin()): this.description
    //#output(void org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin()): this.name
    //#pre[1] (void org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin()): log != null
    //#post(void org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin()): this.description == &"Change ASCII emoticons to graphics.  :-) becomes <img src='..images.smileys.smile.gif'>"
    //#post(void org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin()): this.name == &"Emoticons"
        log.debug("SmileysPlugin instantiated.");
    //#SmileysPlugin.java:61: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: void org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
    }
    //#SmileysPlugin.java:62: end of method: void org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin.org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin()
    
    
    public String getName() {
        return name;
    //#SmileysPlugin.java:66: method: String org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin.getName()
    //#input(String getName()): this
    //#input(String getName()): this.name
    //#output(String getName()): return_value
    //#pre[2] (String getName()): init'ed(this.name)
    //#post(String getName()): return_value == this.name
    //#post(String getName()): init'ed(return_value)
    //#SmileysPlugin.java:66: end of method: String org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin.getName()
    }
    
    
    public String getDescription() {
        return StringEscapeUtils.escapeJavaScript(description);
    //#SmileysPlugin.java:71: method: String org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin.getDescription()
    //#SmileysPlugin.java:71: Warning: method not available
    //#    -- call on String org.apache.commons.lang.StringEscapeUtils:escapeJavaScript(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: String getDescription()
    //#    unanalyzed callee: String org.apache.commons.lang.StringEscapeUtils:escapeJavaScript(String)
    //#input(String getDescription()): this
    //#input(String getDescription()): this.description
    //#output(String getDescription()): return_value
    //#pre[2] (String getDescription()): init'ed(this.description)
    //#post(String getDescription()): init'ed(return_value)
    //#SmileysPlugin.java:71: end of method: String org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin.getDescription()
    }
    
    
    /*
     * Convert the SmileyDefs into RegEx patterns and img tags for
     * later use.  Need an HttpServletRequest though so that we can
     * get the ServletContext Path.  But only do it once.
     */
    public synchronized void init(Weblog website) throws WebloggerException {
        // don't do this work if Smileys already loaded
        if (SmileysPlugin.smileyPatterns.length < 1) {
    //#SmileysPlugin.java:82: method: void org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin.init(Weblog)
    //#SmileysPlugin.java:82: Warning: suspicious precondition
    //#    the precondition for org/apache/roller/weblogger/business/WebloggerFactory.webloggerProvider.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: void init(Weblog)
    //#    suspicious precondition index: [8]
    //#    Attribs:  Soft
    //#input(void init(Weblog)): " alt=""._tainted
    //#input(void init(Weblog)): " title=""._tainted
    //#input(void init(Weblog)): "" .>"._tainted
    //#input(void init(Weblog)): "" class="smiley""._tainted
    //#input(void init(Weblog)): """._tainted
    //#input(void init(Weblog)): "# smileys: "._tainted
    //#input(void init(Weblog)): "&amp;gt;"._tainted
    //#input(void init(Weblog)): "&amp;lt;"._tainted
    //#input(void init(Weblog)): "&amp;quot;"._tainted
    //#input(void init(Weblog)): ".images.smileys."._tainted
    //#input(void init(Weblog)): "<img src=""._tainted
    //#input(void init(Weblog)): "="._tainted
    //#input(void init(Weblog)): "Trouble accessing property: "._tainted
    //#input(void init(Weblog)): "\"._tainted
    //#input(void init(Weblog)): "]"._tainted
    //#input(void init(Weblog)): "fetched property ["._tainted
    //#input(void init(Weblog)): "site.absoluteurl"._tainted
    //#input(void init(Weblog)): escape_regex
    //#input(void init(Weblog)): escape_regex.length
    //#input(void init(Weblog)): escape_regex[0..4_294_967_295]
    //#input(void init(Weblog)): log
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/GuiceWebloggerProvider.__Dispatch_Table.getWeblogger()Lorg/apache/roller/weblogger/business/Weblogger;
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/PropertiesManager.__Descendant_Table[org/apache/roller/weblogger/business/PropertiesManager]
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/PropertiesManager.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPropertiesManagerImpl]
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/PropertiesManager.__Descendant_Table[others]
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/PropertiesManager.__Dispatch_Table.getProperty(Ljava/lang/String;)Lorg/apache/roller/weblogger/pojos/RuntimeConfigProperty;
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/Weblogger.__Descendant_Table[org/apache/roller/weblogger/business/WebloggerImpl]
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/Weblogger.__Descendant_Table[org/apache/roller/weblogger/business/Weblogger]
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/Weblogger.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAWebloggerImpl]
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/Weblogger.__Descendant_Table[others]
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/Weblogger.__Dispatch_Table.getPropertiesManager()Lorg/apache/roller/weblogger/business/PropertiesManager;
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/WebloggerFactory.webloggerProvider
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/WebloggerFactory.webloggerProvider.__Tag
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/WebloggerFactory.webloggerProvider.webloggerInstance
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/WebloggerFactory.webloggerProvider.webloggerInstance.__Tag
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/WebloggerFactory.webloggerProvider.webloggerInstance.propertiesManager
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/WebloggerFactory.webloggerProvider.webloggerInstance.propertiesManager.__Tag
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/WebloggerFactory.webloggerProvider.webloggerInstance.propertiesManager.strategy
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/WebloggerFactory.webloggerProvider.webloggerInstance.propertiesManager.strategy.__Tag
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/WebloggerFactory.webloggerProvider.webloggerInstance.propertiesManager.strategy.threadLocalEntityManager
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/WebloggerImpl.__Dispatch_Table.getPropertiesManager()Lorg/apache/roller/weblogger/business/PropertiesManager;
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/WebloggerProvider.__Descendant_Table[org/apache/roller/weblogger/business/GuiceWebloggerProvider]
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/WebloggerProvider.__Descendant_Table[org/apache/roller/weblogger/business/WebloggerProvider]
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/WebloggerProvider.__Descendant_Table[others]
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/WebloggerProvider.__Dispatch_Table.getWeblogger()Lorg/apache/roller/weblogger/business/Weblogger;
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy]
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Descendant_Table[others]
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/jpa/JPAPersistenceStrategy.__Dispatch_Table.load(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/jpa/JPAPropertiesManagerImpl.__Dispatch_Table.getProperty(Ljava/lang/String;)Lorg/apache/roller/weblogger/pojos/RuntimeConfigProperty;
    //#input(void init(Weblog)): org/apache/roller/weblogger/business/jpa/JPAWebloggerImpl.__Dispatch_Table.getPropertiesManager()Lorg/apache/roller/weblogger/business/PropertiesManager;
    //#input(void init(Weblog)): org/apache/roller/weblogger/config/WebloggerRuntimeConfig.absoluteContextURL
    //#input(void init(Weblog)): org/apache/roller/weblogger/config/WebloggerRuntimeConfig.absoluteContextURL._tainted
    //#input(void init(Weblog)): org/apache/roller/weblogger/config/WebloggerRuntimeConfig.log
    //#input(void init(Weblog)): smileyDefs
    //#input(void init(Weblog)): smileyPatterns
    //#input(void init(Weblog)): smileyPatterns.length
    //#input(void init(Weblog)): this
    //#output(void init(Weblog)): imageTags
    //#output(void init(Weblog)): java.lang.StringBuilder:toString(...)._tainted
    //#output(void init(Weblog)): new Pattern[](init#1) num objects
    //#output(void init(Weblog)): new Pattern[](init#1).length
    //#output(void init(Weblog)): new Pattern[](init#1)[0..4_294_967_295]
    //#output(void init(Weblog)): new String[](init#2) num objects
    //#output(void init(Weblog)): new String[](init#2).length
    //#output(void init(Weblog)): new String[](init#2)[0..4_294_967_295]
    //#output(void init(Weblog)): smileyPatterns
    //#new obj(void init(Weblog)): java.lang.StringBuilder:toString(...)
    //#new obj(void init(Weblog)): new Pattern[](init#1)
    //#new obj(void init(Weblog)): new String[](init#2)
    //#pre[6] (void init(Weblog)): smileyPatterns != null
    //#pre[1] (void init(Weblog)): (soft) escape_regex != null
    //#pre[2] (void init(Weblog)): (soft) escape_regex.length <= 4_294_967_295
    //#pre[3] (void init(Weblog)): (soft) init'ed(escape_regex[0..4_294_967_295])
    //#pre[4] (void init(Weblog)): (soft) log != null
    //#pre[7] (void init(Weblog)): (soft) org/apache/roller/weblogger/business/WebloggerFactory.webloggerProvider != null
    //#pre[8] (void init(Weblog)): (soft) org/apache/roller/weblogger/business/WebloggerFactory.webloggerProvider.__Tag in {org/apache/roller/weblogger/business/GuiceWebloggerProvider, org/apache/roller/weblogger/business/WebloggerProvider}
    //#pre[9] (void init(Weblog)): (soft) org/apache/roller/weblogger/business/WebloggerFactory.webloggerProvider.webloggerInstance != null
    //#pre[17] (void init(Weblog)): (soft) init'ed(org/apache/roller/weblogger/config/WebloggerRuntimeConfig.absoluteContextURL)
    //#pre[19] (void init(Weblog)): (soft) org/apache/roller/weblogger/config/WebloggerRuntimeConfig.log != null
    //#pre[20] (void init(Weblog)): (soft) smileyDefs != null
    //#presumption(void init(Weblog)): java.util.Enumeration:nextElement(...)@91 != null
    //#presumption(void init(Weblog)): java.util.Properties:propertyNames(...)@89 != null
    //#presumption(void init(Weblog)): java.util.Properties:size(...)@85 >= 1
    //#presumption(void init(Weblog)): java.util.Properties:size(...)@86 >= 1
    //#post(void init(Weblog)): imageTags == One-of{old imageTags, &new String[](init#2)}
    //#post(void init(Weblog)): init'ed(java.lang.StringBuilder:toString(...)._tainted)
    //#post(void init(Weblog)): smileyPatterns == One-of{old smileyPatterns, &new Pattern[](init#1)}
    //#post(void init(Weblog)): smileyPatterns != null
    //#post(void init(Weblog)): new Pattern[](init#1) num objects <= 1
    //#post(void init(Weblog)): (soft) new Pattern[](init#1).length in 1..4_294_967_295
    //#post(void init(Weblog)): init'ed(new Pattern[](init#1)[0..4_294_967_295])
    //#post(void init(Weblog)): new String[](init#2) num objects <= 1
    //#post(void init(Weblog)): (soft) new String[](init#2).length in 1..4_294_967_295
    //#post(void init(Weblog)): new String[](init#2)[0..4_294_967_295] == &java.lang.StringBuilder:toString(...)
    //#unanalyzed(void init(Weblog)): Effects-of-calling:java.lang.String:toCharArray
    //#unanalyzed(void init(Weblog)): Effects-of-calling:java.lang.StringBuffer
    //#unanalyzed(void init(Weblog)): Effects-of-calling:java.lang.StringBuffer:append
    //#unanalyzed(void init(Weblog)): Effects-of-calling:java.lang.StringBuffer:toString
    //#unanalyzed(void init(Weblog)): Effects-of-calling:getWeblogger
    //#unanalyzed(void init(Weblog)): Effects-of-calling:getPropertiesManager
    //#unanalyzed(void init(Weblog)): Effects-of-calling:getProperty
    //#unanalyzed(void init(Weblog)): Effects-of-calling:java.lang.ThreadLocal:get
    //#unanalyzed(void init(Weblog)): Effects-of-calling:javax.persistence.EntityManagerFactory:createEntityManager
    //#unanalyzed(void init(Weblog)): Effects-of-calling:java.lang.ThreadLocal:set
    //#unanalyzed(void init(Weblog)): Effects-of-calling:javax.persistence.EntityManager:getTransaction
    //#unanalyzed(void init(Weblog)): Effects-of-calling:javax.persistence.EntityTransaction:isActive
    //#unanalyzed(void init(Weblog)): Effects-of-calling:javax.persistence.EntityTransaction:begin
    //#unanalyzed(void init(Weblog)): Effects-of-calling:javax.persistence.EntityManager:find
    //#unanalyzed(void init(Weblog)): Effects-of-calling:org.apache.roller.weblogger.pojos.RuntimeConfigProperty:getValue
    //#unanalyzed(void init(Weblog)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void init(Weblog)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void init(Weblog)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void init(Weblog)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void init(Weblog)): Effects-of-calling:org.apache.commons.logging.Log:warn
    //#unanalyzed(void init(Weblog)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(void init(Weblog)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void init(Weblog)): Effects-of-calling:java.lang.String:length
    //#test_vector(void init(Weblog)): smileyPatterns.length: {1..+Inf}, {0}
    //#test_vector(void init(Weblog)): java.util.Enumeration:hasMoreElements(...)@90: {0}, {1}
            String baseURL = WebloggerRuntimeConfig.getAbsoluteContextURL();
            
            Pattern[] tempP = new Pattern[SmileysPlugin.smileyDefs.size()];
            String[] tempS = new String[SmileysPlugin.smileyDefs.size()];
            log.debug("# smileys: " + smileyDefs.size());
    //#SmileysPlugin.java:87: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: void init(Weblog)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
            int count = 0;
            Enumeration enum1 = SmileysPlugin.smileyDefs.propertyNames();
            while(enum1.hasMoreElements()) {
                String smiley = (String)enum1.nextElement();
                String smileyAlt = htmlEscape(smiley);
                tempP[count] = Pattern.compile(regexEscape(smiley));
    //#SmileysPlugin.java:93: ?array index out of bounds
    //#    count < tempP.length
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: void init(Weblog)
    //#    basic block: bb_4
    //#    assertion: count < tempP.length
    //#    VN: -(count - java.util.Properties:size(...)@85)
    //#    Expected: {1..+Inf}
    //#    Bad: {0}
    //#    Attribs:  Int  Bad singleton  Bad overlaps +/-1000  Bad < Exp
                tempS[count] = "<img src=\"" +
    //#SmileysPlugin.java:94: ?array index out of bounds
    //#    count < tempS.length
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: void init(Weblog)
    //#    basic block: bb_4
    //#    assertion: count < tempS.length
    //#    VN: -(count - java.util.Properties:size(...)@86)
    //#    Expected: {1..+Inf}
    //#    Bad: {0}
    //#    Attribs:  Int  Bad singleton  Bad overlaps +/-1000  Bad < Exp
                        baseURL + "/images/smileys/" +
                        smileyDefs.getProperty(smiley, "smile.gif") +
                        "\" class=\"smiley\"" +
                        " alt=\"" + smileyAlt + "\"" +
                        " title=\"" + smileyAlt +"\" />";
                log.debug(smiley + "=" + tempS[count]);
    //#SmileysPlugin.java:100: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: void init(Weblog)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
                count++;
            }
            SmileysPlugin.smileyPatterns = tempP;
            SmileysPlugin.imageTags = tempS;
        }
    }
    //#SmileysPlugin.java:106: end of method: void org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin.init(Weblog)
    
    
    /**
     * Find occurences of ascii emoticons and turn them into HTML image pointers.
     */
    public String render(WeblogEntry entry, String text) {
        Matcher matcher = null;
    //#SmileysPlugin.java:113: method: String org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin.render(WeblogEntry, String)
    //#SmileysPlugin.java:113: Warning: unused assignment
    //#    unused assignment into matcher
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: String render(WeblogEntry, String)
    //#    Attribs:  Uncertain
    //#input(String render(WeblogEntry, String)): imageTags
    //#input(String render(WeblogEntry, String)): imageTags.length
    //#input(String render(WeblogEntry, String)): imageTags[0..4_294_967_295]
    //#input(String render(WeblogEntry, String)): smileyPatterns
    //#input(String render(WeblogEntry, String)): smileyPatterns.length
    //#input(String render(WeblogEntry, String)): smileyPatterns[0..4_294_967_295]
    //#input(String render(WeblogEntry, String)): text
    //#output(String render(WeblogEntry, String)): return_value
    //#pre[5] (String render(WeblogEntry, String)): smileyPatterns != null
    //#pre[6] (String render(WeblogEntry, String)): smileyPatterns.length <= 4_294_967_295
    //#pre[1] (String render(WeblogEntry, String)): (soft) imageTags != null
    //#pre[2] (String render(WeblogEntry, String)): (soft) imageTags.length >= 1
    //#pre[3] (String render(WeblogEntry, String)): (soft) smileyPatterns.length <= imageTags.length
    //#pre[4] (String render(WeblogEntry, String)): (soft) init'ed(imageTags[0..4_294_967_295])
    //#pre[7] (String render(WeblogEntry, String)): (soft) smileyPatterns[0..4_294_967_295] != null
    //#presumption(String render(WeblogEntry, String)): java.util.regex.Pattern:matcher(...)@115 != null
    //#post(String render(WeblogEntry, String)): init'ed(return_value)
        for (int i=0; i<smileyPatterns.length; i++) {
            matcher = smileyPatterns[i].matcher(text);
            text = matcher.replaceAll(imageTags[i]);
        }
        return text;
    //#SmileysPlugin.java:118: end of method: String org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin.render(WeblogEntry, String)
    }
    
    
    /*
     * To display the smiley 'glyph' certain characters
     * must be HTML escaped.
     */
    private String htmlEscape(String smiley) {
        char[] chars = smiley.toCharArray();
    //#SmileysPlugin.java:127: method: String org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin.htmlEscape(String)
    //#input(String htmlEscape(String)): "&amp;gt;"._tainted
    //#input(String htmlEscape(String)): "&amp;lt;"._tainted
    //#input(String htmlEscape(String)): "&amp;quot;"._tainted
    //#input(String htmlEscape(String)): smiley
    //#output(String htmlEscape(String)): java.lang.StringBuffer:toString(...)._tainted
    //#output(String htmlEscape(String)): return_value
    //#new obj(String htmlEscape(String)): java.lang.StringBuffer:toString(...)
    //#pre[1] (String htmlEscape(String)): smiley != null
    //#presumption(String htmlEscape(String)): chars.length@127 <= 4_294_967_295
    //#post(String htmlEscape(String)): java.lang.StringBuffer:toString(...)._tainted == 0
    //#post(String htmlEscape(String)): return_value == &java.lang.StringBuffer:toString(...)
        StringBuffer buf = new StringBuffer();
        for (int i=0; i<chars.length; i++) {
            if (chars[i] == '"') {
    //#SmileysPlugin.java:130: ?use of default init
    //#    init'ed(chars[i])
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: String htmlEscape(String)
    //#    basic block: bb_3
    //#    assertion: init'ed(chars[i])
    //#    VN: undefined
    //#    Expected: {-Inf..+Inf}
    //#    Bad: {Invalid}
    //#    Attribs:  Int  Bad only invalid
    //#SmileysPlugin.java:130: Warning: test always goes same way
    //#    test predetermined because chars[i] == 0
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: String htmlEscape(String)
    //#    from bb: bb_3
    //#    live edge: bb_3-->bb_5
    //#    tested vn: undefined - 34
    //#    tested vn values: {-34}
                buf.append("&quot;");
    //#SmileysPlugin.java:131: Warning: dead code
    //#    dead code here because chars[i] == 0
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: String htmlEscape(String)
    //#    dead bb: bb_4
            } else if (chars[i] == '>') {
    //#SmileysPlugin.java:132: ?use of default init
    //#    init'ed(chars[i])
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: String htmlEscape(String)
    //#    basic block: bb_5
    //#    assertion: init'ed(chars[i])
    //#    VN: undefined
    //#    Expected: {-Inf..+Inf}
    //#    Bad: {Invalid}
    //#    Attribs:  Int  Bad only invalid
    //#SmileysPlugin.java:132: Warning: test always goes same way
    //#    test predetermined because chars[i] == 0
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: String htmlEscape(String)
    //#    from bb: bb_5
    //#    live edge: bb_5-->bb_7
    //#    tested vn: undefined - 62
    //#    tested vn values: {-62}
                buf.append("&gt;");
    //#SmileysPlugin.java:133: Warning: dead code
    //#    dead code here because chars[i] == 0
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: String htmlEscape(String)
    //#    dead bb: bb_6
            } else if (chars[i] == '<') {
    //#SmileysPlugin.java:134: ?use of default init
    //#    init'ed(chars[i])
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: String htmlEscape(String)
    //#    basic block: bb_7
    //#    assertion: init'ed(chars[i])
    //#    VN: undefined
    //#    Expected: {-Inf..+Inf}
    //#    Bad: {Invalid}
    //#    Attribs:  Int  Bad only invalid
    //#SmileysPlugin.java:134: Warning: test always goes same way
    //#    test predetermined because chars[i] == 0
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: String htmlEscape(String)
    //#    from bb: bb_7
    //#    live edge: bb_7-->bb_9
    //#    tested vn: undefined - 60
    //#    tested vn values: {-60}
                buf.append("&lt;");
    //#SmileysPlugin.java:135: Warning: dead code
    //#    dead code here because chars[i] == 0
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: String htmlEscape(String)
    //#    dead bb: bb_8
            } else {
                buf.append(chars[i]);
    //#SmileysPlugin.java:137: ?use of default init
    //#    init'ed(chars[i])
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: String htmlEscape(String)
    //#    basic block: bb_9
    //#    assertion: init'ed(chars[i])
    //#    VN: undefined
    //#    Expected: {-Inf..+Inf}
    //#    Bad: {Invalid}
    //#    Attribs:  Int  Bad only invalid
            }
        }
        return buf.toString();
    //#SmileysPlugin.java:140: end of method: String org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin.htmlEscape(String)
    }
    
    /**
     * Some characters have to escaped with a backslash before
     * being compiled into a Regular Expression.
     *
     * @param smiley
     * @return
     */
    private static char[] escape_regex = new char[]
    //#SmileysPlugin.java:150: end of method: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin.org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin__static_init
    {'-', '(', ')', '\\', '|', ':', '^', '$', '*', '+', '?',
     '{', '}', '!', '=', '<', '>', '&', '[', ']' };
    
    private String regexEscape(String smiley) {
        char[] chars = smiley.toCharArray();
    //#SmileysPlugin.java:155: method: String org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin.regexEscape(String)
    //#input(String regexEscape(String)): "\"._tainted
    //#input(String regexEscape(String)): escape_regex
    //#input(String regexEscape(String)): escape_regex.length
    //#input(String regexEscape(String)): escape_regex[0..4_294_967_295]
    //#input(String regexEscape(String)): smiley
    //#output(String regexEscape(String)): java.lang.StringBuffer:toString(...)._tainted
    //#output(String regexEscape(String)): return_value
    //#new obj(String regexEscape(String)): java.lang.StringBuffer:toString(...)
    //#pre[4] (String regexEscape(String)): smiley != null
    //#pre[1] (String regexEscape(String)): (soft) escape_regex != null
    //#pre[2] (String regexEscape(String)): (soft) escape_regex.length <= 4_294_967_295
    //#pre[3] (String regexEscape(String)): (soft) init'ed(escape_regex[0..4_294_967_295])
    //#presumption(String regexEscape(String)): chars.length@155 <= 4_294_967_295
    //#post(String regexEscape(String)): java.lang.StringBuffer:toString(...)._tainted == 0
    //#post(String regexEscape(String)): return_value == &java.lang.StringBuffer:toString(...)
    //#test_vector(String regexEscape(String)): escape_regex[0..4_294_967_295]: {1..65_535}, {0}
        StringBuffer buf = new StringBuffer();
        for (int i=0; i<chars.length; i++) {
            for (int x=0; x<escape_regex.length; x++) {
                if (escape_regex[x] == chars[i]) {
    //#SmileysPlugin.java:159: ?use of default init
    //#    init'ed(chars[i])
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: String regexEscape(String)
    //#    basic block: bb_5
    //#    assertion: init'ed(chars[i])
    //#    VN: undefined
    //#    Expected: {-Inf..+Inf}
    //#    Bad: {Invalid}
    //#    Attribs:  Int  Bad only invalid
                    buf.append("\\");
                    break;
                }
            }
            buf.append(chars[i]);
    //#SmileysPlugin.java:164: ?use of default init
    //#    init'ed(chars[i])
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
    //#    method: String regexEscape(String)
    //#    basic block: bb_8
    //#    assertion: init'ed(chars[i])
    //#    VN: undefined
    //#    Expected: {-Inf..+Inf}
    //#    Bad: {Invalid}
    //#    Attribs:  Int  Bad only invalid
        }
        return buf.toString();
    //#SmileysPlugin.java:166: end of method: String org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin.regexEscape(String)
    }
    
}
    //#SmileysPlugin.java:: end of class: org.apache.roller.weblogger.business.plugins.entry.SmileysPlugin
