//# 0 errors, 47 messages
//#
/*
    //#HTMLSubsetPlugin.java:1:1: class: org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin
 * 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.comment;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.weblogger.pojos.WeblogEntryComment;
import org.apache.roller.weblogger.util.Utilities;


/**
 * Transforms the given String into a subset of HTML.
 */
public class HTMLSubsetPlugin implements WeblogEntryCommentPlugin {
    
    private static final Log log = LogFactory.getLog(AutoformatPlugin.class);
    //#HTMLSubsetPlugin.java:32: method: org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin.org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init
    //#HTMLSubsetPlugin.java:32: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin
    //#    method: org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init): __Descendant_Table[org/apache/roller/weblogger/business/plugins/comment/HTMLSubsetPlugin]
    //#output(org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init): __Dispatch_Table.getDescription()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init): __Dispatch_Table.getId()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init): __Dispatch_Table.getName()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init): __Dispatch_Table.render(Lorg/apache/roller/weblogger/pojos/WeblogEntryComment;Ljava/lang/String;)Ljava/lang/String;
    //#output(org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init): log
    //#output(org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init): org/apache/roller/weblogger/business/plugins/comment/WeblogEntryCommentPlugin.__Descendant_Table[org/apache/roller/weblogger/business/plugins/comment/HTMLSubsetPlugin]
    //#post(org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init): __Descendant_Table[org/apache/roller/weblogger/business/plugins/comment/HTMLSubsetPlugin] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init): org/apache/roller/weblogger/business/plugins/comment/WeblogEntryCommentPlugin.__Descendant_Table[org/apache/roller/weblogger/business/plugins/comment/HTMLSubsetPlugin] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init): __Dispatch_Table.getDescription()Ljava/lang/String; == &getDescription
    //#post(org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init): __Dispatch_Table.getId()Ljava/lang/String; == &getId
    //#post(org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init): __Dispatch_Table.getName()Ljava/lang/String; == &getName
    //#post(org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init): __Dispatch_Table.render(Lorg/apache/roller/weblogger/pojos/WeblogEntryComment;Ljava/lang/String;)Ljava/lang/String; == &render
    //#post(org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init): init'ed(log)
    //#HTMLSubsetPlugin.java:32: end of method: org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin.org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin__static_init
    
    
    public HTMLSubsetPlugin() {
    //#HTMLSubsetPlugin.java:35: method: void org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin.org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin()
        // no-op
    }
    //#HTMLSubsetPlugin.java:37: end of method: void org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin.org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin()
    
    
    /**
     * Unique identifier.  This should never change. 
     */
    public String getId() {
        return "HTMLSubset";
    //#HTMLSubsetPlugin.java:44: method: String org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin.getId()
    //#output(String getId()): return_value
    //#post(String getId()): return_value == &"HTMLSubset"
    //#HTMLSubsetPlugin.java:44: end of method: String org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin.getId()
    }
    
    
    public String getName() {
        return "HTML Subset Restriction";
    //#HTMLSubsetPlugin.java:49: method: String org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin.getName()
    //#output(String getName()): return_value
    //#post(String getName()): return_value == &"HTML Subset Restriction"
    //#HTMLSubsetPlugin.java:49: end of method: String org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin.getName()
    }
    
    
    public String getDescription() {
        return "Transforms the given comment body into a subset of HTML";
    //#HTMLSubsetPlugin.java:54: method: String org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin.getDescription()
    //#output(String getDescription()): return_value
    //#post(String getDescription()): return_value == &"Transforms the given comment body into a subset of HTML"
    //#HTMLSubsetPlugin.java:54: end of method: String org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin.getDescription()
    }
    
    
    public String render(final WeblogEntryComment comment, String text) {
        
        log.debug("starting value:\n"+text);
    //#HTMLSubsetPlugin.java:60: method: String org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin.render(WeblogEntryComment, String)
    //#HTMLSubsetPlugin.java:60: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin
    //#    method: String render(WeblogEntryComment, String)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
    //#input(String render(WeblogEntryComment, String)): "ending value:&#10;"._tainted
    //#input(String render(WeblogEntryComment, String)): "starting value:&#10;"._tainted
    //#input(String render(WeblogEntryComment, String)): log
    //#input(String render(WeblogEntryComment, String)): text
    //#input(String render(WeblogEntryComment, String)): text._tainted
    //#output(String render(WeblogEntryComment, String)): return_value
    //#presumption(String render(WeblogEntryComment, String)): org.apache.commons.logging.LogFactory:getLog(...)@32 != null
    //#post(String render(WeblogEntryComment, String)): init'ed(return_value)
        
        String output = text;
        
        // escape html
        output = Utilities.escapeHTML(output);
    //#HTMLSubsetPlugin.java:65: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.util.Utilities:escapeHTML(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin
    //#    method: String render(WeblogEntryComment, String)
    //#    unanalyzed callee: String org.apache.roller.weblogger.util.Utilities:escapeHTML(String)
        
        // just use old utilities method
        output = Utilities.transformToHTMLSubset(output);
    //#HTMLSubsetPlugin.java:68: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.util.Utilities:transformToHTMLSubset(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin
    //#    method: String render(WeblogEntryComment, String)
    //#    unanalyzed callee: String org.apache.roller.weblogger.util.Utilities:transformToHTMLSubset(String)
        
        log.debug("ending value:\n"+output);
    //#HTMLSubsetPlugin.java:70: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin
    //#    method: String render(WeblogEntryComment, String)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
        
        return output;
    //#HTMLSubsetPlugin.java:72: end of method: String org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin.render(WeblogEntryComment, String)
    }
    
}
    //#HTMLSubsetPlugin.java:: end of class: org.apache.roller.weblogger.business.plugins.comment.HTMLSubsetPlugin
