//# 4 errors, 350 messages
//#
package net.sourceforge.pebble.event.blogentry;
    //#posttotwitterblogentrylistener.java:1:1: class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

import net.sourceforge.pebble.PluginProperties;
import net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent;
import net.sourceforge.pebble.api.event.blogentry.BlogEntryListener;
import net.sourceforge.pebble.domain.Blog;
import net.sourceforge.pebble.domain.BlogEntry;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import twitter4j.Twitter;

/**
 * Post new blog entries to twitter.
 * This class is based on a patch by Steve Carton (PEBBLE-15), but changes it to use the
 * pebble plugin mechanism by implementing the {@link BlogEntryListener} interface
 * 
 * @author Steve Carton, Olaf Kock
 */
public class PostToTwitterBlogEntryListener extends BlogEntryListenerSupport {
    //#posttotwitterblogentrylistener.java:28: method: void net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener()
    //#input(void net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener()): this
    //#posttotwitterblogentrylistener.java:28: end of method: void net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener()

	/** the log used by this class */
	private static final Log log = LogFactory
			.getLog(PostToTwitterBlogEntryListener.class);
    //#posttotwitterblogentrylistener.java:32: method: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init
    //#posttotwitterblogentrylistener.java:32: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
    //#    method: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Descendant_Table[net/sourceforge/pebble/event/blogentry/PostToTwitterBlogEntryListener]
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.blogEntryAdded(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.blogEntryChanged(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.blogEntryPublished(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.blogEntryRemoved(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.blogEntryUnpublished(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.checkUrl(Ljava/lang/String;)Z
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.composeMessage(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.getProperty(Lnet/sourceforge/pebble/domain/BlogEntry;Ljava/lang/String;)Ljava/lang/String;
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.getTwitterPassword(Lnet/sourceforge/pebble/domain/BlogEntry;)Ljava/lang/String;
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.getTwitterUrl(Lnet/sourceforge/pebble/domain/BlogEntry;)Ljava/lang/String;
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.getTwitterUsername(Lnet/sourceforge/pebble/domain/BlogEntry;)Ljava/lang/String;
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.makeTinyURL(Ljava/lang/String;)Ljava/lang/String;
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.post(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): log
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): net/sourceforge/pebble/api/event/blogentry/BlogEntryListener.__Descendant_Table[net/sourceforge/pebble/event/blogentry/PostToTwitterBlogEntryListener]
    //#output(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): net/sourceforge/pebble/event/blogentry/BlogEntryListenerSupport.__Descendant_Table[net/sourceforge/pebble/event/blogentry/PostToTwitterBlogEntryListener]
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Descendant_Table[net/sourceforge/pebble/event/blogentry/PostToTwitterBlogEntryListener] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): net/sourceforge/pebble/api/event/blogentry/BlogEntryListener.__Descendant_Table[net/sourceforge/pebble/event/blogentry/PostToTwitterBlogEntryListener] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): net/sourceforge/pebble/event/blogentry/BlogEntryListenerSupport.__Descendant_Table[net/sourceforge/pebble/event/blogentry/PostToTwitterBlogEntryListener] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.blogEntryAdded(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V == &net/sourceforge/pebble/event/blogentry/BlogEntryListenerSupport.blogEntryAdded
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.blogEntryChanged(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V == &net/sourceforge/pebble/event/blogentry/BlogEntryListenerSupport.blogEntryChanged
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.blogEntryPublished(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V == &blogEntryPublished
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.blogEntryRemoved(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V == &net/sourceforge/pebble/event/blogentry/BlogEntryListenerSupport.blogEntryRemoved
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.blogEntryUnpublished(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V == &net/sourceforge/pebble/event/blogentry/BlogEntryListenerSupport.blogEntryUnpublished
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.checkUrl(Ljava/lang/String;)Z == &checkUrl
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.composeMessage(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; == &composeMessage
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.getProperty(Lnet/sourceforge/pebble/domain/BlogEntry;Ljava/lang/String;)Ljava/lang/String; == &getProperty
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.getTwitterPassword(Lnet/sourceforge/pebble/domain/BlogEntry;)Ljava/lang/String; == &getTwitterPassword
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.getTwitterUrl(Lnet/sourceforge/pebble/domain/BlogEntry;)Ljava/lang/String; == &getTwitterUrl
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.getTwitterUsername(Lnet/sourceforge/pebble/domain/BlogEntry;)Ljava/lang/String; == &getTwitterUsername
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.makeTinyURL(Ljava/lang/String;)Ljava/lang/String; == &makeTinyURL
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): __Dispatch_Table.post(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V == &post
    //#post(net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init): init'ed(log)
    //#posttotwitterblogentrylistener.java:32: end of method: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener__static_init
	private static final String DEFAULT_TWEET_URL="https://twitter.com/";

	/**
	 * Called when a blog entry has been published.
	 * 
	 * @param event
	 *            a BlogEntryEvent instance
	 */
	public void blogEntryPublished(BlogEntryEvent event) {
		BlogEntry blogEntry = event.getBlogEntry();
    //#posttotwitterblogentrylistener.java:42: method: void net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.blogEntryPublished(BlogEntryEvent)
    //#input(void blogEntryPublished(BlogEntryEvent)): __Descendant_Table[net/sourceforge/pebble/event/blogentry/PostToTwitterBlogEntryListener]
    //#input(void blogEntryPublished(BlogEntryEvent)): __Descendant_Table[others]
    //#input(void blogEntryPublished(BlogEntryEvent)): __Dispatch_Table.composeMessage(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //#input(void blogEntryPublished(BlogEntryEvent)): event
    //#input(void blogEntryPublished(BlogEntryEvent)): event.__Tag
    //#input(void blogEntryPublished(BlogEntryEvent)): log
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/Configuration.__Descendant_Table[net/sourceforge/pebble/Configuration]
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/Configuration.__Descendant_Table[others]
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/Configuration.__Dispatch_Table.getUrl()Ljava/lang/String;
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/Configuration.__Dispatch_Table.isVirtualHostingEnabled()Z
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent.__Descendant_Table[net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent]
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent.__Descendant_Table[others]
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent.__Dispatch_Table.getBlogEntry()Lnet/sourceforge/pebble/domain/BlogEntry;
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/api/permalink/PermalinkProvider.__Descendant_Table[net/sourceforge/pebble/api/permalink/PermalinkProvider]
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/api/permalink/PermalinkProvider.__Descendant_Table[others]
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/api/permalink/PermalinkProvider.__Dispatch_Table.getPermalink(Lnet/sourceforge/pebble/domain/BlogEntry;)Ljava/lang/String;
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/AbstractBlog.log
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[net/sourceforge/pebble/domain/Blog]
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[others]
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.error(Ljava/lang/String;)V
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getId()Ljava/lang/String;
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getPermalinkProvider()Lnet/sourceforge/pebble/api/permalink/PermalinkProvider;
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getPluginProperties()Lnet/sourceforge/pebble/PluginProperties;
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getUrl()Ljava/lang/String;
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.info(Ljava/lang/String;)V
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[others]
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getLocalPermalink()Ljava/lang/String;
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getTitle()Ljava/lang/String;
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogManager.__Descendant_Table[net/sourceforge/pebble/domain/BlogManager]
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogManager.__Descendant_Table[others]
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogManager.__Dispatch_Table.isMultiBlog()Z
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogManager.instance
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogManager.instance.__Tag
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogManager.instance.multiBlog
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/Message.__Descendant_Table[net/sourceforge/pebble/domain/Message]
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/Message.__Dispatch_Table.getText()Ljava/lang/String;
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/MessageType.ERROR
    //#input(void blogEntryPublished(BlogEntryEvent)): net/sourceforge/pebble/domain/MessageType.INFO
    //#input(void blogEntryPublished(BlogEntryEvent)): this
    //#input(void blogEntryPublished(BlogEntryEvent)): this.__Tag
    //#pre[1] (void blogEntryPublished(BlogEntryEvent)): event != null
    //#pre[2] (void blogEntryPublished(BlogEntryEvent)): event.__Tag == net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent
    //#pre[3] (void blogEntryPublished(BlogEntryEvent)): (soft) net/sourceforge/pebble/domain/AbstractBlog.log != null
    //#pre[4] (void blogEntryPublished(BlogEntryEvent)): (soft) net/sourceforge/pebble/domain/BlogManager.instance != null
    //#pre[5] (void blogEntryPublished(BlogEntryEvent)): (soft) net/sourceforge/pebble/domain/BlogManager.instance.__Tag == net/sourceforge/pebble/domain/BlogManager
    //#pre[6] (void blogEntryPublished(BlogEntryEvent)): (soft) init'ed(net/sourceforge/pebble/domain/BlogManager.instance.multiBlog)
    //#pre[8] (void blogEntryPublished(BlogEntryEvent)): (soft) this.__Tag == net/sourceforge/pebble/event/blogentry/PostToTwitterBlogEntryListener
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog.__Tag == net/sourceforge/pebble/domain/Blog
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog.__Tag == net/sourceforge/pebble/domain/Blog
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog.__Tag == net/sourceforge/pebble/domain/Blog
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog.__Tag@42 == net/sourceforge/pebble/domain/Blog
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog.__Tag@50 == net/sourceforge/pebble/domain/Blog
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog.permalinkProvider != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog.permalinkProvider.__Tag == net/sourceforge/pebble/api/permalink/PermalinkProvider
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog.pluginProperties != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog.pluginProperties != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog.pluginProperties@42 != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog.pluginProperties@50 != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog.properties != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog.properties != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog.properties@42 != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog.properties@50 != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog@42 != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.blog@50 != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): blogEntry.title@50 != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): getBlog(...).__Tag == net/sourceforge/pebble/domain/Blog
    //#presumption(void blogEntryPublished(BlogEntryEvent)): getBlog(...).messages != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): getBlog(...).messages != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource(...)@91 != null
    //#presumption(void blogEntryPublished(BlogEntryEvent)): net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource(...)@91.__Tag == net/sourceforge/pebble/domain/BlogEntry
    //#presumption(void blogEntryPublished(BlogEntryEvent)): org.apache.commons.logging.LogFactory:getLog(...)@32 != null
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.lang.String:valueOf
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.lang.StringBuffer
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.net.URL
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.net.URL:openConnection
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.net.URLConnection:setDoInput
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.net.URLConnection:setDoOutput
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.net.URLConnection:setUseCaches
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.net.URLConnection:getInputStream
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.io.InputStreamReader
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.io.BufferedReader
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.io.BufferedReader:readLine
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.lang.StringBuffer:append
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.io.BufferedReader:close
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.lang.StringBuffer:toString
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.net.MalformedURLException:getMessage
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.io.IOException:getMessage
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.io.PrintStream:println
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:twitter4j.Twitter
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:twitter4j.Twitter:updateStatus
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:getProperty
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:getBlog
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:getName
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:getPluginProperties
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:net.sourceforge.pebble.PluginProperties:getProperty
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.util.Properties:getProperty
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.util.List:size
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.util.List:subList
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:net.sourceforge.pebble.util.SecurityUtils:getUsername
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.util.Date
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:getUrl
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:getPermalinkProvider
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:getPermalink
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:org.apache.commons.logging.Log:info
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:net.sourceforge.pebble.PebbleContext:getInstance
    //#unanalyzed(void blogEntryPublished(BlogEntryEvent)): Effects-of-calling:net.sourceforge.pebble.PebbleContext:getConfiguration
    //#test_vector(void blogEntryPublished(BlogEntryEvent)): java.lang.String:equalsIgnoreCase(...)@56: {0}, {1}
		String twitterUsername = getTwitterUsername(blogEntry);
		String twitterPassword = getTwitterPassword(blogEntry);
		String twitterUrl = getTwitterUrl(blogEntry);
		if(twitterUsername == null || twitterPassword == null) {
			blogEntry.getBlog().error("Please configure twitter credentials in order to post to twitter");
			return;
		}
		String longUrl = blogEntry.getLocalPermalink();
    //#posttotwitterblogentrylistener.java:50: ?precondition failure
    //#    net/sourceforge/pebble/domain/BlogEntry.getLocalPermalink: (soft) net/sourceforge/pebble/domain/BlogManager.instance.__Tag == net/sourceforge/pebble/domain/BlogManager
    //#    severity: SUPPRESSED
    //#    class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
    //#    method: void blogEntryPublished(BlogEntryEvent)
    //#    basic block: bb_4
    //#    assertion: (soft) net/sourceforge/pebble/domain/BlogManager.instance.__Tag == net/sourceforge/pebble/domain/BlogManager
    //#    callee: String net/sourceforge/pebble/domain/BlogEntry.getLocalPermalink()
    //#    callee assertion: (soft) net/sourceforge/pebble/domain/BlogManager.instance.__Tag == net/sourceforge/pebble/domain/BlogManager
    //#    callee file: blogentry.java
    //#    callee precondition index: [2]
    //#    callee srcpos: 337
    //#    VN: net/sourceforge/pebble/domain/BlogManager.instance.__Tag
    //#    Expected: {790_784}
    //#    Bad: {790_272}
    //#    Attribs:  Int  Exp singleton  Bad singleton  Soft  Bad < Exp  Uncertain
//		if(!checkUrl(longUrl)) {
//			blogEntry.getBlog().error("cowardly refusing to post url '" + longUrl + "' to twitter");
//			return;
//		}
		String tinyUrl = makeTinyURL(longUrl);
		if (tinyUrl.equalsIgnoreCase("error"))
    //#posttotwitterblogentrylistener.java:56: ?null dereference
    //#    tinyUrl != null
    //#    severity: MEDIUM
    //#    class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
    //#    method: void blogEntryPublished(BlogEntryEvent)
    //#    basic block: bb_4
    //#    assertion: tinyUrl != null
    //#    VN: makeTinyURL(...)
    //#    Expected: Inverse{null} or Invalid
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
			tinyUrl = longUrl;
		String msg = composeMessage(blogEntry.getTitle(), longUrl, tinyUrl);
    //#posttotwitterblogentrylistener.java:58: ?null dereference
    //#    __Descendant_Table[this.__Tag] != null
    //#    severity: SUPPRESSED
    //#    class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
    //#    method: void blogEntryPublished(BlogEntryEvent)
    //#    basic block: bb_6
    //#    assertion: __Descendant_Table[this.__Tag] != null
    //#    VN: __Descendant_Table[this.__Tag]
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
    //#posttotwitterblogentrylistener.java:58: ?precondition failure
    //#    net/sourceforge/pebble/event/blogentry/PostToTwitterBlogEntryListener.composeMessage: longUrl != null
    //#    severity: MEDIUM
    //#    class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
    //#    method: void blogEntryPublished(BlogEntryEvent)
    //#    basic block: bb_6
    //#    assertion: getLocalPermalink(...) != null
    //#    callee: String net/sourceforge/pebble/event/blogentry/PostToTwitterBlogEntryListener.composeMessage(String, String, String)
    //#    callee assertion: longUrl != null
    //#    callee file: posttotwitterblogentrylistener.java
    //#    callee precondition index: [1]
    //#    callee srcpos: 90
    //#    VN: getLocalPermalink(...)
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
		try {
			if(getProperty(blogEntry, "simulate") != null) {
				blogEntry.getBlog().info("Found property 'twitter.simulate' - This would have been posted to twitter with username '" + twitterUsername + "':\n" + msg);
			} else {
				post(twitterUrl, twitterUsername, twitterPassword, msg);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		log.debug("Blog entry <a href=\"" + longUrl
    //#posttotwitterblogentrylistener.java:68: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
    //#    method: void blogEntryPublished(BlogEntryEvent)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
				+ "\">" + blogEntry.getTitle() + "</a> tweeted.");
	}
    //#posttotwitterblogentrylistener.java:70: end of method: void net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.blogEntryPublished(BlogEntryEvent)

	/**
	 * make sure that the url we are about to post is one that makes sense to post - e.g. don't post 'localhost' urls.
	 * @param longUrl
	 * @return true if the url passes the (simple) tests and may be posted
	 */
	boolean checkUrl(String longUrl) {
		return ! (longUrl.contains("://localhost:") || longUrl.contains("://localhost/"));
    //#posttotwitterblogentrylistener.java:78: method: bool net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.checkUrl(String)
    //#input(bool checkUrl(String)): longUrl
    //#output(bool checkUrl(String)): return_value
    //#pre[1] (bool checkUrl(String)): longUrl != null
    //#post(bool checkUrl(String)): init'ed(return_value)
    //#posttotwitterblogentrylistener.java:78: end of method: bool net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.checkUrl(String)
	}

	/**
	 * combine message with url. This will use longUrl when enough characters are left, tinyUrl otherwise.
	 * If necessary, the title will be shortened in order to include the full URL
	 * @param title
	 * @param longUrl
	 * @param tinyUrl
	 * @return the "up to 140 character" message to post to twitter
	 */
	String composeMessage(String title, String longUrl, String tinyUrl) {
		if(longUrl.length() + title.length() > 139 ) {
    //#posttotwitterblogentrylistener.java:90: method: String net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.composeMessage(String, String, String)
    //#input(String composeMessage(String, String, String)): longUrl
    //#input(String composeMessage(String, String, String)): tinyUrl
    //#input(String composeMessage(String, String, String)): title
    //#output(String composeMessage(String, String, String)): return_value
    //#pre[1] (String composeMessage(String, String, String)): longUrl != null
    //#pre[3] (String composeMessage(String, String, String)): title != null
    //#pre[2] (String composeMessage(String, String, String)): (soft) tinyUrl != null
    //#presumption(String composeMessage(String, String, String)): java.lang.String:length(...)@92 <= 2_147_483_787
    //#post(String composeMessage(String, String, String)): return_value != null
			if(tinyUrl.length() + title.length() > 139) {
				return title.substring(0, 139-tinyUrl.length()) + " " + tinyUrl;
			} else {
				return title + " " + tinyUrl;
			}
		} else {
			return title + " " + longUrl ;
    //#posttotwitterblogentrylistener.java:97: end of method: String net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.composeMessage(String, String, String)
		}
	}

	/**
	 * get twitter URL to post to. This can be overridden with the blog property twitter.url - e.g. for testing purposes.
	 * @param blogEntry
	 * @return
	 */
	private String getTwitterUrl(BlogEntry blogEntry) {
		String twitterUrl = getProperty(blogEntry, "url");
    //#posttotwitterblogentrylistener.java:107: method: String net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.getTwitterUrl(BlogEntry)
    //#input(String getTwitterUrl(BlogEntry)): blogEntry
    //#input(String getTwitterUrl(BlogEntry)): blogEntry.__Tag
    //#input(String getTwitterUrl(BlogEntry)): blogEntry.blog
    //#input(String getTwitterUrl(BlogEntry)): blogEntry.blog.__Tag
    //#input(String getTwitterUrl(BlogEntry)): blogEntry.blog.pluginProperties
    //#input(String getTwitterUrl(BlogEntry)): blogEntry.blog.properties
    //#input(String getTwitterUrl(BlogEntry)): log
    //#input(String getTwitterUrl(BlogEntry)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[net/sourceforge/pebble/domain/Blog]
    //#input(String getTwitterUrl(BlogEntry)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[others]
    //#input(String getTwitterUrl(BlogEntry)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(String getTwitterUrl(BlogEntry)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getPluginProperties()Lnet/sourceforge/pebble/PluginProperties;
    //#input(String getTwitterUrl(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(String getTwitterUrl(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[others]
    //#input(String getTwitterUrl(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(String getTwitterUrl(BlogEntry)): this
    //#output(String getTwitterUrl(BlogEntry)): return_value
    //#pre[1] (String getTwitterUrl(BlogEntry)): blogEntry != null
    //#pre[2] (String getTwitterUrl(BlogEntry)): blogEntry.__Tag == net/sourceforge/pebble/domain/BlogEntry
    //#pre[3] (String getTwitterUrl(BlogEntry)): blogEntry.blog != null
    //#pre[4] (String getTwitterUrl(BlogEntry)): blogEntry.blog.__Tag == net/sourceforge/pebble/domain/Blog
    //#pre[5] (String getTwitterUrl(BlogEntry)): blogEntry.blog.pluginProperties != null
    //#pre[6] (String getTwitterUrl(BlogEntry)): blogEntry.blog.properties != null
    //#post(String getTwitterUrl(BlogEntry)): return_value != null
    //#unanalyzed(String getTwitterUrl(BlogEntry)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(String getTwitterUrl(BlogEntry)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(String getTwitterUrl(BlogEntry)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(String getTwitterUrl(BlogEntry)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(String getTwitterUrl(BlogEntry)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(String getTwitterUrl(BlogEntry)): Effects-of-calling:getBlog
    //#unanalyzed(String getTwitterUrl(BlogEntry)): Effects-of-calling:getName
    //#unanalyzed(String getTwitterUrl(BlogEntry)): Effects-of-calling:getPluginProperties
    //#unanalyzed(String getTwitterUrl(BlogEntry)): Effects-of-calling:net.sourceforge.pebble.PluginProperties:getProperty
    //#unanalyzed(String getTwitterUrl(BlogEntry)): Effects-of-calling:java.util.Properties:getProperty
		if(twitterUrl == null) twitterUrl = DEFAULT_TWEET_URL;
		return twitterUrl;
    //#posttotwitterblogentrylistener.java:109: end of method: String net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.getTwitterUrl(BlogEntry)
	}

	/**
	 * the password to post to twitter as configured in the blog properties
	 * @param blogEntry
	 * @return
	 */
	private String getTwitterPassword(BlogEntry blogEntry) {
		return getProperty(blogEntry, "password");
    //#posttotwitterblogentrylistener.java:118: method: String net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.getTwitterPassword(BlogEntry)
    //#input(String getTwitterPassword(BlogEntry)): blogEntry
    //#input(String getTwitterPassword(BlogEntry)): blogEntry.__Tag
    //#input(String getTwitterPassword(BlogEntry)): blogEntry.blog
    //#input(String getTwitterPassword(BlogEntry)): blogEntry.blog.__Tag
    //#input(String getTwitterPassword(BlogEntry)): blogEntry.blog.pluginProperties
    //#input(String getTwitterPassword(BlogEntry)): blogEntry.blog.properties
    //#input(String getTwitterPassword(BlogEntry)): log
    //#input(String getTwitterPassword(BlogEntry)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[net/sourceforge/pebble/domain/Blog]
    //#input(String getTwitterPassword(BlogEntry)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[others]
    //#input(String getTwitterPassword(BlogEntry)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(String getTwitterPassword(BlogEntry)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getPluginProperties()Lnet/sourceforge/pebble/PluginProperties;
    //#input(String getTwitterPassword(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(String getTwitterPassword(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[others]
    //#input(String getTwitterPassword(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(String getTwitterPassword(BlogEntry)): this
    //#output(String getTwitterPassword(BlogEntry)): return_value
    //#pre[1] (String getTwitterPassword(BlogEntry)): blogEntry != null
    //#pre[2] (String getTwitterPassword(BlogEntry)): blogEntry.__Tag == net/sourceforge/pebble/domain/BlogEntry
    //#pre[3] (String getTwitterPassword(BlogEntry)): blogEntry.blog != null
    //#pre[4] (String getTwitterPassword(BlogEntry)): blogEntry.blog.__Tag == net/sourceforge/pebble/domain/Blog
    //#pre[5] (String getTwitterPassword(BlogEntry)): blogEntry.blog.pluginProperties != null
    //#pre[6] (String getTwitterPassword(BlogEntry)): blogEntry.blog.properties != null
    //#post(String getTwitterPassword(BlogEntry)): init'ed(return_value)
    //#unanalyzed(String getTwitterPassword(BlogEntry)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(String getTwitterPassword(BlogEntry)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(String getTwitterPassword(BlogEntry)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(String getTwitterPassword(BlogEntry)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(String getTwitterPassword(BlogEntry)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(String getTwitterPassword(BlogEntry)): Effects-of-calling:getBlog
    //#unanalyzed(String getTwitterPassword(BlogEntry)): Effects-of-calling:getName
    //#unanalyzed(String getTwitterPassword(BlogEntry)): Effects-of-calling:getPluginProperties
    //#unanalyzed(String getTwitterPassword(BlogEntry)): Effects-of-calling:net.sourceforge.pebble.PluginProperties:getProperty
    //#unanalyzed(String getTwitterPassword(BlogEntry)): Effects-of-calling:java.util.Properties:getProperty
    //#posttotwitterblogentrylistener.java:118: end of method: String net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.getTwitterPassword(BlogEntry)
	}

	/**
	 * the username to post to twitter as configured in the blog properties
	 * @param blogEntry
	 * @return
	 */
	private String getTwitterUsername(BlogEntry blogEntry) {
		return getProperty(blogEntry, "username");
    //#posttotwitterblogentrylistener.java:127: method: String net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.getTwitterUsername(BlogEntry)
    //#input(String getTwitterUsername(BlogEntry)): blogEntry
    //#input(String getTwitterUsername(BlogEntry)): blogEntry.__Tag
    //#input(String getTwitterUsername(BlogEntry)): blogEntry.blog
    //#input(String getTwitterUsername(BlogEntry)): blogEntry.blog.__Tag
    //#input(String getTwitterUsername(BlogEntry)): blogEntry.blog.pluginProperties
    //#input(String getTwitterUsername(BlogEntry)): blogEntry.blog.properties
    //#input(String getTwitterUsername(BlogEntry)): log
    //#input(String getTwitterUsername(BlogEntry)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[net/sourceforge/pebble/domain/Blog]
    //#input(String getTwitterUsername(BlogEntry)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[others]
    //#input(String getTwitterUsername(BlogEntry)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(String getTwitterUsername(BlogEntry)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getPluginProperties()Lnet/sourceforge/pebble/PluginProperties;
    //#input(String getTwitterUsername(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(String getTwitterUsername(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[others]
    //#input(String getTwitterUsername(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(String getTwitterUsername(BlogEntry)): this
    //#output(String getTwitterUsername(BlogEntry)): return_value
    //#pre[1] (String getTwitterUsername(BlogEntry)): blogEntry != null
    //#pre[2] (String getTwitterUsername(BlogEntry)): blogEntry.__Tag == net/sourceforge/pebble/domain/BlogEntry
    //#pre[3] (String getTwitterUsername(BlogEntry)): blogEntry.blog != null
    //#pre[4] (String getTwitterUsername(BlogEntry)): blogEntry.blog.__Tag == net/sourceforge/pebble/domain/Blog
    //#pre[5] (String getTwitterUsername(BlogEntry)): blogEntry.blog.pluginProperties != null
    //#pre[6] (String getTwitterUsername(BlogEntry)): blogEntry.blog.properties != null
    //#post(String getTwitterUsername(BlogEntry)): init'ed(return_value)
    //#unanalyzed(String getTwitterUsername(BlogEntry)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(String getTwitterUsername(BlogEntry)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(String getTwitterUsername(BlogEntry)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(String getTwitterUsername(BlogEntry)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(String getTwitterUsername(BlogEntry)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(String getTwitterUsername(BlogEntry)): Effects-of-calling:getBlog
    //#unanalyzed(String getTwitterUsername(BlogEntry)): Effects-of-calling:getName
    //#unanalyzed(String getTwitterUsername(BlogEntry)): Effects-of-calling:getPluginProperties
    //#unanalyzed(String getTwitterUsername(BlogEntry)): Effects-of-calling:net.sourceforge.pebble.PluginProperties:getProperty
    //#unanalyzed(String getTwitterUsername(BlogEntry)): Effects-of-calling:java.util.Properties:getProperty
    //#posttotwitterblogentrylistener.java:127: end of method: String net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.getTwitterUsername(BlogEntry)
	}
	
	private String getProperty(BlogEntry blogEntry, String property) {
		Blog blog = blogEntry.getBlog();
    //#posttotwitterblogentrylistener.java:131: method: String net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.getProperty(BlogEntry, String)
    //#input(String getProperty(BlogEntry, String)): blogEntry
    //#input(String getProperty(BlogEntry, String)): blogEntry.__Tag
    //#input(String getProperty(BlogEntry, String)): blogEntry.blog
    //#input(String getProperty(BlogEntry, String)): blogEntry.blog.__Tag
    //#input(String getProperty(BlogEntry, String)): blogEntry.blog.pluginProperties
    //#input(String getProperty(BlogEntry, String)): blogEntry.blog.properties
    //#input(String getProperty(BlogEntry, String)): log
    //#input(String getProperty(BlogEntry, String)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[net/sourceforge/pebble/domain/Blog]
    //#input(String getProperty(BlogEntry, String)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[others]
    //#input(String getProperty(BlogEntry, String)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(String getProperty(BlogEntry, String)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getPluginProperties()Lnet/sourceforge/pebble/PluginProperties;
    //#input(String getProperty(BlogEntry, String)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(String getProperty(BlogEntry, String)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[others]
    //#input(String getProperty(BlogEntry, String)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(String getProperty(BlogEntry, String)): property
    //#output(String getProperty(BlogEntry, String)): return_value
    //#pre[1] (String getProperty(BlogEntry, String)): blogEntry != null
    //#pre[2] (String getProperty(BlogEntry, String)): blogEntry.__Tag == net/sourceforge/pebble/domain/BlogEntry
    //#pre[3] (String getProperty(BlogEntry, String)): blogEntry.blog != null
    //#pre[4] (String getProperty(BlogEntry, String)): blogEntry.blog.__Tag == net/sourceforge/pebble/domain/Blog
    //#pre[5] (String getProperty(BlogEntry, String)): blogEntry.blog.pluginProperties != null
    //#pre[6] (String getProperty(BlogEntry, String)): blogEntry.blog.properties != null
    //#presumption(String getProperty(BlogEntry, String)): org.apache.commons.logging.LogFactory:getLog(...)@32 != null
    //#post(String getProperty(BlogEntry, String)): init'ed(return_value)
    //#unanalyzed(String getProperty(BlogEntry, String)): Effects-of-calling:java.util.Properties:getProperty
    //#test_vector(String getProperty(BlogEntry, String)): net.sourceforge.pebble.PluginProperties:getProperty(...)@134: Inverse{null}, Addr_Set{null}
    //#test_vector(String getProperty(BlogEntry, String)): net.sourceforge.pebble.PluginProperties:getProperty(...)@136: Inverse{null}, Addr_Set{null}
		String blogName = blog.getName();
		PluginProperties pluginProperties = blog.getPluginProperties();
		String result = pluginProperties.getProperty("twitter." + blogName + "." + property);
    //#posttotwitterblogentrylistener.java:134: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.PluginProperties:getProperty(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
    //#    method: String getProperty(BlogEntry, String)
    //#    unanalyzed callee: String net.sourceforge.pebble.PluginProperties:getProperty(String)
		if(result == null) {
			result = pluginProperties.getProperty("twitter." + property);
    //#posttotwitterblogentrylistener.java:136: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.PluginProperties:getProperty(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
    //#    method: String getProperty(BlogEntry, String)
    //#    unanalyzed callee: String net.sourceforge.pebble.PluginProperties:getProperty(String)
			if(result == null) {
				log.error("Twitter credentials (" + property + ") not found. Please configure twitter." + property + " in order to post to twitter");
    //#posttotwitterblogentrylistener.java:138: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
    //#    method: String getProperty(BlogEntry, String)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object)
			} else {
				log.debug("found twitter credentials in twitter." + property );
    //#posttotwitterblogentrylistener.java:140: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
    //#    method: String getProperty(BlogEntry, String)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
			}
		} else {
			log.debug("found twitter credentials in twitter." + blogName + "." + property);
    //#posttotwitterblogentrylistener.java:143: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
    //#    method: String getProperty(BlogEntry, String)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
		}
		return result;
    //#posttotwitterblogentrylistener.java:145: end of method: String net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.getProperty(BlogEntry, String)
	}

	/**
	 * Post the given message to twitter, using the given postUrl and credentials.
	 * @param twitterUrl URL to post to
	 * @param twitterUsername username to post as
	 * @param twitterPassword password to authenticate username
	 * @param msg the message to post to twitter.
	 * @throws Exception
	 */
	private void post(String twitterUrl, String twitterUsername,
			String twitterPassword, String msg) throws Exception {
		System.out.println("Posting to Twitter: " + msg);
    //#posttotwitterblogentrylistener.java:158: method: void net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.post(String, String, String, String)
    //#input(void post(String, String, String, String)): java.lang.System.out
    //#input(void post(String, String, String, String)): msg
    //#input(void post(String, String, String, String)): twitterPassword
    //#input(void post(String, String, String, String)): twitterUsername
    //#presumption(void post(String, String, String, String)): java.lang.System.out != null
		Twitter twitter = new Twitter(twitterUsername, twitterPassword);
    //#posttotwitterblogentrylistener.java:159: Warning: method not available
    //#    -- call on void twitter4j.Twitter(String, String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
    //#    method: void post(String, String, String, String)
    //#    unanalyzed callee: void twitter4j.Twitter(String, String)
		twitter.updateStatus(msg);
    //#posttotwitterblogentrylistener.java:160: Warning: method not available
    //#    -- call on Status twitter4j.Twitter:updateStatus(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
    //#    method: void post(String, String, String, String)
    //#    unanalyzed callee: Status twitter4j.Twitter:updateStatus(String)
	}
    //#posttotwitterblogentrylistener.java:161: end of method: void net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.post(String, String, String, String)


	/**
	 * create a shortened version of the given url
	 * @param url
	 * @return
	 */
	private String makeTinyURL(String url) {
		// http://tinyurl.com/api-create.php?...
		StringBuffer response = new StringBuffer();
    //#posttotwitterblogentrylistener.java:171: method: String net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.makeTinyURL(String)
    //#input(String makeTinyURL(String)): log
    //#input(String makeTinyURL(String)): url
    //#output(String makeTinyURL(String)): return_value
    //#presumption(String makeTinyURL(String)): java.net.URL:openConnection(...)@174 != null
    //#presumption(String makeTinyURL(String)): org.apache.commons.logging.LogFactory:getLog(...)@32 != null
    //#post(String makeTinyURL(String)): init'ed(return_value)
    //#test_vector(String makeTinyURL(String)): java.io.BufferedReader:readLine(...)@180: Inverse{null}, Addr_Set{null}
		try {
			URL turl = new URL("http://tinyurl.com/api-create.php?"+url);
			URLConnection connection = turl.openConnection();
			connection.setDoInput(true);
			connection.setDoOutput(false);
			connection.setUseCaches(false);
			BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
			String r;
			while ((r = in.readLine()) != null) {
				response.append(r);
			}
			in.close();
		}
		catch (MalformedURLException e) {
			log.error(e.getMessage());
    //#posttotwitterblogentrylistener.java:186: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
    //#    method: String makeTinyURL(String)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object)
			return url;
		}
		catch (IOException e) {
			log.error(e.getMessage());
    //#posttotwitterblogentrylistener.java:190: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
    //#    method: String makeTinyURL(String)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object)
			return url;
		}
		log.debug("tinyurl for " + url + " is " + response.toString());
    //#posttotwitterblogentrylistener.java:193: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
    //#    method: String makeTinyURL(String)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
		return response.toString();
    //#posttotwitterblogentrylistener.java:194: end of method: String net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener.makeTinyURL(String)
	}
}
    //#posttotwitterblogentrylistener.java:: end of class: net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
