//# 0 errors, 100 messages
//#
/*
    //#BlacklistCommentValidator.java:1:1: class: org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator
    //#BlacklistCommentValidator.java:1:1: method: org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator.org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator__static_init
 * 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.plugins.comments;

import java.util.ResourceBundle;
import org.apache.roller.weblogger.pojos.WeblogEntryComment;
import org.apache.roller.weblogger.util.RollerMessages;
import org.apache.roller.weblogger.util.BlacklistChecker;

/**
 * Validates comment if comment does not contain blacklisted words.
 */
public class BlacklistCommentValidator implements CommentValidator {
    //#BlacklistCommentValidator.java:29: method: void org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator.org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator()
    //#input(void org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator()): this
    //#output(void org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator()): new BlacklistChecker(BlacklistCommentValidator#1) num objects
    //#output(void org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator()): this.checker.__Tag
    //#output(void org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator()): this.bundle
    //#output(void org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator()): this.checker
    //#new obj(void org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator()): new BlacklistChecker(BlacklistCommentValidator#1)
    //#post(void org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator()): init'ed(this.bundle)
    //#post(void org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator()): this.checker == &new BlacklistChecker(BlacklistCommentValidator#1)
    //#post(void org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator()): new BlacklistChecker(BlacklistCommentValidator#1) num objects == 1
    //#post(void org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator()): this.checker.__Tag == org/apache/roller/weblogger/util/BlacklistChecker
    private ResourceBundle bundle = ResourceBundle.getBundle("ApplicationResources");       
    private BlacklistChecker checker = new BlacklistChecker();
    //#BlacklistCommentValidator.java:31: end of method: void org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator.org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator()

    public String getName() {
        return bundle.getString("comment.validator.blacklistName");
    //#BlacklistCommentValidator.java:34: method: String org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator.getName()
    //#input(String getName()): this
    //#input(String getName()): this.bundle
    //#output(String getName()): return_value
    //#pre[2] (String getName()): this.bundle != null
    //#post(String getName()): init'ed(return_value)
    //#BlacklistCommentValidator.java:34: end of method: String org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator.getName()
    }

    public int validate(WeblogEntryComment comment, RollerMessages messages) {
        if (checker.checkComment(comment)) {
    //#BlacklistCommentValidator.java:38: method: int org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator.validate(WeblogEntryComment, RollerMessages)
    //#input(int validate(WeblogEntryComment, RollerMessages)): " matched by "._tainted
    //#input(int validate(WeblogEntryComment, RollerMessages)): ""._tainted
    //#input(int validate(WeblogEntryComment, RollerMessages)): ")\b"._tainted
    //#input(int validate(WeblogEntryComment, RollerMessages)): ":"._tainted
    //#input(int validate(WeblogEntryComment, RollerMessages)): "\b("._tainted
    //#input(int validate(WeblogEntryComment, RollerMessages)): "matched:"._tainted
    //#input(int validate(WeblogEntryComment, RollerMessages)): comment
    //#input(int validate(WeblogEntryComment, RollerMessages)): messages
    //#input(int validate(WeblogEntryComment, RollerMessages)): messages.__Tag
    //#input(int validate(WeblogEntryComment, RollerMessages)): messages.mErrors
    //#input(int validate(WeblogEntryComment, RollerMessages)): org/apache/roller/weblogger/util/Blacklist.__Descendant_Table[org/apache/roller/weblogger/util/Blacklist]
    //#input(int validate(WeblogEntryComment, RollerMessages)): org/apache/roller/weblogger/util/Blacklist.__Descendant_Table[others]
    //#input(int validate(WeblogEntryComment, RollerMessages)): org/apache/roller/weblogger/util/Blacklist.__Dispatch_Table.isBlacklisted(Ljava/lang/String;Ljava/util/List;Ljava/util/List;)Z
    //#input(int validate(WeblogEntryComment, RollerMessages)): org/apache/roller/weblogger/util/Blacklist.blacklist
    //#input(int validate(WeblogEntryComment, RollerMessages)): org/apache/roller/weblogger/util/Blacklist.blacklist.__Tag
    //#input(int validate(WeblogEntryComment, RollerMessages)): org/apache/roller/weblogger/util/Blacklist.blacklist.blacklistRegex
    //#input(int validate(WeblogEntryComment, RollerMessages)): org/apache/roller/weblogger/util/Blacklist.blacklist.blacklistStr
    //#input(int validate(WeblogEntryComment, RollerMessages)): org/apache/roller/weblogger/util/Blacklist.mLogger
    //#input(int validate(WeblogEntryComment, RollerMessages)): org/apache/roller/weblogger/util/RollerMessages.__Descendant_Table[org/apache/roller/weblogger/util/RollerMessages]
    //#input(int validate(WeblogEntryComment, RollerMessages)): org/apache/roller/weblogger/util/RollerMessages.__Descendant_Table[others]
    //#input(int validate(WeblogEntryComment, RollerMessages)): org/apache/roller/weblogger/util/RollerMessages.__Dispatch_Table.addError(Ljava/lang/String;)V
    //#output(int validate(WeblogEntryComment, RollerMessages)): return_value
    //#pre[1] (int validate(WeblogEntryComment, RollerMessages)): (soft) comment != null
    //#pre[2] (int validate(WeblogEntryComment, RollerMessages)): (soft) messages != null
    //#pre[3] (int validate(WeblogEntryComment, RollerMessages)): (soft) messages.__Tag == org/apache/roller/weblogger/util/RollerMessages
    //#pre[4] (int validate(WeblogEntryComment, RollerMessages)): (soft) messages.mErrors != null
    //#pre[5] (int validate(WeblogEntryComment, RollerMessages)): (soft) org/apache/roller/weblogger/util/Blacklist.blacklist != null
    //#pre[6] (int validate(WeblogEntryComment, RollerMessages)): (soft) org/apache/roller/weblogger/util/Blacklist.blacklist.__Tag == org/apache/roller/weblogger/util/Blacklist
    //#pre[7] (int validate(WeblogEntryComment, RollerMessages)): (soft) org/apache/roller/weblogger/util/Blacklist.blacklist.blacklistRegex != null
    //#pre[8] (int validate(WeblogEntryComment, RollerMessages)): (soft) org/apache/roller/weblogger/util/Blacklist.blacklist.blacklistStr != null
    //#pre[9] (int validate(WeblogEntryComment, RollerMessages)): (soft) org/apache/roller/weblogger/util/Blacklist.mLogger != null
    //#post(int validate(WeblogEntryComment, RollerMessages)): return_value in {0, 100}
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:org.apache.roller.weblogger.pojos.WeblogEntryComment:getWeblogEntry
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:org.apache.roller.weblogger.pojos.WeblogEntry:getWebsite
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:org.apache.roller.weblogger.pojos.Weblog:getBlacklist
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:org.apache.roller.weblogger.config.WebloggerRuntimeConfig:getProperty
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.util.regex.Pattern:compile
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.util.List:add
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.lang.String:startsWith
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.util.StringTokenizer
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.util.StringTokenizer:hasMoreTokens
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.util.StringTokenizer:nextToken
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:org.apache.roller.weblogger.pojos.WeblogEntryComment:getUrl
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:org.apache.commons.logging.Log:isDebugEnabled
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.util.regex.Pattern:matcher
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.util.regex.Matcher:find
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.util.regex.Matcher:group
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.util.regex.Pattern:pattern
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.lang.String:contains
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:org.apache.commons.lang.StringUtils:isEmpty
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.util.List:size
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:java.util.List:addAll
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:org.apache.roller.weblogger.pojos.WeblogEntryComment:getEmail
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:org.apache.roller.weblogger.pojos.WeblogEntryComment:getName
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:org.apache.roller.weblogger.pojos.WeblogEntryComment:getContent
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:org.apache.roller.weblogger.config.WebloggerConfig:getBooleanProperty
    //#unanalyzed(int validate(WeblogEntryComment, RollerMessages)): Effects-of-calling:org.apache.roller.weblogger.util.RollerMessages$RollerMessage
            messages.addError("comment.validator.blacklistMessage");
            return 0;
        }
        return 100; 
    //#BlacklistCommentValidator.java:42: end of method: int org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator.validate(WeblogEntryComment, RollerMessages)
    }
    
}
    //#output(org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/rendering/plugins/comments/BlacklistCommentValidator]
    //#output(org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator__static_init): __Dispatch_Table.getName()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator__static_init): __Dispatch_Table.validate(Lorg/apache/roller/weblogger/pojos/WeblogEntryComment;Lorg/apache/roller/weblogger/util/RollerMessages;)I
    //#output(org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator__static_init): org/apache/roller/weblogger/ui/rendering/plugins/comments/CommentValidator.__Descendant_Table[org/apache/roller/weblogger/ui/rendering/plugins/comments/BlacklistCommentValidator]
    //#post(org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/rendering/plugins/comments/BlacklistCommentValidator] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator__static_init): org/apache/roller/weblogger/ui/rendering/plugins/comments/CommentValidator.__Descendant_Table[org/apache/roller/weblogger/ui/rendering/plugins/comments/BlacklistCommentValidator] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator__static_init): __Dispatch_Table.getName()Ljava/lang/String; == &getName
    //#post(org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator__static_init): __Dispatch_Table.validate(Lorg/apache/roller/weblogger/pojos/WeblogEntryComment;Lorg/apache/roller/weblogger/util/RollerMessages;)I == &validate
    //#BlacklistCommentValidator.java:: end of method: org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator.org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator__static_init
    //#BlacklistCommentValidator.java:: end of class: org.apache.roller.weblogger.ui.rendering.plugins.comments.BlacklistCommentValidator
