//# 1 errors, 537 messages
//#
/*
    //#OldUtilities.java:1:1: class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
 * 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.velocity.deprecated;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.util.DateUtil;
import org.apache.roller.util.RegexUtil;
import org.apache.roller.weblogger.util.Utilities;
import org.apache.commons.codec.binary.Base64;

/**
 * Utility methods needed by old Roller 2.X macros/templates.
 * Deprecated because they are either redundant or unnecesary.
 */
public class OldUtilities {    
    //#OldUtilities.java:41: method: void org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities()
    //#OldUtilities.java:41: end of method: void org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities()
    
    /** The <code>Log</code> instance for this class. */
    private static Log mLogger = LogFactory.getLog(OldUtilities.class);
    //#OldUtilities.java:44: method: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init
    //#OldUtilities.java:44: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): BR_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): CLOSING_A_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): CLOSING_BLOCKQUOTE_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): CLOSING_B_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): CLOSING_I_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): CLOSING_LI_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): CLOSING_OL_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): CLOSING_PRE_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): CLOSING_P_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): CLOSING_UL_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): OPENING_A_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): OPENING_BLOCKQUOTE_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): OPENING_B_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): OPENING_I_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): OPENING_LI_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): OPENING_OL_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): OPENING_PRE_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): OPENING_P_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): OPENING_UL_TAG_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): QUOTE_PATTERN
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/rendering/velocity/deprecated/OldUtilities]
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): mLinkPattern
    //#output(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): mLogger
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(BR_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(CLOSING_A_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(CLOSING_BLOCKQUOTE_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(CLOSING_B_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(CLOSING_I_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(CLOSING_LI_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(CLOSING_OL_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(CLOSING_PRE_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(CLOSING_P_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(CLOSING_UL_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(OPENING_A_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(OPENING_BLOCKQUOTE_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(OPENING_B_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(OPENING_I_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(OPENING_LI_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(OPENING_OL_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(OPENING_PRE_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(OPENING_P_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(OPENING_UL_TAG_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(QUOTE_PATTERN)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/rendering/velocity/deprecated/OldUtilities] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(mLinkPattern)
    //#post(org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init): init'ed(mLogger)
    
    private static Pattern mLinkPattern =
            Pattern.compile("<a href=.*?>", Pattern.CASE_INSENSITIVE);    
    private static final Pattern OPENING_B_TAG_PATTERN = 
            Pattern.compile("&lt;b&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern CLOSING_B_TAG_PATTERN = 
            Pattern.compile("&lt;/b&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern OPENING_I_TAG_PATTERN = 
            Pattern.compile("&lt;i&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern CLOSING_I_TAG_PATTERN = 
            Pattern.compile("&lt;/i&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern OPENING_BLOCKQUOTE_TAG_PATTERN = 
            Pattern.compile("&lt;blockquote&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern CLOSING_BLOCKQUOTE_TAG_PATTERN = 
            Pattern.compile("&lt;/blockquote&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern BR_TAG_PATTERN = 
            Pattern.compile("&lt;br */*&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern OPENING_P_TAG_PATTERN = 
            Pattern.compile("&lt;p&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern CLOSING_P_TAG_PATTERN = 
            Pattern.compile("&lt;/p&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern OPENING_PRE_TAG_PATTERN = 
            Pattern.compile("&lt;pre&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern CLOSING_PRE_TAG_PATTERN = 
            Pattern.compile("&lt;/pre&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern OPENING_UL_TAG_PATTERN = 
            Pattern.compile("&lt;ul&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern CLOSING_UL_TAG_PATTERN = 
            Pattern.compile("&lt;/ul&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern OPENING_OL_TAG_PATTERN = 
            Pattern.compile("&lt;ol&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern CLOSING_OL_TAG_PATTERN = 
            Pattern.compile("&lt;/ol&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern OPENING_LI_TAG_PATTERN = 
            Pattern.compile("&lt;li&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern CLOSING_LI_TAG_PATTERN = 
            Pattern.compile("&lt;/li&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern CLOSING_A_TAG_PATTERN = 
            Pattern.compile("&lt;/a&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern OPENING_A_TAG_PATTERN = 
            Pattern.compile("&lt;a href=.*?&gt;", Pattern.CASE_INSENSITIVE);
    private static final Pattern QUOTE_PATTERN = 
    //#OldUtilities.java:86: end of method: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities__static_init
            Pattern.compile("&quot;", Pattern.CASE_INSENSITIVE);
            
    public static boolean isEmpty(String str) {
        if (str == null) return true;
    //#OldUtilities.java:90: method: bool org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.isEmpty(String)
    //#input(bool isEmpty(String)): str
    //#output(bool isEmpty(String)): return_value
    //#post(bool isEmpty(String)): init'ed(return_value)
    //#test_vector(bool isEmpty(String)): str: Inverse{null}, Addr_Set{null}
        return "".equals(str.trim());
    //#OldUtilities.java:91: end of method: bool org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.isEmpty(String)
    }
    
    public static boolean isNotEmpty(String str) {
        return !isEmpty(str);
    //#OldUtilities.java:95: method: bool org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.isNotEmpty(String)
    //#input(bool isNotEmpty(String)): str
    //#output(bool isNotEmpty(String)): return_value
    //#post(bool isNotEmpty(String)): init'ed(return_value)
    //#unanalyzed(bool isNotEmpty(String)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(bool isNotEmpty(String)): Effects-of-calling:java.lang.String:equals
    //#OldUtilities.java:95: end of method: bool org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.isNotEmpty(String)
    }
    
    public static String[] split(String str1, String str2) {
        return StringUtils.split(str1, str2);
    //#OldUtilities.java:99: method: String[] org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.split(String, String)
    //#OldUtilities.java:99: Warning: method not available
    //#    -- call on String[] org.apache.commons.lang.StringUtils:split(String, String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String[] split(String, String)
    //#    unanalyzed callee: String[] org.apache.commons.lang.StringUtils:split(String, String)
    //#input(String[] split(String, String)): str1
    //#input(String[] split(String, String)): str2
    //#output(String[] split(String, String)): return_value
    //#post(String[] split(String, String)): init'ed(return_value)
    //#OldUtilities.java:99: end of method: String[] org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.split(String, String)
    }
    
    public static String replace(String src, String target, String rWith) {
        return StringUtils.replace(src, target, rWith);
    //#OldUtilities.java:103: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.replace(String, String, String)
    //#OldUtilities.java:103: Warning: method not available
    //#    -- call on String org.apache.commons.lang.StringUtils:replace(String, String, String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String replace(String, String, String)
    //#    unanalyzed callee: String org.apache.commons.lang.StringUtils:replace(String, String, String)
    //#input(String replace(String, String, String)): rWith
    //#input(String replace(String, String, String)): src
    //#input(String replace(String, String, String)): target
    //#output(String replace(String, String, String)): return_value
    //#post(String replace(String, String, String)): init'ed(return_value)
    //#OldUtilities.java:103: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.replace(String, String, String)
    }
    
    public static String replace(String src, String target, String rWith, int maxCount) {
        return StringUtils.replace(src, target, rWith, maxCount);
    //#OldUtilities.java:107: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.replace(String, String, String, int)
    //#OldUtilities.java:107: Warning: method not available
    //#    -- call on String org.apache.commons.lang.StringUtils:replace(String, String, String, int)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String replace(String, String, String, int)
    //#    unanalyzed callee: String org.apache.commons.lang.StringUtils:replace(String, String, String, int)
    //#input(String replace(String, String, String, int)): maxCount
    //#input(String replace(String, String, String, int)): rWith
    //#input(String replace(String, String, String, int)): src
    //#input(String replace(String, String, String, int)): target
    //#output(String replace(String, String, String, int)): return_value
    //#post(String replace(String, String, String, int)): init'ed(return_value)
    //#OldUtilities.java:107: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.replace(String, String, String, int)
    }
    
    public static boolean equals(String str1, String str2) {
        return StringUtils.equals(str1, str2);
    //#OldUtilities.java:111: method: bool org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.equals(String, String)
    //#OldUtilities.java:111: Warning: method not available
    //#    -- call on bool org.apache.commons.lang.StringUtils:equals(String, String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: bool equals(String, String)
    //#    unanalyzed callee: bool org.apache.commons.lang.StringUtils:equals(String, String)
    //#input(bool equals(String, String)): str1
    //#input(bool equals(String, String)): str2
    //#output(bool equals(String, String)): return_value
    //#post(bool equals(String, String)): init'ed(return_value)
    //#OldUtilities.java:111: end of method: bool org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.equals(String, String)
    }
    
    public static boolean isAlphanumeric(String str) {
        return StringUtils.isAlphanumeric(str);
    //#OldUtilities.java:115: method: bool org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.isAlphanumeric(String)
    //#OldUtilities.java:115: Warning: method not available
    //#    -- call on bool org.apache.commons.lang.StringUtils:isAlphanumeric(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: bool isAlphanumeric(String)
    //#    unanalyzed callee: bool org.apache.commons.lang.StringUtils:isAlphanumeric(String)
    //#input(bool isAlphanumeric(String)): str
    //#output(bool isAlphanumeric(String)): return_value
    //#post(bool isAlphanumeric(String)): init'ed(return_value)
    //#OldUtilities.java:115: end of method: bool org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.isAlphanumeric(String)
    }
    
    public static String[] stripAll(String[] strs) {
        return StringUtils.stripAll(strs);
    //#OldUtilities.java:119: method: String[] org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.stripAll(String[])
    //#OldUtilities.java:119: Warning: method not available
    //#    -- call on String[] org.apache.commons.lang.StringUtils:stripAll(String[])
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String[] stripAll(String[])
    //#    unanalyzed callee: String[] org.apache.commons.lang.StringUtils:stripAll(String[])
    //#input(String[] stripAll(String[])): strs
    //#output(String[] stripAll(String[])): return_value
    //#post(String[] stripAll(String[])): init'ed(return_value)
    //#OldUtilities.java:119: end of method: String[] org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.stripAll(String[])
    }
    
    public static String left(String str, int length) {
        return StringUtils.left(str, length);
    //#OldUtilities.java:123: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.left(String, int)
    //#OldUtilities.java:123: Warning: method not available
    //#    -- call on String org.apache.commons.lang.StringUtils:left(String, int)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String left(String, int)
    //#    unanalyzed callee: String org.apache.commons.lang.StringUtils:left(String, int)
    //#input(String left(String, int)): length
    //#input(String left(String, int)): str
    //#output(String left(String, int)): return_value
    //#post(String left(String, int)): init'ed(return_value)
    //#OldUtilities.java:123: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.left(String, int)
    }
    
    public static String escapeHTML(String str) {
        return StringEscapeUtils.escapeHtml(str);
    //#OldUtilities.java:127: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.escapeHTML(String)
    //#OldUtilities.java:127: Warning: method not available
    //#    -- call on String org.apache.commons.lang.StringEscapeUtils:escapeHtml(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String escapeHTML(String)
    //#    unanalyzed callee: String org.apache.commons.lang.StringEscapeUtils:escapeHtml(String)
    //#input(String escapeHTML(String)): str
    //#output(String escapeHTML(String)): return_value
    //#post(String escapeHTML(String)): init'ed(return_value)
    //#OldUtilities.java:127: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.escapeHTML(String)
    }
    
    public static String unescapeHTML(String str) {
        return StringEscapeUtils.unescapeHtml(str);
    //#OldUtilities.java:131: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.unescapeHTML(String)
    //#OldUtilities.java:131: Warning: method not available
    //#    -- call on String org.apache.commons.lang.StringEscapeUtils:unescapeHtml(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String unescapeHTML(String)
    //#    unanalyzed callee: String org.apache.commons.lang.StringEscapeUtils:unescapeHtml(String)
    //#input(String unescapeHTML(String)): str
    //#output(String unescapeHTML(String)): return_value
    //#post(String unescapeHTML(String)): init'ed(return_value)
    //#OldUtilities.java:131: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.unescapeHTML(String)
    }
               
    /**
     * Remove occurences of html, defined as any text
     * between the characters "&lt;" and "&gt;".  Replace
     * any HTML tags with a space.
     */
    public static String removeHTML(String str) {
        return removeHTML(str, true);
    //#OldUtilities.java:140: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.removeHTML(String)
    //#input(String removeHTML(String)): str
    //#output(String removeHTML(String)): return_value
    //#post(String removeHTML(String)): init'ed(return_value)
    //#unanalyzed(String removeHTML(String)): Effects-of-calling:org.apache.roller.weblogger.util.Utilities:removeHTML
    //#OldUtilities.java:140: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.removeHTML(String)
    }
    
    /**
     * Remove occurences of html, defined as any text
     * between the characters "&lt;" and "&gt;".
     * Optionally replace HTML tags with a space.
     */
    public static String removeHTML(String str, boolean addSpace) {
        return Utilities.removeHTML(str, addSpace);
    //#OldUtilities.java:149: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.removeHTML(String, bool)
    //#OldUtilities.java:149: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.util.Utilities:removeHTML(String, bool)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String removeHTML(String, bool)
    //#    unanalyzed callee: String org.apache.roller.weblogger.util.Utilities:removeHTML(String, bool)
    //#input(String removeHTML(String, bool)): addSpace
    //#input(String removeHTML(String, bool)): str
    //#output(String removeHTML(String, bool)): return_value
    //#post(String removeHTML(String, bool)): init'ed(return_value)
    //#OldUtilities.java:149: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.removeHTML(String, bool)
    }
        
    /**
     * Autoformat.
     */
    public static String autoformat(String s) {
        String ret = StringUtils.replace(s, "\n", "<br />");
    //#OldUtilities.java:156: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.autoformat(String)
    //#OldUtilities.java:156: Warning: method not available
    //#    -- call on String org.apache.commons.lang.StringUtils:replace(String, String, String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String autoformat(String)
    //#    unanalyzed callee: String org.apache.commons.lang.StringUtils:replace(String, String, String)
    //#input(String autoformat(String)): s
    //#output(String autoformat(String)): return_value
    //#post(String autoformat(String)): init'ed(return_value)
        return ret;
    //#OldUtilities.java:157: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.autoformat(String)
    }
    
    /**
     * Return date for current time.
     */
    public static Date getNow() {
        return new Date();
    //#OldUtilities.java:164: method: Date org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.getNow()
    //#output(Date getNow()): new Date(getNow#1) num objects
    //#output(Date getNow()): return_value
    //#new obj(Date getNow()): new Date(getNow#1)
    //#post(Date getNow()): return_value == &new Date(getNow#1)
    //#post(Date getNow()): new Date(getNow#1) num objects == 1
    //#OldUtilities.java:164: end of method: Date org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.getNow()
    }
    
    /**
     * Format date using SimpleDateFormat format string.
     */
    public static String formatDate(Date d, String fmt) {
        SimpleDateFormat format = new SimpleDateFormat(fmt);
    //#OldUtilities.java:171: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.formatDate(Date, String)
    //#input(String formatDate(Date, String)): d
    //#input(String formatDate(Date, String)): fmt
    //#output(String formatDate(Date, String)): return_value
    //#post(String formatDate(Date, String)): init'ed(return_value)
        return format.format(d);
    //#OldUtilities.java:172: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.formatDate(Date, String)
    }
    
    /**
     * Format date in ISO-8601 format.
     */
    public static String formatIso8601Date(Date d) {
        return DateUtil.formatIso8601(d);
    //#OldUtilities.java:179: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.formatIso8601Date(Date)
    //#OldUtilities.java:179: Warning: method not available
    //#    -- call on String org.apache.roller.util.DateUtil:formatIso8601(Date)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String formatIso8601Date(Date)
    //#    unanalyzed callee: String org.apache.roller.util.DateUtil:formatIso8601(Date)
    //#input(String formatIso8601Date(Date)): d
    //#output(String formatIso8601Date(Date)): return_value
    //#post(String formatIso8601Date(Date)): init'ed(return_value)
    //#OldUtilities.java:179: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.formatIso8601Date(Date)
    }
    
    /**
     * Format date in ISO-8601 format.
     */
    public static String formatIso8601Day(Date d) {
        return DateUtil.formatIso8601Day(d);
    //#OldUtilities.java:186: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.formatIso8601Day(Date)
    //#OldUtilities.java:186: Warning: method not available
    //#    -- call on String org.apache.roller.util.DateUtil:formatIso8601Day(Date)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String formatIso8601Day(Date)
    //#    unanalyzed callee: String org.apache.roller.util.DateUtil:formatIso8601Day(Date)
    //#input(String formatIso8601Day(Date)): d
    //#output(String formatIso8601Day(Date)): return_value
    //#post(String formatIso8601Day(Date)): init'ed(return_value)
    //#OldUtilities.java:186: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.formatIso8601Day(Date)
    }
    
    /**
     * Return a date in RFC-822 format.
     */
    public static String formatRfc822Date(Date date) {
        return DateUtil.formatRfc822(date);
    //#OldUtilities.java:193: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.formatRfc822Date(Date)
    //#OldUtilities.java:193: Warning: method not available
    //#    -- call on String org.apache.roller.util.DateUtil:formatRfc822(Date)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String formatRfc822Date(Date)
    //#    unanalyzed callee: String org.apache.roller.util.DateUtil:formatRfc822(Date)
    //#input(String formatRfc822Date(Date)): date
    //#output(String formatRfc822Date(Date)): return_value
    //#post(String formatRfc822Date(Date)): init'ed(return_value)
    //#OldUtilities.java:193: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.formatRfc822Date(Date)
    }
    
    /**
     * Return a date in RFC-822 format.
     */
    public static String format8charsDate(Date date) {
        return DateUtil.format8chars(date);
    //#OldUtilities.java:200: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.format8charsDate(Date)
    //#OldUtilities.java:200: Warning: method not available
    //#    -- call on String org.apache.roller.util.DateUtil:format8chars(Date)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String format8charsDate(Date)
    //#    unanalyzed callee: String org.apache.roller.util.DateUtil:format8chars(Date)
    //#input(String format8charsDate(Date)): date
    //#output(String format8charsDate(Date)): return_value
    //#post(String format8charsDate(Date)): init'ed(return_value)
    //#OldUtilities.java:200: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.format8charsDate(Date)
    }
    
    /**
     * Strips HTML and truncates.
     */
    public static String truncate(
            String str, int lower, int upper, String appendToEnd) {
        // strip markup from the string
        String str2 = removeHTML(str, false);
    //#OldUtilities.java:209: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.truncate(String, int, int, String)
    //#input(String truncate(String, int, int, String)): appendToEnd
    //#input(String truncate(String, int, int, String)): appendToEnd._tainted
    //#input(String truncate(String, int, int, String)): lower
    //#input(String truncate(String, int, int, String)): str
    //#input(String truncate(String, int, int, String)): upper
    //#output(String truncate(String, int, int, String)): java.lang.String:substring(...)._tainted
    //#output(String truncate(String, int, int, String)): java.lang.StringBuilder:toString(...)._tainted
    //#output(String truncate(String, int, int, String)): return_value
    //#new obj(String truncate(String, int, int, String)): java.lang.String:substring(...)
    //#new obj(String truncate(String, int, int, String)): java.lang.StringBuilder:toString(...)
    //#presumption(String truncate(String, int, int, String)): org.apache.roller.weblogger.util.Utilities:removeHTML(...)@149 != null
    //#post(String truncate(String, int, int, String)): java.lang.String:substring(...)._tainted == 0
    //#post(String truncate(String, int, int, String)): init'ed(java.lang.StringBuilder:toString(...)._tainted)
    //#post(String truncate(String, int, int, String)): (soft) return_value != null
    //#unanalyzed(String truncate(String, int, int, String)): Effects-of-calling:org.apache.roller.weblogger.util.Utilities:removeHTML
    //#test_vector(String truncate(String, int, int, String)): lower - upper: {-6_442_450_943..0}, {1..6_442_450_943}
        
        // quickly adjust the upper if it is set lower than 'lower'
        if (upper < lower) {
            upper = lower;
        }
        
        // now determine if the string fits within the upper limit
        // if it does, go straight to return, do not pass 'go' and collect $200
        if(str2.length() > upper) {
            // the magic location int
            int loc;
            
            // first we determine where the next space appears after lower
            loc = str2.lastIndexOf(' ', upper);
            
            // now we'll see if the location is greater than the lower limit
            if(loc >= lower) {
                // yes it was, so we'll cut it off here
                str2 = str2.substring(0, loc);
            } else {
                // no it wasnt, so we'll cut it off at the upper limit
                str2 = str2.substring(0, upper);
                loc = upper;
    //#OldUtilities.java:232: Warning: unused assignment
    //#    unused assignment into loc
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String truncate(String, int, int, String)
            }
            
            // the string was truncated, so we append the appendToEnd String
            str2 = str2 + appendToEnd;
        }
        
        return str2;
    //#OldUtilities.java:239: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.truncate(String, int, int, String)
    }
    
    public static String truncateNicely(String str, int lower, int upper, String appendToEnd) {
        return Utilities.truncateNicely(str, lower, upper, appendToEnd);
    //#OldUtilities.java:243: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.truncateNicely(String, int, int, String)
    //#OldUtilities.java:243: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.util.Utilities:truncateNicely(String, int, int, String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String truncateNicely(String, int, int, String)
    //#    unanalyzed callee: String org.apache.roller.weblogger.util.Utilities:truncateNicely(String, int, int, String)
    //#input(String truncateNicely(String, int, int, String)): appendToEnd
    //#input(String truncateNicely(String, int, int, String)): lower
    //#input(String truncateNicely(String, int, int, String)): str
    //#input(String truncateNicely(String, int, int, String)): upper
    //#output(String truncateNicely(String, int, int, String)): return_value
    //#post(String truncateNicely(String, int, int, String)): init'ed(return_value)
    //#OldUtilities.java:243: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.truncateNicely(String, int, int, String)
    }
    
    public static String truncateText(String str, int lower, int upper, String appendToEnd) {
        // strip markup from the string
        String str2 = removeHTML(str, false);
    //#OldUtilities.java:248: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.truncateText(String, int, int, String)
    //#input(String truncateText(String, int, int, String)): appendToEnd
    //#input(String truncateText(String, int, int, String)): appendToEnd._tainted
    //#input(String truncateText(String, int, int, String)): lower
    //#input(String truncateText(String, int, int, String)): str
    //#input(String truncateText(String, int, int, String)): upper
    //#output(String truncateText(String, int, int, String)): java.lang.StringBuilder:toString(...)._tainted
    //#output(String truncateText(String, int, int, String)): return_value
    //#new obj(String truncateText(String, int, int, String)): java.lang.StringBuilder:toString(...)
    //#pre[5] (String truncateText(String, int, int, String)): str != null
    //#presumption(String truncateText(String, int, int, String)): org.apache.roller.weblogger.util.Utilities:removeHTML(...)@149 != null
    //#post(String truncateText(String, int, int, String)): init'ed(java.lang.StringBuilder:toString(...)._tainted)
    //#post(String truncateText(String, int, int, String)): return_value == One-of{str, &java.lang.StringBuilder:toString(...)}
    //#post(String truncateText(String, int, int, String)): return_value != null
    //#unanalyzed(String truncateText(String, int, int, String)): Effects-of-calling:org.apache.roller.weblogger.util.Utilities:removeHTML
    //#test_vector(String truncateText(String, int, int, String)): lower - upper: {-6_442_450_943..0}, {1..6_442_450_943}
        boolean diff = (str2.length() < str.length());
    //#OldUtilities.java:249: Warning: unused assignment
    //#    unused assignment into diff
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String truncateText(String, int, int, String)
        
        // quickly adjust the upper if it is set lower than 'lower'
        if(upper < lower) {
            upper = lower;
        }
        
        // now determine if the string fits within the upper limit
        // if it does, go straight to return, do not pass 'go' and collect $200
        if(str2.length() > upper) {
            // the magic location int
            int loc;
            
            // first we determine where the next space appears after lower
            loc = str2.lastIndexOf(' ', upper);
            
            // now we'll see if the location is greater than the lower limit
            if(loc >= lower) {
                // yes it was, so we'll cut it off here
                str2 = str2.substring(0, loc);
            } else {
                // no it wasnt, so we'll cut it off at the upper limit
                str2 = str2.substring(0, upper);
                loc = upper;
    //#OldUtilities.java:272: Warning: unused assignment
    //#    unused assignment into loc
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String truncateText(String, int, int, String)
            }
            // the string was truncated, so we append the appendToEnd String
            str = str2 + appendToEnd;
        }
        return str;
    //#OldUtilities.java:277: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.truncateText(String, int, int, String)
    }    
    
    public static String hexEncode(String str) {
        if (StringUtils.isEmpty(str)) return str;
    //#OldUtilities.java:281: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.hexEncode(String)
    //#OldUtilities.java:281: Warning: method not available
    //#    -- call on bool org.apache.commons.lang.StringUtils:isEmpty(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String hexEncode(String)
    //#    unanalyzed callee: bool org.apache.commons.lang.StringUtils:isEmpty(String)
    //#input(String hexEncode(String)): str
    //#output(String hexEncode(String)): return_value
    //#post(String hexEncode(String)): init'ed(return_value)
    //#test_vector(String hexEncode(String)): org.apache.commons.lang.StringUtils:isEmpty(...)@281: {0}, {1}
        
        return RegexUtil.encode(str);
    //#OldUtilities.java:283: Warning: method not available
    //#    -- call on String org.apache.roller.util.RegexUtil:encode(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String hexEncode(String)
    //#    unanalyzed callee: String org.apache.roller.util.RegexUtil:encode(String)
    //#OldUtilities.java:283: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.hexEncode(String)
    }
    
    public static String encodeEmail(String str) {
        return str!=null ? RegexUtil.encodeEmail(str) : null;
    //#OldUtilities.java:287: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.encodeEmail(String)
    //#OldUtilities.java:287: Warning: method not available
    //#    -- call on String org.apache.roller.util.RegexUtil:encodeEmail(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String encodeEmail(String)
    //#    unanalyzed callee: String org.apache.roller.util.RegexUtil:encodeEmail(String)
    //#input(String encodeEmail(String)): str
    //#output(String encodeEmail(String)): return_value
    //#post(String encodeEmail(String)): init'ed(return_value)
    //#OldUtilities.java:287: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.encodeEmail(String)
    }
    
    /**
     * URL encoding.
     * @param s a string to be URL-encoded
     * @return URL encoding of s using character encoding UTF-8; null if s is null.
     */
    public static final String encode(String s) {
        try {
            if (s != null)
    //#OldUtilities.java:297: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.encode(String)
    //#input(String encode(String)): s
    //#output(String encode(String)): return_value
    //#post(String encode(String)): init'ed(return_value)
    //#test_vector(String encode(String)): s: Addr_Set{null}, Inverse{null}
                return URLEncoder.encode(s, "UTF-8");
            else
                return s;
        } catch (UnsupportedEncodingException e) {
            // Java Spec requires UTF-8 be in all Java environments, so this should not happen
            return s;
    //#OldUtilities.java:303: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.encode(String)
        }
    }
    
    /**
     * URL decoding.
     * @param s a URL-encoded string to be URL-decoded
     * @return URL decoded value of s using character encoding UTF-8; null if s is null.
     */
    public static final String decode(String s) {
        try {
            if (s != null)
    //#OldUtilities.java:314: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.decode(String)
    //#input(String decode(String)): s
    //#output(String decode(String)): return_value
    //#post(String decode(String)): init'ed(return_value)
    //#test_vector(String decode(String)): s: Addr_Set{null}, Inverse{null}
                return URLDecoder.decode(s, "UTF-8");
            else
                return s;
        } catch (UnsupportedEncodingException e) {
            // Java Spec requires UTF-8 be in all Java environments, so this should not happen
            return s;
    //#OldUtilities.java:320: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.decode(String)
        }
    }
        
    /**
     * Code (stolen from Pebble) to add rel="nofollow" string to all links in HTML.
     */
    public static String addNofollow(String html) {
        if (html == null || html.length() == 0) {
    //#OldUtilities.java:328: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.addNofollow(String)
    //#input(String addNofollow(String)): " rel="nofollow">"._tainted
    //#input(String addNofollow(String)): html
    //#input(String addNofollow(String)): html._tainted
    //#input(String addNofollow(String)): mLinkPattern
    //#output(String addNofollow(String)): java.lang.StringBuffer:toString(...)._tainted
    //#output(String addNofollow(String)): return_value
    //#new obj(String addNofollow(String)): java.lang.StringBuffer:toString(...)
    //#pre[3] (String addNofollow(String)): (soft) mLinkPattern != null
    //#presumption(String addNofollow(String)): java.util.regex.Pattern:matcher(...)@331 != null
    //#post(String addNofollow(String)): init'ed(java.lang.StringBuffer:toString(...)._tainted)
    //#post(String addNofollow(String)): return_value == One-of{html, &java.lang.StringBuffer:toString(...)}
    //#post(String addNofollow(String)): init'ed(return_value)
    //#test_vector(String addNofollow(String)): html: Addr_Set{null}, Inverse{null}
    //#test_vector(String addNofollow(String)): java.lang.String:indexOf(...)@338: {-2_147_483_648..-2, 0..4_294_967_295}, {-1}
    //#test_vector(String addNofollow(String)): java.lang.String:length(...)@328: {1..4_294_967_295}, {0}
    //#test_vector(String addNofollow(String)): java.util.regex.Matcher:find(...)@333: {0}, {1}
            return html;
        }
        Matcher m = mLinkPattern.matcher(html);
        StringBuffer buf = new StringBuffer();
        while (m.find()) {
            int start = m.start();
            int end = m.end();
            String link = html.substring(start, end);
            buf.append(html.substring(0, start));
            if (link.indexOf("rel=\"nofollow\"") == -1) {
                buf.append(
                        link.substring(0, link.length() - 1) + " rel=\"nofollow\">");
            } else {
                buf.append(link);
            }
            html = html.substring(end, html.length());
            m = mLinkPattern.matcher(html);
        }
        buf.append(html);
        return buf.toString();
    //#OldUtilities.java:348: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.addNofollow(String)
    }
    
    /**
     * Transforms the given String into a subset of HTML displayable on a web
     * page. The subset includes &lt;b&gt;, &lt;i&gt;, &lt;p&gt;, &lt;br&gt;,
     * &lt;pre&gt; and &lt;a href&gt; (and their corresponding end tags).
     *
     * @param s   the String to transform
     * @return    the transformed String
     */
    public static String transformToHTMLSubset(String s) {
        
        if (s == null) {
    //#OldUtilities.java:361: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.transformToHTMLSubset(String)
    //#input(String transformToHTMLSubset(String)): "<"._tainted
    //#input(String transformToHTMLSubset(String)): ">"._tainted
    //#input(String transformToHTMLSubset(String)): BR_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): CLOSING_A_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): CLOSING_BLOCKQUOTE_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): CLOSING_B_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): CLOSING_I_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): CLOSING_LI_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): CLOSING_OL_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): CLOSING_PRE_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): CLOSING_P_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): CLOSING_UL_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): OPENING_A_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): OPENING_BLOCKQUOTE_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): OPENING_B_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): OPENING_I_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): OPENING_LI_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): OPENING_OL_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): OPENING_PRE_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): OPENING_P_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): OPENING_UL_TAG_PATTERN
    //#input(String transformToHTMLSubset(String)): QUOTE_PATTERN
    //#input(String transformToHTMLSubset(String)): s
    //#input(String transformToHTMLSubset(String)): s._tainted
    //#output(String transformToHTMLSubset(String)): java.lang.StringBuilder:toString(...)._tainted
    //#output(String transformToHTMLSubset(String)): return_value
    //#new obj(String transformToHTMLSubset(String)): java.lang.StringBuilder:toString(...)
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Matcher:replaceAll(...)@406 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@48 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@50 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@52 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@54 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@56 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@58 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@60 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@62 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@64 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@66 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@68 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@70 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@72 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@74 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@76 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@78 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@80 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@82 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@84 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:compile(...)@86 != null
    //#presumption(String transformToHTMLSubset(String)): java.util.regex.Pattern:matcher(...)@386 != null
    //#post(String transformToHTMLSubset(String)): init'ed(java.lang.StringBuilder:toString(...)._tainted)
    //#post(String transformToHTMLSubset(String)): init'ed(return_value)
    //#unanalyzed(String transformToHTMLSubset(String)): Effects-of-calling:java.util.regex.Pattern:matcher
    //#unanalyzed(String transformToHTMLSubset(String)): Effects-of-calling:java.util.regex.Matcher:replaceAll
    //#test_vector(String transformToHTMLSubset(String)): s: Inverse{null}, Addr_Set{null}
    //#test_vector(String transformToHTMLSubset(String)): java.util.regex.Matcher:find(...)@387: {0}, {1}
            return null;
        }
        
        s = replace(s, OPENING_B_TAG_PATTERN, "<b>");
        s = replace(s, CLOSING_B_TAG_PATTERN, "</b>");
        s = replace(s, OPENING_I_TAG_PATTERN, "<i>");
        s = replace(s, CLOSING_I_TAG_PATTERN, "</i>");
        s = replace(s, OPENING_BLOCKQUOTE_TAG_PATTERN, "<blockquote>");
        s = replace(s, CLOSING_BLOCKQUOTE_TAG_PATTERN, "</blockquote>");
        s = replace(s, BR_TAG_PATTERN, "<br />");
        s = replace(s, OPENING_P_TAG_PATTERN, "<p>");
        s = replace(s, CLOSING_P_TAG_PATTERN, "</p>");
        s = replace(s, OPENING_PRE_TAG_PATTERN, "<pre>");
        s = replace(s, CLOSING_PRE_TAG_PATTERN, "</pre>");
        s = replace(s, OPENING_UL_TAG_PATTERN, "<ul>");
        s = replace(s, CLOSING_UL_TAG_PATTERN, "</ul>");
        s = replace(s, OPENING_OL_TAG_PATTERN, "<ol>");
        s = replace(s, CLOSING_OL_TAG_PATTERN, "</ol>");
        s = replace(s, OPENING_LI_TAG_PATTERN, "<li>");
        s = replace(s, CLOSING_LI_TAG_PATTERN, "</li>");
        s = replace(s, QUOTE_PATTERN, "\"");
        
        // HTTP links
        s = replace(s, CLOSING_A_TAG_PATTERN, "</a>");
        Matcher m = OPENING_A_TAG_PATTERN.matcher(s);
        while (m.find()) {
            int start = m.start();
            int end = m.end();
            String link = s.substring(start, end);
            link = "<" + link.substring(4, link.length() - 4) + ">";
            s = s.substring(0, start) + link + s.substring(end, s.length());
            m = OPENING_A_TAG_PATTERN.matcher(s);
        }
        
        // escaped angle brackets
        s = s.replaceAll("&amp;lt;", "&lt;");
        s = s.replaceAll("&amp;gt;", "&gt;");
        s = s.replaceAll("&amp;#", "&#");
        
        return s;
    //#OldUtilities.java:401: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.transformToHTMLSubset(String)
    }
    
    private static String replace(String string, Pattern pattern, String replacement) {
        Matcher m = pattern.matcher(string);
    //#OldUtilities.java:405: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.replace(String, Pattern, String)
    //#input(String replace(String, Pattern, String)): pattern
    //#input(String replace(String, Pattern, String)): replacement
    //#input(String replace(String, Pattern, String)): string
    //#output(String replace(String, Pattern, String)): return_value
    //#pre[1] (String replace(String, Pattern, String)): pattern != null
    //#presumption(String replace(String, Pattern, String)): java.util.regex.Pattern:matcher(...)@405 != null
    //#post(String replace(String, Pattern, String)): init'ed(return_value)
        return m.replaceAll(replacement);
    //#OldUtilities.java:406: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.replace(String, Pattern, String)
    }
    
    /**
     * Convert a byte array into a Base64 string (as used in mime formats)
     */
    public static String toBase64(byte[] aValue) {
        
        final String m_strBase64Chars =
    //#OldUtilities.java:414: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.toBase64(byte[])
    //#OldUtilities.java:414: Warning: unused assignment
    //#    unused assignment into m_strBase64Chars
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String toBase64(byte[])
    //#OldUtilities.java:414: Warning: suspicious precondition
    //#    the precondition for aValue.length is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String toBase64(byte[])
    //#    suspicious precondition index: [2]
    //#    Attribs:  Soft
    //#input(String toBase64(byte[])): aValue
    //#input(String toBase64(byte[])): aValue.length
    //#input(String toBase64(byte[])): aValue[0..4_294_967_295]
    //#output(String toBase64(byte[])): java.lang.StringBuffer:toString(...)._tainted
    //#output(String toBase64(byte[])): return_value
    //#new obj(String toBase64(byte[])): java.lang.StringBuffer:toString(...)
    //#pre[1] (String toBase64(byte[])): aValue != null
    //#pre[2] (String toBase64(byte[])): (soft) aValue.length in {0, 3..4_294_967_295}
    //#pre[3] (String toBase64(byte[])): (soft) init'ed(aValue[0..4_294_967_295])
    //#post(String toBase64(byte[])): java.lang.StringBuffer:toString(...)._tainted == 0
    //#post(String toBase64(byte[])): return_value == &java.lang.StringBuffer:toString(...)
                "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
        
        int byte1;
        int byte2;
        int byte3;
        int iByteLen = aValue.length;
        StringBuffer tt = new StringBuffer();
        
        for (int i = 0; i < iByteLen; i += 3) {
    //#OldUtilities.java:423: ?overflow
    //#    i in -2_147_483_651..4_294_967_292
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String toBase64(byte[])
    //#    basic block: bb_21
    //#    assertion: i in -2_147_483_651..4_294_967_292
    //#    VN: i + 3
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {4_294_967_296,4_294_967_297}
    //#    Attribs:  Int  Bad > Exp
            boolean bByte2 = (i + 1) < iByteLen;
            boolean bByte3 = (i + 2) < iByteLen;
            byte1 = aValue[i] & 0xFF;
            byte2 = (bByte2) ? (aValue[i + 1] & 0xFF) : 0;
            byte3 = (bByte3) ? (aValue[i + 2] & 0xFF) : 0;
            
            tt.append(m_strBase64Chars.charAt(byte1 / 4));
            tt.append(m_strBase64Chars.charAt((byte2 / 16) + ((byte1 & 0x3) * 16)));
            tt.append(((bByte2) ? m_strBase64Chars.charAt((byte3 / 64) + ((byte2 & 0xF) * 4)) : '='));
            tt.append(((bByte3) ? m_strBase64Chars.charAt(byte3 & 0x3F) : '='));
        }
        
        return tt.toString();
    //#OldUtilities.java:436: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.toBase64(byte[])
    }
    
    
    //------------------------------------------------------------------------
    /**
     * Escape, but do not replace HTML.
     * @param escapeAmpersand Optionally escape
     * ampersands (&amp;).
     */
    public static String escapeHTML(String s, boolean escapeAmpersand) {
        return Utilities.escapeHTML(s, escapeAmpersand);
    //#OldUtilities.java:447: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.escapeHTML(String, bool)
    //#OldUtilities.java:447: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.util.Utilities:escapeHTML(String, bool)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String escapeHTML(String, bool)
    //#    unanalyzed callee: String org.apache.roller.weblogger.util.Utilities:escapeHTML(String, bool)
    //#input(String escapeHTML(String, bool)): escapeAmpersand
    //#input(String escapeHTML(String, bool)): s
    //#output(String escapeHTML(String, bool)): return_value
    //#post(String escapeHTML(String, bool)): init'ed(return_value)
    //#OldUtilities.java:447: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.escapeHTML(String, bool)
    }
                
    //------------------------------------------------------------------------
    /**
     * Replace occurrences of str1 in string str with str2
     */
    public static String stringReplace(String str, String str1, String str2) {
        String ret = StringUtils.replace(str,str1,str2);
    //#OldUtilities.java:455: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.stringReplace(String, String, String)
    //#OldUtilities.java:455: Warning: method not available
    //#    -- call on String org.apache.commons.lang.StringUtils:replace(String, String, String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String stringReplace(String, String, String)
    //#    unanalyzed callee: String org.apache.commons.lang.StringUtils:replace(String, String, String)
    //#input(String stringReplace(String, String, String)): str
    //#input(String stringReplace(String, String, String)): str1
    //#input(String stringReplace(String, String, String)): str2
    //#output(String stringReplace(String, String, String)): return_value
    //#post(String stringReplace(String, String, String)): init'ed(return_value)
        return ret;
    //#OldUtilities.java:456: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.stringReplace(String, String, String)
    }
    
    //------------------------------------------------------------------------
    /**
     * Replace occurrences of str1 in string str with str2
     * @param str String to operate on
     * @param str1 String to be replaced
     * @param str2 String to be used as replacement
     * @param maxCount Number of times to replace, 0 for all
     */
    public static String stringReplace(
            String str,
            String str1,
            String str2,
            int maxCount) {
        String ret = StringUtils.replace(str,str1,str2,maxCount);
    //#OldUtilities.java:472: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.stringReplace(String, String, String, int)
    //#OldUtilities.java:472: Warning: method not available
    //#    -- call on String org.apache.commons.lang.StringUtils:replace(String, String, String, int)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String stringReplace(String, String, String, int)
    //#    unanalyzed callee: String org.apache.commons.lang.StringUtils:replace(String, String, String, int)
    //#input(String stringReplace(String, String, String, int)): maxCount
    //#input(String stringReplace(String, String, String, int)): str
    //#input(String stringReplace(String, String, String, int)): str1
    //#input(String stringReplace(String, String, String, int)): str2
    //#output(String stringReplace(String, String, String, int)): return_value
    //#post(String stringReplace(String, String, String, int)): init'ed(return_value)
        return ret;
    //#OldUtilities.java:473: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.stringReplace(String, String, String, int)
    }
        

    
    /**
     * Encode a string using Base64 encoding. Used when storing passwords
     * as cookies.
     *
     * This is weak encoding in that anyone can use the decodeString
     * routine to reverse the encoding.
     *
     * @param str
     * @return String
     * @throws IOException
     */
    public static String encodeString(String str) throws IOException {
        Base64 base64 = new Base64();
    //#OldUtilities.java:490: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.encodeString(String)
    //#OldUtilities.java:490: Warning: unused assignment
    //#    unused assignment into base64
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String encodeString(String)
    //#OldUtilities.java:490: Warning: method not available
    //#    -- call on void org.apache.commons.codec.binary.Base64()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String encodeString(String)
    //#    unanalyzed callee: void org.apache.commons.codec.binary.Base64()
    //#input(String encodeString(String)): str
    //#output(String encodeString(String)): return_value
    //#pre[1] (String encodeString(String)): str != null
    //#post(String encodeString(String)): return_value != null
        String encodedStr = new String(base64.encodeBase64(str.getBytes()));        
    //#OldUtilities.java:491: Warning: method not available
    //#    -- call on byte[] org.apache.commons.codec.binary.Base64:encodeBase64(byte[])
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String encodeString(String)
    //#    unanalyzed callee: byte[] org.apache.commons.codec.binary.Base64:encodeBase64(byte[])
        return (encodedStr.trim());
    //#OldUtilities.java:492: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.encodeString(String)
    }
    
    /**
     * Decode a string using Base64 encoding.
     *
     * @param str
     * @return String
     * @throws IOException
     */
    public static String decodeString(String str) throws IOException {
        Base64 base64 = new Base64();
    //#OldUtilities.java:503: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.decodeString(String)
    //#OldUtilities.java:503: Warning: unused assignment
    //#    unused assignment into base64
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String decodeString(String)
    //#OldUtilities.java:503: Warning: method not available
    //#    -- call on void org.apache.commons.codec.binary.Base64()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String decodeString(String)
    //#    unanalyzed callee: void org.apache.commons.codec.binary.Base64()
    //#input(String decodeString(String)): str
    //#output(String decodeString(String)): new String(decodeString#2) num objects
    //#output(String decodeString(String)): return_value
    //#new obj(String decodeString(String)): new String(decodeString#2)
    //#pre[1] (String decodeString(String)): str != null
    //#post(String decodeString(String)): return_value == &new String(decodeString#2)
    //#post(String decodeString(String)): new String(decodeString#2) num objects == 1
        String value = new String(base64.decodeBase64(str.getBytes()));        
    //#OldUtilities.java:504: Warning: method not available
    //#    -- call on byte[] org.apache.commons.codec.binary.Base64:decodeBase64(byte[])
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
    //#    method: String decodeString(String)
    //#    unanalyzed callee: byte[] org.apache.commons.codec.binary.Base64:decodeBase64(byte[])
        return (value);
    //#OldUtilities.java:505: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.decodeString(String)
    }
               
    /**
     * @param str
     * @return
     */
    private static String stripLineBreaks(String str) {
        // TODO: use a string buffer, ignore case !
        str = str.replaceAll("<br>", "");
    //#OldUtilities.java:514: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.stripLineBreaks(String)
    //#input(String stripLineBreaks(String)): str
    //#output(String stripLineBreaks(String)): return_value
    //#pre[1] (String stripLineBreaks(String)): str != null
    //#post(String stripLineBreaks(String)): return_value != null
        str = str.replaceAll("<br/>", "");
        str = str.replaceAll("<br />", "");
        str = str.replaceAll("<p></p>", "");
        str = str.replaceAll("<p/>","");
        str = str.replaceAll("<p />","");
        return str;
    //#OldUtilities.java:520: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.stripLineBreaks(String)
    }
    
    /**
     * Need need to get rid of any user-visible HTML tags once all text has been
     * removed such as &lt;BR&gt;. This sounds like a better approach than removing
     * all HTML tags and taking the chance to leave some tags un-closed.
     *
     * WARNING: this method has serious performance problems a
     *
     * @author Alexis Moussine-Pouchkine (alexis.moussine-pouchkine@france.sun.com)
     * @author Lance Lavandowska
     * @param str the String object to modify
     * @return the new String object without the HTML "visible" tags
     */
    private static String removeVisibleHTMLTags(String str) {
        str = stripLineBreaks(str);
    //#OldUtilities.java:536: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.removeVisibleHTMLTags(String)
    //#input(String removeVisibleHTMLTags(String)): "<"._tainted
    //#input(String removeVisibleHTMLTags(String)): "<."._tainted
    //#input(String removeVisibleHTMLTags(String)): ">"._tainted
    //#input(String removeVisibleHTMLTags(String)): "a"._tainted
    //#input(String removeVisibleHTMLTags(String)): "div"._tainted
    //#input(String removeVisibleHTMLTags(String)): "h1"._tainted
    //#input(String removeVisibleHTMLTags(String)): "h2"._tainted
    //#input(String removeVisibleHTMLTags(String)): "h3"._tainted
    //#input(String removeVisibleHTMLTags(String)): "h4"._tainted
    //#input(String removeVisibleHTMLTags(String)): "li"._tainted
    //#input(String removeVisibleHTMLTags(String)): str
    //#input(String removeVisibleHTMLTags(String)): str._tainted
    //#output(String removeVisibleHTMLTags(String)): java.lang.StringBuffer:toString(...)._tainted
    //#output(String removeVisibleHTMLTags(String)): return_value
    //#new obj(String removeVisibleHTMLTags(String)): java.lang.StringBuffer:toString(...)
    //#pre[1] (String removeVisibleHTMLTags(String)): str != null
    //#presumption(String removeVisibleHTMLTags(String)): java.lang.StringBuffer:indexOf(...)@544 + java.lang.String:length(...)@546 in -2_147_483_648..4_294_967_295
    //#presumption(String removeVisibleHTMLTags(String)): java.lang.StringBuffer:indexOf(...)@544 + java.lang.String:length(...)@547 in -2_147_483_648..4_294_967_295
    //#presumption(String removeVisibleHTMLTags(String)): java.lang.StringBuffer:indexOf(...)@550 <= 4_294_967_294
    //#presumption(String removeVisibleHTMLTags(String)): java.lang.StringBuffer:indexOf(...)@568 <= 4_294_967_294
    //#presumption(String removeVisibleHTMLTags(String)): java.lang.StringBuffer:indexOf(...)@571 + java.lang.String:length(...)@574 in -2_147_483_648..4_294_967_295
    //#presumption(String removeVisibleHTMLTags(String)): java.lang.StringBuffer:indexOf(...)@571 + java.lang.String:length(...)@575 in -2_147_483_648..4_294_967_295
    //#presumption(String removeVisibleHTMLTags(String)): java.lang.StringBuffer:indexOf(...)@578 <= 4_294_967_294
    //#post(String removeVisibleHTMLTags(String)): init'ed(java.lang.StringBuffer:toString(...)._tainted)
    //#post(String removeVisibleHTMLTags(String)): return_value == &java.lang.StringBuffer:toString(...)
    //#unanalyzed(String removeVisibleHTMLTags(String)): Effects-of-calling:java.lang.String:replaceAll
    //#test_vector(String removeVisibleHTMLTags(String)): java.lang.String:endsWith(...)@545: {0}, {1}
    //#test_vector(String removeVisibleHTMLTags(String)): java.lang.StringBuffer:charAt(...)@580: {0..46, 48..65_535}, {47}
    //#test_vector(String removeVisibleHTMLTags(String)): java.lang.StringBuffer:indexOf(...)@544: {-1}, {-2_147_483_648..-2, 0..4_294_967_295}
    //#test_vector(String removeVisibleHTMLTags(String)): java.lang.StringBuffer:indexOf(...)@550: {-2_147_483_648..-1}, {0..4_294_967_294}
    //#test_vector(String removeVisibleHTMLTags(String)): java.lang.StringBuffer:indexOf(...)@568: {-2_147_483_648..-1}, {0..4_294_967_293}
    //#test_vector(String removeVisibleHTMLTags(String)): java.lang.StringBuffer:indexOf(...)@571: {-2_147_483_648..-1}, {0..4_294_967_295}
    //#test_vector(String removeVisibleHTMLTags(String)): java.lang.StringBuffer:indexOf(...)@579: {-2_147_483_648..-2, 0..4_294_967_294}, {-1}
        StringBuffer result = new StringBuffer(str);
        StringBuffer lcresult = new StringBuffer(str.toLowerCase());
        
        // <img should take care of smileys
        String[] visibleTags = {"<img"}; // are there others to add?
        int stringIndex;
        for ( int j = 0 ;  j < visibleTags.length ; j++ ) {
            while ( (stringIndex = lcresult.indexOf(visibleTags[j])) != -1 ) {
                if ( visibleTags[j].endsWith(">") )  {
                    result.delete(stringIndex, stringIndex+visibleTags[j].length() );
                    lcresult.delete(stringIndex, stringIndex+visibleTags[j].length() );
                } else {
                    // need to delete everything up until next closing '>', for <img for instance
                    int endIndex = result.indexOf(">", stringIndex);
                    if (endIndex > -1) {
                        // only delete it if we find the end!  If we don't the HTML may be messed up, but we
                        // can't safely delete anything.
                        result.delete(stringIndex, endIndex + 1 );
                        lcresult.delete(stringIndex, endIndex + 1 );
                    }
                }
            }
        }
        
        // TODO:  This code is buggy by nature.  It doesn't deal with nesting of tags properly.
        // remove certain elements with open & close tags
        String[] openCloseTags = {"li", "a", "div", "h1", "h2", "h3", "h4"}; // more ?
        for (int j = 0; j < openCloseTags.length; j++) {
            // could this be better done with a regular expression?
            String closeTag = "</"+openCloseTags[j]+">";
            int lastStringIndex = 0;
            while ( (stringIndex = lcresult.indexOf( "<"+openCloseTags[j], lastStringIndex)) > -1) {
                lastStringIndex = stringIndex;
                // Try to find the matching closing tag  (ignores possible nesting!)
                int endIndex = lcresult.indexOf(closeTag, stringIndex);
                if (endIndex > -1) {
                    // If we found it delete it.
                    result.delete(stringIndex, endIndex+closeTag.length());
                    lcresult.delete(stringIndex, endIndex+closeTag.length());
                } else {
                    // Try to see if it is a self-closed empty content tag, i.e. closed with />.
                    endIndex = lcresult.indexOf(">", stringIndex);
                    int nextStart = lcresult.indexOf("<", stringIndex+1);
                    if (endIndex > stringIndex && lcresult.charAt(endIndex-1) == '/' && (endIndex < nextStart || nextStart == -1)) {
                        // Looks like it, so remove it.
                        result.delete(stringIndex, endIndex + 1);
                        lcresult.delete(stringIndex, endIndex + 1);
                        
                    }
                }
            }
        }
        
        return result.toString();
    //#OldUtilities.java:590: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.removeVisibleHTMLTags(String)
    }
    
    
    /**
     * Converts a character to HTML or XML entity.
     *
     * @param ch The character to convert.
     * @param xml Convert the character to XML if set to true.
     * @author Erik C. Thauvin
     *
     * @return The converted string.
     */
    public static final String charToHTML(char ch, boolean xml) {
        int c;
        
        // Convert left bracket
        if (ch == '<') {
    //#OldUtilities.java:607: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.charToHTML(char, bool)
    //#input(String charToHTML(char, bool)): ch
    //#input(String charToHTML(char, bool)): xml
    //#output(String charToHTML(char, bool)): java.lang.String:valueOf(...)._tainted
    //#output(String charToHTML(char, bool)): return_value
    //#new obj(String charToHTML(char, bool)): java.lang.String:valueOf(...)
    //#post(String charToHTML(char, bool)): java.lang.String:valueOf(...)._tainted == 0
    //#post(String charToHTML(char, bool)): return_value in Addr_Set{&"&amp;quot;",&"&amp;#39;",&java.lang.String:valueOf(...),&"&amp;amp;",&"&amp;gt;",&"&amp;lt;"}
    //#test_vector(String charToHTML(char, bool)): ch: {39}, {60}, {62}, {38}, {34}
    //#test_vector(String charToHTML(char, bool)): xml: {0}, {1}
            return ("&lt;");
        }
        
        // Convert left bracket
        else if (ch == '>') {
            return ("&gt;");
        }
        
        // Convert ampersand
        else if (ch == '&') {
            return ("&amp;");
        }
        
        // Commented out to eliminate redundant numeric character codes (ROL-507)
        // High-ASCII character
        //else if (ch >= 128)
        //{
        //c = ch;
        //return ("&#" + c + ';');
        //}
        
        // Convert double quote
        else if (xml && (ch == '"')) {
            return ("&quot;");
        }
        
        // Convert single quote
        else if (xml && (ch == '\'')) {
            return ("&#39;");
        }
        
        // No conversion
        else {
            // Return character as string
            return (String.valueOf(ch));
    //#OldUtilities.java:642: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.charToHTML(char, bool)
        }
    }
    
    /**
     * Converts a text string to HTML or XML entities.
     *
     * @author Erik C. Thauvin
     * @param text The string to convert.
     * @param xml Convert the string to XML if set to true.
     *
     * @return The converted string.
     */
    public static final String textToHTML(String text, boolean xml) {
        if (text == null) return "null";
    //#OldUtilities.java:656: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.textToHTML(String, bool)
    //#input(String textToHTML(String, bool)): "&amp;#39;"._tainted
    //#input(String textToHTML(String, bool)): "&amp;amp;"._tainted
    //#input(String textToHTML(String, bool)): "&amp;gt;"._tainted
    //#input(String textToHTML(String, bool)): "&amp;lt;"._tainted
    //#input(String textToHTML(String, bool)): "&amp;quot;"._tainted
    //#input(String textToHTML(String, bool)): text
    //#input(String textToHTML(String, bool)): xml
    //#output(String textToHTML(String, bool)): java.lang.StringBuffer:toString(...)._tainted
    //#output(String textToHTML(String, bool)): return_value
    //#new obj(String textToHTML(String, bool)): java.lang.StringBuffer:toString(...)
    //#post(String textToHTML(String, bool)): init'ed(java.lang.StringBuffer:toString(...)._tainted)
    //#post(String textToHTML(String, bool)): return_value in Addr_Set{&java.lang.StringBuffer:toString(...),&"null"}
    //#unanalyzed(String textToHTML(String, bool)): Effects-of-calling:java.lang.String:valueOf
    //#test_vector(String textToHTML(String, bool)): text: Inverse{null}, Addr_Set{null}
        final StringBuffer html = new StringBuffer();
        
        // Loop thru each characters of the text
        for (int i = 0; i < text.length(); i++) {
            // Convert character to HTML/XML
            html.append(charToHTML(text.charAt(i), xml));
        }
        
        // Return HTML/XML string
        return html.toString();
    //#OldUtilities.java:666: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.textToHTML(String, bool)
    }
    
    /**
     * Converts a text string to HTML or XML entities.
     *
     * @param text The string to convert.
     * @author Erik C. Thauvin
     * @return The converted string.
     */
    public static final String textToHTML(String text) {
        return textToHTML(text, false);
    //#OldUtilities.java:677: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.textToHTML(String)
    //#input(String textToHTML(String)): "&amp;#39;"._tainted
    //#input(String textToHTML(String)): "&amp;amp;"._tainted
    //#input(String textToHTML(String)): "&amp;gt;"._tainted
    //#input(String textToHTML(String)): "&amp;lt;"._tainted
    //#input(String textToHTML(String)): "&amp;quot;"._tainted
    //#input(String textToHTML(String)): text
    //#output(String textToHTML(String)): java.lang.StringBuffer:toString(...)._tainted
    //#output(String textToHTML(String)): return_value
    //#new obj(String textToHTML(String)): java.lang.StringBuffer:toString(...)
    //#post(String textToHTML(String)): init'ed(java.lang.StringBuffer:toString(...)._tainted)
    //#post(String textToHTML(String)): return_value == One-of{&"null", &java.lang.StringBuffer:toString(...)}
    //#post(String textToHTML(String)): return_value in Addr_Set{&"null",&java.lang.StringBuffer:toString(...)}
    //#unanalyzed(String textToHTML(String)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(String textToHTML(String)): Effects-of-calling:java.lang.StringBuffer
    //#unanalyzed(String textToHTML(String)): Effects-of-calling:java.lang.StringBuffer:append
    //#unanalyzed(String textToHTML(String)): Effects-of-calling:java.lang.StringBuffer:toString
    //#unanalyzed(String textToHTML(String)): Effects-of-calling:java.lang.String:charAt
    //#unanalyzed(String textToHTML(String)): Effects-of-calling:java.lang.String:valueOf
    //#OldUtilities.java:677: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.textToHTML(String)
    }
    
    /**
     * Converts a text string to XML entities.
     *
     * @param text The string to convert.
     * @author Erik C. Thauvin
     * @return The converted string.
     */
    public static final String textToXML(String text) {
        return textToHTML(text, true);
    //#OldUtilities.java:688: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.textToXML(String)
    //#input(String textToXML(String)): "&amp;#39;"._tainted
    //#input(String textToXML(String)): "&amp;amp;"._tainted
    //#input(String textToXML(String)): "&amp;gt;"._tainted
    //#input(String textToXML(String)): "&amp;lt;"._tainted
    //#input(String textToXML(String)): "&amp;quot;"._tainted
    //#input(String textToXML(String)): text
    //#output(String textToXML(String)): java.lang.StringBuffer:toString(...)._tainted
    //#output(String textToXML(String)): return_value
    //#new obj(String textToXML(String)): java.lang.StringBuffer:toString(...)
    //#post(String textToXML(String)): init'ed(java.lang.StringBuffer:toString(...)._tainted)
    //#post(String textToXML(String)): return_value == One-of{&"null", &java.lang.StringBuffer:toString(...)}
    //#post(String textToXML(String)): return_value in Addr_Set{&"null",&java.lang.StringBuffer:toString(...)}
    //#unanalyzed(String textToXML(String)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(String textToXML(String)): Effects-of-calling:java.lang.StringBuffer
    //#unanalyzed(String textToXML(String)): Effects-of-calling:java.lang.StringBuffer:append
    //#unanalyzed(String textToXML(String)): Effects-of-calling:java.lang.StringBuffer:toString
    //#unanalyzed(String textToXML(String)): Effects-of-calling:java.lang.String:charAt
    //#unanalyzed(String textToXML(String)): Effects-of-calling:java.lang.String:valueOf
    //#OldUtilities.java:688: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.textToXML(String)
    }
    
    /**
     * Converts a text string to HTML or XML entities.
     * @param text The string to convert.
     * @return The converted string.
     */
    public static final String textToCDATA(String text) {
        if (text == null) return "null";
    //#OldUtilities.java:697: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.textToCDATA(String)
    //#input(String textToCDATA(String)): "&amp;#"._tainted
    //#input(String textToCDATA(String)): text
    //#output(String textToCDATA(String)): java.lang.StringBuffer:toString(...)._tainted
    //#output(String textToCDATA(String)): return_value
    //#new obj(String textToCDATA(String)): java.lang.StringBuffer:toString(...)
    //#post(String textToCDATA(String)): init'ed(java.lang.StringBuffer:toString(...)._tainted)
    //#post(String textToCDATA(String)): return_value in Addr_Set{&java.lang.StringBuffer:toString(...),&"null"}
    //#unanalyzed(String textToCDATA(String)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(String textToCDATA(String)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(String textToCDATA(String)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(String textToCDATA(String)): Effects-of-calling:java.lang.String:valueOf
    //#test_vector(String textToCDATA(String)): text: Inverse{null}, Addr_Set{null}
        final StringBuffer html = new StringBuffer();
        
        // Loop thru each characters of the text
        for (int i = 0; i < text.length(); i++) {
            // Convert character to HTML/XML
            html.append(charToCDATA(text.charAt(i)));
        }
        
        // Return HTML/XML string
        return html.toString();
    //#OldUtilities.java:707: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.textToCDATA(String)
    }
    
    /**
     * Converts a character to CDATA character.
     * @param ch The character to convert.
     * @return The converted string.
     */
    public static final String charToCDATA(char ch) {
        int c;
        
        if (ch >= 128) {
    //#OldUtilities.java:718: method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.charToCDATA(char)
    //#input(String charToCDATA(char)): "&amp;#"._tainted
    //#input(String charToCDATA(char)): ch
    //#output(String charToCDATA(char)): java.lang.String:valueOf(...)._tainted
    //#output(String charToCDATA(char)): java.lang.StringBuilder:toString(...)._tainted
    //#output(String charToCDATA(char)): return_value
    //#new obj(String charToCDATA(char)): java.lang.String:valueOf(...)
    //#new obj(String charToCDATA(char)): java.lang.StringBuilder:toString(...)
    //#post(String charToCDATA(char)): java.lang.String:valueOf(...)._tainted == 0
    //#post(String charToCDATA(char)): java.lang.StringBuilder:toString(...)._tainted == 0
    //#post(String charToCDATA(char)): return_value in Addr_Set{&java.lang.String:valueOf(...),&java.lang.StringBuilder:toString(...)}
    //#test_vector(String charToCDATA(char)): ch: {0..127}, {128..65_535}
            c = ch;
            
            return ("&#" + c + ';');
        }
        
        // No conversion
        else {
            // Return character as string
            return (String.valueOf(ch));
    //#OldUtilities.java:727: end of method: String org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities.charToCDATA(char)
        }
    }
    
}
    //#OldUtilities.java:: end of class: org.apache.roller.weblogger.ui.rendering.velocity.deprecated.OldUtilities
