//# 1 errors, 74 messages
//#
/*
    //#emailauthornotificationlistener.java:1:1: class: net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener
    //#emailauthornotificationlistener.java:1:1: method: net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener.net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init
 * 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.comment;

import net.sourceforge.pebble.domain.BlogEntry;
import net.sourceforge.pebble.domain.Comment;

import java.util.Collection;
import java.util.HashSet;

/**
 * Sends an e-mail notification to the blog entry author when new
 * comments are added.
 *
 * @author Simon Brown
 */
public class EmailAuthorNotificationListener extends AbstractEmailNotificationListener {
    //#emailauthornotificationlistener.java:46: method: void net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener.net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener()
    //#input(void net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener()): this
    //#emailauthornotificationlistener.java:46: end of method: void net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener.net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener()

  /**
   * Returns the collection of recipients.
   *
   * @param comment   the Comment from the event
   * @return  a Collection of e-mail addresses (Strings)
   */
  protected Collection getEmailAddresses(Comment comment) {
    BlogEntry blogEntry = comment.getBlogEntry();
    //#emailauthornotificationlistener.java:55: method: Collection net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener.getEmailAddresses(Comment)
    //#input(Collection getEmailAddresses(Comment)): comment
    //#input(Collection getEmailAddresses(Comment)): comment.__Tag
    //#input(Collection getEmailAddresses(Comment)): comment.blogEntry
    //#input(Collection getEmailAddresses(Comment)): comment.blogEntry.__Tag
    //#input(Collection getEmailAddresses(Comment)): comment.blogEntry.author
    //#input(Collection getEmailAddresses(Comment)): comment.blogEntry.user
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/Configuration.__Descendant_Table[net/sourceforge/pebble/Configuration]
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/Configuration.__Descendant_Table[others]
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/Configuration.__Dispatch_Table.getSecurityRealm()Lnet/sourceforge/pebble/security/SecurityRealm;
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[others]
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getAuthor()Ljava/lang/String;
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getUser()Lnet/sourceforge/pebble/security/PebbleUserDetails;
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/domain/Comment.__Descendant_Table[net/sourceforge/pebble/domain/Comment]
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/domain/Comment.__Descendant_Table[others]
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.getBlogEntry()Lnet/sourceforge/pebble/domain/BlogEntry;
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/domain/PageBasedContent.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/domain/PageBasedContent.__Descendant_Table[net/sourceforge/pebble/domain/PageBasedContent]
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/domain/PageBasedContent.__Descendant_Table[net/sourceforge/pebble/domain/StaticPage]
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/domain/PageBasedContent.__Descendant_Table[others]
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/domain/PageBasedContent.__Dispatch_Table.getAuthor()Ljava/lang/String;
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/domain/PageBasedContent.log
    //#input(Collection getEmailAddresses(Comment)): net/sourceforge/pebble/domain/StaticPage.__Dispatch_Table.getAuthor()Ljava/lang/String;
    //#output(Collection getEmailAddresses(Comment)): comment.blogEntry.user
    //#output(Collection getEmailAddresses(Comment)): new HashSet(getEmailAddresses#1) num objects
    //#output(Collection getEmailAddresses(Comment)): return_value
    //#new obj(Collection getEmailAddresses(Comment)): new HashSet(getEmailAddresses#1)
    //#pre[1] (Collection getEmailAddresses(Comment)): comment != null
    //#pre[2] (Collection getEmailAddresses(Comment)): comment.__Tag == net/sourceforge/pebble/domain/Comment
    //#pre[3] (Collection getEmailAddresses(Comment)): comment.blogEntry != null
    //#pre[6] (Collection getEmailAddresses(Comment)): init'ed(comment.blogEntry.user)
    //#pre[4] (Collection getEmailAddresses(Comment)): (soft) comment.blogEntry.__Tag == net/sourceforge/pebble/domain/BlogEntry
    //#pre[5] (Collection getEmailAddresses(Comment)): (soft) init'ed(comment.blogEntry.author)
    //#post(Collection getEmailAddresses(Comment)): comment.blogEntry.user != null
    //#post(Collection getEmailAddresses(Comment)): return_value == &new HashSet(getEmailAddresses#1)
    //#post(Collection getEmailAddresses(Comment)): new HashSet(getEmailAddresses#1) num objects == 1
    //#unanalyzed(Collection getEmailAddresses(Comment)): Effects-of-calling:net.sourceforge.pebble.PebbleContext:getInstance
    //#unanalyzed(Collection getEmailAddresses(Comment)): Effects-of-calling:net.sourceforge.pebble.PebbleContext:getConfiguration
    //#unanalyzed(Collection getEmailAddresses(Comment)): Effects-of-calling:getSecurityRealm
    //#unanalyzed(Collection getEmailAddresses(Comment)): Effects-of-calling:net.sourceforge.pebble.security.SecurityRealm:getUser
    //#unanalyzed(Collection getEmailAddresses(Comment)): Effects-of-calling:org.apache.commons.logging.Log:error
    Collection<String> to = new HashSet<String>();
    to.add(blogEntry.getUser().getEmailAddress());
    //#emailauthornotificationlistener.java:57: ?null dereference
    //#    getUser(...) != null
    //#    severity: MEDIUM
    //#    class: net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener
    //#    method: Collection getEmailAddresses(Comment)
    //#    basic block: Entry_BB_1
    //#    assertion: getUser(...) != null
    //#    VN: getUser(...)
    //#    Expected: Inverse{null} or Invalid
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
    //#emailauthornotificationlistener.java:57: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.security.PebbleUserDetails:getEmailAddress()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener
    //#    method: Collection getEmailAddresses(Comment)
    //#    unanalyzed callee: String net.sourceforge.pebble.security.PebbleUserDetails:getEmailAddress()

    return to;
    //#emailauthornotificationlistener.java:59: end of method: Collection net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener.getEmailAddresses(Comment)
  }

}
    //#output(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): __Descendant_Table[net/sourceforge/pebble/event/comment/EmailAuthorNotificationListener]
    //#output(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): __Dispatch_Table.commentAdded(Lnet/sourceforge/pebble/api/event/comment/CommentEvent;)V
    //#output(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): __Dispatch_Table.commentApproved(Lnet/sourceforge/pebble/api/event/comment/CommentEvent;)V
    //#output(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): __Dispatch_Table.commentRejected(Lnet/sourceforge/pebble/api/event/comment/CommentEvent;)V
    //#output(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): __Dispatch_Table.commentRemoved(Lnet/sourceforge/pebble/api/event/comment/CommentEvent;)V
    //#output(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): __Dispatch_Table.getEmailAddresses(Lnet/sourceforge/pebble/domain/Comment;)Ljava/util/Collection;
    //#output(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): __Dispatch_Table.sendApprovalRequest(Lnet/sourceforge/pebble/domain/Comment;)V
    //#output(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): __Dispatch_Table.sendNotification(Lnet/sourceforge/pebble/domain/Comment;)V
    //#output(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): net/sourceforge/pebble/api/event/comment/CommentListener.__Descendant_Table[net/sourceforge/pebble/event/comment/EmailAuthorNotificationListener]
    //#output(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): net/sourceforge/pebble/event/comment/AbstractEmailNotificationListener.__Descendant_Table[net/sourceforge/pebble/event/comment/EmailAuthorNotificationListener]
    //#output(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): net/sourceforge/pebble/event/comment/CommentListenerSupport.__Descendant_Table[net/sourceforge/pebble/event/comment/EmailAuthorNotificationListener]
    //#post(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): __Descendant_Table[net/sourceforge/pebble/event/comment/EmailAuthorNotificationListener] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): net/sourceforge/pebble/api/event/comment/CommentListener.__Descendant_Table[net/sourceforge/pebble/event/comment/EmailAuthorNotificationListener] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): net/sourceforge/pebble/event/comment/AbstractEmailNotificationListener.__Descendant_Table[net/sourceforge/pebble/event/comment/EmailAuthorNotificationListener] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): net/sourceforge/pebble/event/comment/CommentListenerSupport.__Descendant_Table[net/sourceforge/pebble/event/comment/EmailAuthorNotificationListener] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): __Dispatch_Table.commentAdded(Lnet/sourceforge/pebble/api/event/comment/CommentEvent;)V == &net/sourceforge/pebble/event/comment/AbstractEmailNotificationListener.commentAdded
    //#post(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): __Dispatch_Table.commentApproved(Lnet/sourceforge/pebble/api/event/comment/CommentEvent;)V == &net/sourceforge/pebble/event/comment/AbstractEmailNotificationListener.commentApproved
    //#post(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): __Dispatch_Table.commentRejected(Lnet/sourceforge/pebble/api/event/comment/CommentEvent;)V == &net/sourceforge/pebble/event/comment/CommentListenerSupport.commentRejected
    //#post(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): __Dispatch_Table.commentRemoved(Lnet/sourceforge/pebble/api/event/comment/CommentEvent;)V == &net/sourceforge/pebble/event/comment/CommentListenerSupport.commentRemoved
    //#post(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): __Dispatch_Table.getEmailAddresses(Lnet/sourceforge/pebble/domain/Comment;)Ljava/util/Collection; == &getEmailAddresses
    //#post(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): __Dispatch_Table.sendApprovalRequest(Lnet/sourceforge/pebble/domain/Comment;)V == &net/sourceforge/pebble/event/comment/AbstractEmailNotificationListener.sendApprovalRequest
    //#post(net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init): __Dispatch_Table.sendNotification(Lnet/sourceforge/pebble/domain/Comment;)V == &net/sourceforge/pebble/event/comment/AbstractEmailNotificationListener.sendNotification
    //#emailauthornotificationlistener.java:: end of method: net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener.net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener__static_init
    //#emailauthornotificationlistener.java:: end of class: net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener
