//# 1 errors, 155 messages
//#
/*
    //#linkspamlistener.java:1:1: class: net.sourceforge.pebble.event.response.LinkSpamListener
 * Copyright (c) 2003-2006, Simon Brown
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   - Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *
 *   - Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in
 *     the documentation and/or other materials provided with the
 *     distribution.
 *
 *   - Neither the name of Pebble nor the names of its contributors may
 *     be used to endorse or promote products derived from this software
 *     without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
package net.sourceforge.pebble.event.response;

import net.sourceforge.pebble.PluginProperties;
import net.sourceforge.pebble.domain.Comment;
import net.sourceforge.pebble.domain.Response;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Checks comment and TrackBack content for a large number of links and sets
 * the state of such responses to pending.
 *
 * @author Simon Brown
 */
public class LinkSpamListener extends BlogEntryResponseListenerSupport {
    //#linkspamlistener.java:49: method: void net.sourceforge.pebble.event.response.LinkSpamListener.net.sourceforge.pebble.event.response.LinkSpamListener()
    //#input(void net.sourceforge.pebble.event.response.LinkSpamListener()): this
    //#linkspamlistener.java:49: end of method: void net.sourceforge.pebble.event.response.LinkSpamListener.net.sourceforge.pebble.event.response.LinkSpamListener()

  /** the log used by this class */
  private static final Log log = LogFactory.getLog(LinkSpamListener.class);
    //#linkspamlistener.java:52: method: net.sourceforge.pebble.event.response.LinkSpamListener.net.sourceforge.pebble.event.response.LinkSpamListener__static_init
    //#linkspamlistener.java:52: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.response.LinkSpamListener
    //#    method: net.sourceforge.pebble.event.response.LinkSpamListener__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): HTML_LINK_PATTERN
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Descendant_Table[net/sourceforge/pebble/event/response/LinkSpamListener]
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.blogEntryResponseAdded(Lnet/sourceforge/pebble/domain/Response;)V
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.blogEntryResponseApproved(Lnet/sourceforge/pebble/domain/Response;)V
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.blogEntryResponseRejected(Lnet/sourceforge/pebble/domain/Response;)V
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.blogEntryResponseRemoved(Lnet/sourceforge/pebble/domain/Response;)V
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.commentAdded(Lnet/sourceforge/pebble/api/event/comment/CommentEvent;)V
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.commentApproved(Lnet/sourceforge/pebble/api/event/comment/CommentEvent;)V
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.commentRejected(Lnet/sourceforge/pebble/api/event/comment/CommentEvent;)V
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.commentRemoved(Lnet/sourceforge/pebble/api/event/comment/CommentEvent;)V
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.trackBackAdded(Lnet/sourceforge/pebble/api/event/trackback/TrackBackEvent;)V
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.trackBackApproved(Lnet/sourceforge/pebble/api/event/trackback/TrackBackEvent;)V
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.trackBackRejected(Lnet/sourceforge/pebble/api/event/trackback/TrackBackEvent;)V
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.trackBackRemoved(Lnet/sourceforge/pebble/api/event/trackback/TrackBackEvent;)V
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): log
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): net/sourceforge/pebble/api/event/comment/CommentListener.__Descendant_Table[net/sourceforge/pebble/event/response/LinkSpamListener]
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): net/sourceforge/pebble/api/event/trackback/TrackBackListener.__Descendant_Table[net/sourceforge/pebble/event/response/LinkSpamListener]
    //#output(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): net/sourceforge/pebble/event/response/BlogEntryResponseListenerSupport.__Descendant_Table[net/sourceforge/pebble/event/response/LinkSpamListener]
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): init'ed(HTML_LINK_PATTERN)
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Descendant_Table[net/sourceforge/pebble/event/response/LinkSpamListener] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): net/sourceforge/pebble/api/event/comment/CommentListener.__Descendant_Table[net/sourceforge/pebble/event/response/LinkSpamListener] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): net/sourceforge/pebble/api/event/trackback/TrackBackListener.__Descendant_Table[net/sourceforge/pebble/event/response/LinkSpamListener] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): net/sourceforge/pebble/event/response/BlogEntryResponseListenerSupport.__Descendant_Table[net/sourceforge/pebble/event/response/LinkSpamListener] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.blogEntryResponseAdded(Lnet/sourceforge/pebble/domain/Response;)V == &blogEntryResponseAdded
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.blogEntryResponseApproved(Lnet/sourceforge/pebble/domain/Response;)V == &net/sourceforge/pebble/event/response/BlogEntryResponseListenerSupport.blogEntryResponseApproved
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.blogEntryResponseRejected(Lnet/sourceforge/pebble/domain/Response;)V == &net/sourceforge/pebble/event/response/BlogEntryResponseListenerSupport.blogEntryResponseRejected
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.blogEntryResponseRemoved(Lnet/sourceforge/pebble/domain/Response;)V == &net/sourceforge/pebble/event/response/BlogEntryResponseListenerSupport.blogEntryResponseRemoved
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.commentAdded(Lnet/sourceforge/pebble/api/event/comment/CommentEvent;)V == &net/sourceforge/pebble/event/response/BlogEntryResponseListenerSupport.commentAdded
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.commentApproved(Lnet/sourceforge/pebble/api/event/comment/CommentEvent;)V == &net/sourceforge/pebble/event/response/BlogEntryResponseListenerSupport.commentApproved
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.commentRejected(Lnet/sourceforge/pebble/api/event/comment/CommentEvent;)V == &net/sourceforge/pebble/event/response/BlogEntryResponseListenerSupport.commentRejected
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.commentRemoved(Lnet/sourceforge/pebble/api/event/comment/CommentEvent;)V == &net/sourceforge/pebble/event/response/BlogEntryResponseListenerSupport.commentRemoved
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.trackBackAdded(Lnet/sourceforge/pebble/api/event/trackback/TrackBackEvent;)V == &net/sourceforge/pebble/event/response/BlogEntryResponseListenerSupport.trackBackAdded
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.trackBackApproved(Lnet/sourceforge/pebble/api/event/trackback/TrackBackEvent;)V == &net/sourceforge/pebble/event/response/BlogEntryResponseListenerSupport.trackBackApproved
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.trackBackRejected(Lnet/sourceforge/pebble/api/event/trackback/TrackBackEvent;)V == &net/sourceforge/pebble/event/response/BlogEntryResponseListenerSupport.trackBackRejected
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): __Dispatch_Table.trackBackRemoved(Lnet/sourceforge/pebble/api/event/trackback/TrackBackEvent;)V == &net/sourceforge/pebble/event/response/BlogEntryResponseListenerSupport.trackBackRemoved
    //#post(net.sourceforge.pebble.event.response.LinkSpamListener__static_init): init'ed(log)

  /** the pattern used to find HTML links */
  private static final Pattern HTML_LINK_PATTERN = Pattern.compile("<a.*?href=.*?>", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
    //#linkspamlistener.java:55: end of method: net.sourceforge.pebble.event.response.LinkSpamListener.net.sourceforge.pebble.event.response.LinkSpamListener__static_init

  /** the default threshold for the number of links allowed */
  public static final int DEFAULT_THRESHOLD = 3;

  /** the name of the threshold property for comments */
  public static final String COMMENT_THRESHOLD_KEY = "LinkSpamListener.commentThreshold";

  /** the name of the threshold property for TrackBacks */
  public static final String TRACKBACK_THRESHOLD_KEY = "LinkSpamListener.trackbackThreshold";

  /**
   * Called when a comment or TrackBack has been added.
   *
   * @param response a Response
   */
  protected void blogEntryResponseAdded(Response response) {
    String content = response.getContent();
    //#linkspamlistener.java:72: method: void net.sourceforge.pebble.event.response.LinkSpamListener.blogEntryResponseAdded(Response)
    //#linkspamlistener.java:72: Warning: method not available
    //#    -- call on String getContent()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.response.LinkSpamListener
    //#    method: void blogEntryResponseAdded(Response)
    //#    unanalyzed callee: String getContent()
    //#linkspamlistener.java:72: Warning: suspicious precondition
    //#    the precondition for response.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: net.sourceforge.pebble.event.response.LinkSpamListener
    //#    method: void blogEntryResponseAdded(Response)
    //#    suspicious precondition index: [7]
    //#input(void blogEntryResponseAdded(Response)): HTML_LINK_PATTERN
    //#input(void blogEntryResponseAdded(Response)): log
    //#input(void blogEntryResponseAdded(Response)): net.sourceforge.pebble.domain.State__static_init.new State(State__static_init#1).__Tag
    //#input(void blogEntryResponseAdded(Response)): net.sourceforge.pebble.domain.State__static_init.new State(State__static_init#2).__Tag
    //#input(void blogEntryResponseAdded(Response)): net.sourceforge.pebble.domain.State__static_init.new State(State__static_init#3).__Tag
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[net/sourceforge/pebble/domain/Blog]
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[others]
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getPluginProperties()Lnet/sourceforge/pebble/PluginProperties;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[others]
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Comment.__Descendant_Table[net/sourceforge/pebble/domain/Comment]
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Comment.__Descendant_Table[others]
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.areEventsEnabled()Z
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.getBlogEntry()Lnet/sourceforge/pebble/domain/BlogEntry;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.getBody()Ljava/lang/String;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.getContent()Ljava/lang/String;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.getState()Lnet/sourceforge/pebble/domain/State;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.getTitle()Ljava/lang/String;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.incrementSpamScore()V
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.isApproved()Z
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.isRejected()Z
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.setPending()V
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.setState(Lnet/sourceforge/pebble/domain/State;)V
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Response.__Descendant_Table[net/sourceforge/pebble/domain/Comment]
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Response.__Descendant_Table[net/sourceforge/pebble/domain/Response]
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Response.__Descendant_Table[net/sourceforge/pebble/domain/TrackBack]
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Response.__Descendant_Table[others]
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Response.__Dispatch_Table.getBlogEntry()Lnet/sourceforge/pebble/domain/BlogEntry;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Response.__Dispatch_Table.getContent()Ljava/lang/String;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Response.__Dispatch_Table.getState()Lnet/sourceforge/pebble/domain/State;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Response.__Dispatch_Table.getTitle()Ljava/lang/String;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Response.__Dispatch_Table.incrementSpamScore()V
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Response.__Dispatch_Table.setPending()V
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/Response.__Dispatch_Table.setState(Lnet/sourceforge/pebble/domain/State;)V
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/State.APPROVED
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/State.PENDING
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/State.REJECTED
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/State.__Descendant_Table[net/sourceforge/pebble/domain/State]
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/State.__Descendant_Table[others]
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/State.__Dispatch_Table.equals(Ljava/lang/Object;)Z
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/State.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/TrackBack.__Descendant_Table[net/sourceforge/pebble/domain/TrackBack]
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/TrackBack.__Descendant_Table[others]
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/TrackBack.__Dispatch_Table.areEventsEnabled()Z
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/TrackBack.__Dispatch_Table.getBlogEntry()Lnet/sourceforge/pebble/domain/BlogEntry;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/TrackBack.__Dispatch_Table.getContent()Ljava/lang/String;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/TrackBack.__Dispatch_Table.getExcerpt()Ljava/lang/String;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/TrackBack.__Dispatch_Table.getState()Lnet/sourceforge/pebble/domain/State;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/TrackBack.__Dispatch_Table.getTitle()Ljava/lang/String;
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/TrackBack.__Dispatch_Table.incrementSpamScore()V
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/TrackBack.__Dispatch_Table.isApproved()Z
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/TrackBack.__Dispatch_Table.isRejected()Z
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/TrackBack.__Dispatch_Table.setPending()V
    //#input(void blogEntryResponseAdded(Response)): net/sourceforge/pebble/domain/TrackBack.__Dispatch_Table.setState(Lnet/sourceforge/pebble/domain/State;)V
    //#input(void blogEntryResponseAdded(Response)): response
    //#input(void blogEntryResponseAdded(Response)): response.__Tag
    //#input(void blogEntryResponseAdded(Response)): response.blogEntry
    //#input(void blogEntryResponseAdded(Response)): response.blogEntry.__Tag
    //#input(void blogEntryResponseAdded(Response)): response.blogEntry.blog
    //#input(void blogEntryResponseAdded(Response)): response.blogEntry.blog.__Tag
    //#input(void blogEntryResponseAdded(Response)): response.blogEntry.blog.pluginProperties
    //#input(void blogEntryResponseAdded(Response)): response.body
    //#input(void blogEntryResponseAdded(Response)): response.excerpt
    //#input(void blogEntryResponseAdded(Response)): response.spamScore
    //#input(void blogEntryResponseAdded(Response)): response.state.__Tag
    //#input(void blogEntryResponseAdded(Response)): response.title
    //#output(void blogEntryResponseAdded(Response)): response.spamScore
    //#output(void blogEntryResponseAdded(Response)): response.state
    //#pre[6] (void blogEntryResponseAdded(Response)): response != null
    //#pre[7] (void blogEntryResponseAdded(Response)): response.__Tag in {net/sourceforge/pebble/domain/Comment, net/sourceforge/pebble/domain/TrackBack}
    //#pre[4] (void blogEntryResponseAdded(Response)): (soft) response.spamScore <= 4_294_967_294
    //#pre[8] (void blogEntryResponseAdded(Response)): (soft) response.blogEntry != null
    //#pre[9] (void blogEntryResponseAdded(Response)): (soft) response.blogEntry.__Tag == net/sourceforge/pebble/domain/BlogEntry
    //#pre[10] (void blogEntryResponseAdded(Response)): (soft) response.blogEntry.blog != null
    //#pre[11] (void blogEntryResponseAdded(Response)): (soft) response.blogEntry.blog.__Tag == net/sourceforge/pebble/domain/Blog
    //#pre[12] (void blogEntryResponseAdded(Response)): (soft) response.blogEntry.blog.pluginProperties != null
    //#pre[13] (void blogEntryResponseAdded(Response)): (soft) init'ed(response.body)
    //#pre[15] (void blogEntryResponseAdded(Response)): (soft) init'ed(response.excerpt)
    //#pre[18] (void blogEntryResponseAdded(Response)): (soft) init'ed(response.title)
    //#presumption(void blogEntryResponseAdded(Response)): java.util.regex.Pattern:compile(...)@55 != null
    //#presumption(void blogEntryResponseAdded(Response)): java.util.regex.Pattern:matcher(...)@74 != null
    //#presumption(void blogEntryResponseAdded(Response)): org.apache.commons.logging.LogFactory:getLog(...)@52 != null
    //#post(void blogEntryResponseAdded(Response)): response.spamScore == One-of{old response.spamScore, old response.spamScore + 1}
    //#post(void blogEntryResponseAdded(Response)): (soft) init'ed(response.spamScore)
    //#post(void blogEntryResponseAdded(Response)): response.state == One-of{old response.state, &net.sourceforge.pebble.domain.State__static_init.new State(State__static_init#3)}
    //#unanalyzed(void blogEntryResponseAdded(Response)): Effects-of-calling:getBlogEntry
    //#unanalyzed(void blogEntryResponseAdded(Response)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void blogEntryResponseAdded(Response)): Effects-of-calling:setState
    //#unanalyzed(void blogEntryResponseAdded(Response)): Effects-of-calling:areEventsEnabled
    //#unanalyzed(void blogEntryResponseAdded(Response)): Effects-of-calling:java.util.EventObject
    //#unanalyzed(void blogEntryResponseAdded(Response)): Effects-of-calling:net.sourceforge.pebble.api.event.PebbleEvent
    //#unanalyzed(void blogEntryResponseAdded(Response)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:addEvent
    //#unanalyzed(void blogEntryResponseAdded(Response)): Effects-of-calling:getState
    //#unanalyzed(void blogEntryResponseAdded(Response)): Effects-of-calling:isApproved
    //#unanalyzed(void blogEntryResponseAdded(Response)): Effects-of-calling:isRejected
    //#unanalyzed(void blogEntryResponseAdded(Response)): Effects-of-calling:java.lang.String:equals
    //#unanalyzed(void blogEntryResponseAdded(Response)): Effects-of-calling:net.sourceforge.pebble.domain.Response:setState
    //#test_vector(void blogEntryResponseAdded(Response)): response.__Tag: {804_352}, {793_344}
    //#test_vector(void blogEntryResponseAdded(Response)): java.util.regex.Matcher:find(...)@76: {1}, {0}
    //#test_vector(void blogEntryResponseAdded(Response)): net.sourceforge.pebble.PluginProperties:hasProperty(...)@88: {0}, {1}
    if (content != null) {
      Matcher m = HTML_LINK_PATTERN.matcher(content);
      int count = 0;
      while (m.find()) {
        count++;
    //#linkspamlistener.java:77: ?overflow
    //#    count in -2_147_483_649..4_294_967_294
    //#    severity: LOW
    //#    class: net.sourceforge.pebble.event.response.LinkSpamListener
    //#    method: void blogEntryResponseAdded(Response)
    //#    basic block: bb_3
    //#    assertion: count in -2_147_483_649..4_294_967_294
    //#    VN: count + 1
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {4_294_967_296}
    //#    Attribs:  Int  Bad singleton  Bad > Exp
      }

      PluginProperties props = response.getBlogEntry().getBlog().getPluginProperties();
      String propertyName = "";
    //#linkspamlistener.java:81: Warning: unused assignment
    //#    unused assignment into propertyName
    //#    severity: LOW
    //#    class: net.sourceforge.pebble.event.response.LinkSpamListener
    //#    method: void blogEntryResponseAdded(Response)
      if (response instanceof Comment) {
        propertyName = COMMENT_THRESHOLD_KEY;
      } else {
        propertyName = TRACKBACK_THRESHOLD_KEY;
      }
      int threshold = DEFAULT_THRESHOLD;
      if (props.hasProperty(propertyName)) {
    //#linkspamlistener.java:88: Warning: method not available
    //#    -- call on bool net.sourceforge.pebble.PluginProperties:hasProperty(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.response.LinkSpamListener
    //#    method: void blogEntryResponseAdded(Response)
    //#    unanalyzed callee: bool net.sourceforge.pebble.PluginProperties:hasProperty(String)
        try {
          threshold = Integer.parseInt(props.getProperty(propertyName));
    //#linkspamlistener.java:90: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.PluginProperties:getProperty(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.response.LinkSpamListener
    //#    method: void blogEntryResponseAdded(Response)
    //#    unanalyzed callee: String net.sourceforge.pebble.PluginProperties:getProperty(String)
        } catch (NumberFormatException nfe) {
          log.error(nfe.getMessage());
    //#linkspamlistener.java:92: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.response.LinkSpamListener
    //#    method: void blogEntryResponseAdded(Response)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object)
          // do nothing, the value has already been defaulted
        }
      }

      if (count > threshold) {
        log.info(response.getTitle() + " marked as pending : number of links is " + count + ", threshold is " + threshold);
    //#linkspamlistener.java:98: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:info(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.response.LinkSpamListener
    //#    method: void blogEntryResponseAdded(Response)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:info(Object)
        response.setPending();
        response.incrementSpamScore();
      }
    }
  }
    //#linkspamlistener.java:103: end of method: void net.sourceforge.pebble.event.response.LinkSpamListener.blogEntryResponseAdded(Response)

}
    //#linkspamlistener.java:: end of class: net.sourceforge.pebble.event.response.LinkSpamListener
