//# 1 errors, 201 messages
//#
/*
    //#tidylistener.java:1:1: class: net.sourceforge.pebble.event.blogentry.TidyListener
 * 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.blogentry;

import net.sourceforge.pebble.domain.BlogEntry;
import net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
import org.w3c.tidy.Tidy;

import java.beans.PropertyChangeEvent;
import java.util.Iterator;
import java.util.List;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

/**
 * Runs W3C Tidy over the excerpt and body of blog entries so that
 * they are valid XHTML.
 *
 * @author Simon Brown
 */
public class TidyListener extends BlogEntryListenerSupport {
    //#tidylistener.java:53: method: void net.sourceforge.pebble.event.blogentry.TidyListener.net.sourceforge.pebble.event.blogentry.TidyListener()
    //#input(void net.sourceforge.pebble.event.blogentry.TidyListener()): this
    //#tidylistener.java:53: end of method: void net.sourceforge.pebble.event.blogentry.TidyListener.net.sourceforge.pebble.event.blogentry.TidyListener()

  /** the log used by this class */
  private static final Log log = LogFactory.getLog(TidyListener.class);
    //#tidylistener.java:56: method: net.sourceforge.pebble.event.blogentry.TidyListener.net.sourceforge.pebble.event.blogentry.TidyListener__static_init
    //#tidylistener.java:56: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.TidyListener
    //#    method: net.sourceforge.pebble.event.blogentry.TidyListener__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): __Descendant_Table[net/sourceforge/pebble/event/blogentry/TidyListener]
    //#output(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): __Dispatch_Table.blogEntryAdded(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V
    //#output(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): __Dispatch_Table.blogEntryChanged(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V
    //#output(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): __Dispatch_Table.blogEntryPublished(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V
    //#output(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): __Dispatch_Table.blogEntryRemoved(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V
    //#output(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): __Dispatch_Table.blogEntryUnpublished(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V
    //#output(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): __Dispatch_Table.tidy(Ljava/lang/String;)Ljava/lang/String;
    //#output(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): __Dispatch_Table.tidy(Lnet/sourceforge/pebble/domain/BlogEntry;)V
    //#output(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): log
    //#output(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): net/sourceforge/pebble/api/event/blogentry/BlogEntryListener.__Descendant_Table[net/sourceforge/pebble/event/blogentry/TidyListener]
    //#output(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): net/sourceforge/pebble/event/blogentry/BlogEntryListenerSupport.__Descendant_Table[net/sourceforge/pebble/event/blogentry/TidyListener]
    //#post(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): __Descendant_Table[net/sourceforge/pebble/event/blogentry/TidyListener] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): net/sourceforge/pebble/api/event/blogentry/BlogEntryListener.__Descendant_Table[net/sourceforge/pebble/event/blogentry/TidyListener] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): net/sourceforge/pebble/event/blogentry/BlogEntryListenerSupport.__Descendant_Table[net/sourceforge/pebble/event/blogentry/TidyListener] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): __Dispatch_Table.blogEntryAdded(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V == &blogEntryAdded
    //#post(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): __Dispatch_Table.blogEntryChanged(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V == &blogEntryChanged
    //#post(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): __Dispatch_Table.blogEntryPublished(Lnet/sourceforge/pebble/api/event/blogentry/BlogEntryEvent;)V == &net/sourceforge/pebble/event/blogentry/BlogEntryListenerSupport.blogEntryPublished
    //#post(net.sourceforge.pebble.event.blogentry.TidyListener__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.TidyListener__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.TidyListener__static_init): __Dispatch_Table.tidy(Ljava/lang/String;)Ljava/lang/String; == &tidy
    //#post(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): __Dispatch_Table.tidy(Lnet/sourceforge/pebble/domain/BlogEntry;)V == &tidy
    //#post(net.sourceforge.pebble.event.blogentry.TidyListener__static_init): init'ed(log)
    //#tidylistener.java:56: end of method: net.sourceforge.pebble.event.blogentry.TidyListener.net.sourceforge.pebble.event.blogentry.TidyListener__static_init

  /**
   * Called when a blog entry has been added.
   *
   * @param event   a BlogEntryEvent instance
   */
  public void blogEntryAdded(BlogEntryEvent event) {
    tidy(event.getBlogEntry());
    //#tidylistener.java:64: method: void net.sourceforge.pebble.event.blogentry.TidyListener.blogEntryAdded(BlogEntryEvent)
    //#input(void blogEntryAdded(BlogEntryEvent)): event
    //#input(void blogEntryAdded(BlogEntryEvent)): event.__Tag
    //#input(void blogEntryAdded(BlogEntryEvent)): net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent.__Descendant_Table[net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent]
    //#input(void blogEntryAdded(BlogEntryEvent)): net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent.__Descendant_Table[others]
    //#input(void blogEntryAdded(BlogEntryEvent)): net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent.__Dispatch_Table.getBlogEntry()Lnet/sourceforge/pebble/domain/BlogEntry;
    //#input(void blogEntryAdded(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(void blogEntryAdded(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[others]
    //#input(void blogEntryAdded(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getBody()Ljava/lang/String;
    //#input(void blogEntryAdded(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getExcerpt()Ljava/lang/String;
    //#input(void blogEntryAdded(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.setBody(Ljava/lang/String;)V
    //#input(void blogEntryAdded(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.setExcerpt(Ljava/lang/String;)V
    //#input(void blogEntryAdded(BlogEntryEvent)): this
    //#pre[1] (void blogEntryAdded(BlogEntryEvent)): event != null
    //#pre[2] (void blogEntryAdded(BlogEntryEvent)): event.__Tag == net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent
    //#presumption(void blogEntryAdded(BlogEntryEvent)): getBlogEntry(...).propertyChangeSupport@64 != null
    //#presumption(void blogEntryAdded(BlogEntryEvent)): net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource(...)@91 != null
    //#presumption(void blogEntryAdded(BlogEntryEvent)): net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource(...)@91.__Tag == net/sourceforge/pebble/domain/BlogEntry
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:java.lang.String:getBytes
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:java.io.ByteArrayInputStream
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:java.io.ByteArrayOutputStream
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:setXHTML
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:setDocType
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:setQuiet
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:setShowWarnings
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:setIndentContent
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:setSmartIndent
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:setIndentAttributes
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:setWraplen
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:parseDOM
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:pprint
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:java.io.ByteArrayOutputStream:toByteArray
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:java.lang.String
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:getExcerpt
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:setExcerpt
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:getBody
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:setBody
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource
    //#unanalyzed(void blogEntryAdded(BlogEntryEvent)): Effects-of-calling:java.beans.PropertyChangeSupport:firePropertyChange
  }
    //#tidylistener.java:65: end of method: void net.sourceforge.pebble.event.blogentry.TidyListener.blogEntryAdded(BlogEntryEvent)

  /**
   * Called when a blog entry has been changed.
   *
   * @param event a BlogEntryEvent instance
   */
  public void blogEntryChanged(BlogEntryEvent event) {
    List propertyChangeEvents = event.getPropertyChangeEvents();
    //#tidylistener.java:73: method: void net.sourceforge.pebble.event.blogentry.TidyListener.blogEntryChanged(BlogEntryEvent)
    //#input(void blogEntryChanged(BlogEntryEvent)): event
    //#input(void blogEntryChanged(BlogEntryEvent)): event.__Tag
    //#input(void blogEntryChanged(BlogEntryEvent)): event.propertyChangeEvents
    //#input(void blogEntryChanged(BlogEntryEvent)): net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent.__Descendant_Table[net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent]
    //#input(void blogEntryChanged(BlogEntryEvent)): net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent.__Descendant_Table[others]
    //#input(void blogEntryChanged(BlogEntryEvent)): net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent.__Dispatch_Table.getBlogEntry()Lnet/sourceforge/pebble/domain/BlogEntry;
    //#input(void blogEntryChanged(BlogEntryEvent)): net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent.__Dispatch_Table.getPropertyChangeEvents()Ljava/util/List;
    //#input(void blogEntryChanged(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(void blogEntryChanged(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[others]
    //#input(void blogEntryChanged(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getBody()Ljava/lang/String;
    //#input(void blogEntryChanged(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getExcerpt()Ljava/lang/String;
    //#input(void blogEntryChanged(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.setBody(Ljava/lang/String;)V
    //#input(void blogEntryChanged(BlogEntryEvent)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.setExcerpt(Ljava/lang/String;)V
    //#input(void blogEntryChanged(BlogEntryEvent)): this
    //#pre[1] (void blogEntryChanged(BlogEntryEvent)): event != null
    //#pre[2] (void blogEntryChanged(BlogEntryEvent)): event.__Tag == net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent
    //#pre[3] (void blogEntryChanged(BlogEntryEvent)): event.propertyChangeEvents != null
    //#presumption(void blogEntryChanged(BlogEntryEvent)): getBlogEntry(...).propertyChangeSupport@80 != null
    //#presumption(void blogEntryChanged(BlogEntryEvent)): java.beans.PropertyChangeEvent:getPropertyName(...)@77 != null
    //#presumption(void blogEntryChanged(BlogEntryEvent)): java.util.Iterator:next(...)@76 != null
    //#presumption(void blogEntryChanged(BlogEntryEvent)): net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource(...)@91 != null
    //#presumption(void blogEntryChanged(BlogEntryEvent)): net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource(...)@91.__Tag == net/sourceforge/pebble/domain/BlogEntry
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:java.lang.String:getBytes
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:java.io.ByteArrayInputStream
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:java.io.ByteArrayOutputStream
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:setXHTML
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:setDocType
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:setQuiet
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:setShowWarnings
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:setIndentContent
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:setSmartIndent
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:setIndentAttributes
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:setWraplen
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:parseDOM
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:org.w3c.tidy.Tidy:pprint
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:java.io.ByteArrayOutputStream:toByteArray
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:java.lang.String
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:getExcerpt
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:setExcerpt
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:getBody
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:setBody
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource
    //#unanalyzed(void blogEntryChanged(BlogEntryEvent)): Effects-of-calling:java.beans.PropertyChangeSupport:firePropertyChange
    //#test_vector(void blogEntryChanged(BlogEntryEvent)): java.lang.String:equals(...)@78: {1}, {0}
    //#test_vector(void blogEntryChanged(BlogEntryEvent)): java.lang.String:equals(...)@79: {0}, {1}
    //#test_vector(void blogEntryChanged(BlogEntryEvent)): java.util.Iterator:hasNext(...)@75: {1}, {0}
    Iterator it = propertyChangeEvents.iterator();
    while (it.hasNext()) {
      PropertyChangeEvent pce = (PropertyChangeEvent)it.next();
      String property = pce.getPropertyName();
      if (property.equals(BlogEntry.EXCERPT_PROPERTY) ||
          property.equals(BlogEntry.BODY_PROPERTY)) {
        tidy(event.getBlogEntry());
    //#tidylistener.java:80: ?null dereference
    //#    net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent.__Descendant_Table[event.__Tag] != null
    //#    severity: SUPPRESSED
    //#    class: net.sourceforge.pebble.event.blogentry.TidyListener
    //#    method: void blogEntryChanged(BlogEntryEvent)
    //#    basic block: bb_4
    //#    assertion: net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent.__Descendant_Table[event.__Tag] != null
    //#    VN: net/sourceforge/pebble/api/event/blogentry/BlogEntryEvent.__Descendant_Table[event.__Tag]
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
      }
    }
  }
    //#tidylistener.java:83: end of method: void net.sourceforge.pebble.event.blogentry.TidyListener.blogEntryChanged(BlogEntryEvent)

  private void tidy(BlogEntry blogEntry) {
    blogEntry.setExcerpt(tidy(blogEntry.getExcerpt()));
    //#tidylistener.java:86: method: void net.sourceforge.pebble.event.blogentry.TidyListener.tidy(BlogEntry)
    //#input(void tidy(BlogEntry)): blogEntry
    //#input(void tidy(BlogEntry)): blogEntry.__Tag
    //#input(void tidy(BlogEntry)): blogEntry.body
    //#input(void tidy(BlogEntry)): blogEntry.excerpt
    //#input(void tidy(BlogEntry)): blogEntry.propertyChangeSupport
    //#input(void tidy(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(void tidy(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[others]
    //#input(void tidy(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getBody()Ljava/lang/String;
    //#input(void tidy(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getExcerpt()Ljava/lang/String;
    //#input(void tidy(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.setBody(Ljava/lang/String;)V
    //#input(void tidy(BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.setExcerpt(Ljava/lang/String;)V
    //#input(void tidy(BlogEntry)): this
    //#output(void tidy(BlogEntry)): blogEntry.body
    //#output(void tidy(BlogEntry)): blogEntry.excerpt
    //#pre[1] (void tidy(BlogEntry)): blogEntry != null
    //#pre[2] (void tidy(BlogEntry)): blogEntry.__Tag == net/sourceforge/pebble/domain/BlogEntry
    //#pre[3] (void tidy(BlogEntry)): blogEntry.propertyChangeSupport != null
    //#pre[4] (void tidy(BlogEntry)): init'ed(blogEntry.body)
    //#pre[5] (void tidy(BlogEntry)): init'ed(blogEntry.excerpt)
    //#post(void tidy(BlogEntry)): blogEntry.body != null
    //#post(void tidy(BlogEntry)): init'ed(blogEntry.excerpt)
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:java.lang.String:getBytes
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:java.io.ByteArrayInputStream
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:java.io.ByteArrayOutputStream
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:org.w3c.tidy.Tidy
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:org.w3c.tidy.Tidy:setXHTML
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:org.w3c.tidy.Tidy:setDocType
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:org.w3c.tidy.Tidy:setQuiet
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:org.w3c.tidy.Tidy:setShowWarnings
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:org.w3c.tidy.Tidy:setIndentContent
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:org.w3c.tidy.Tidy:setSmartIndent
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:org.w3c.tidy.Tidy:setIndentAttributes
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:org.w3c.tidy.Tidy:setWraplen
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:org.w3c.tidy.Tidy:parseDOM
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:org.w3c.tidy.Tidy:pprint
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:java.io.ByteArrayOutputStream:toByteArray
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:java.lang.String
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void tidy(BlogEntry)): Effects-of-calling:java.beans.PropertyChangeSupport:firePropertyChange
    blogEntry.setBody(tidy(blogEntry.getBody()));
  }
    //#tidylistener.java:88: end of method: void net.sourceforge.pebble.event.blogentry.TidyListener.tidy(BlogEntry)

  private String tidy(String s) {
    if (s != null && s.length() > 0) {
    //#tidylistener.java:91: method: String net.sourceforge.pebble.event.blogentry.TidyListener.tidy(String)
    //#input(String tidy(String)): s
    //#output(String tidy(String)): return_value
    //#presumption(String tidy(String)): java.lang.String:indexOf(...)@109 + java.lang.String:length(...)@109 in -2_147_483_648..4_294_967_295
    //#post(String tidy(String)): return_value != null
    //#test_vector(String tidy(String)): s: Addr_Set{null}, Inverse{null}
    //#test_vector(String tidy(String)): java.lang.String:length(...)@91: {0}, {1..4_294_967_295}
      s = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
          "<html xmlns=\"http://www.w3.org/1999/xhtml\"><title></title><body>" + s + "</body></html>";
      ByteArrayInputStream in = new ByteArrayInputStream(s.getBytes());
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      Tidy tidy = new Tidy();
    //#tidylistener.java:96: Warning: method not available
    //#    -- call on void org.w3c.tidy.Tidy()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.TidyListener
    //#    method: String tidy(String)
    //#    unanalyzed callee: void org.w3c.tidy.Tidy()
      tidy.setXHTML(true);
    //#tidylistener.java:97: Warning: method not available
    //#    -- call on void org.w3c.tidy.Tidy:setXHTML(bool)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.TidyListener
    //#    method: String tidy(String)
    //#    unanalyzed callee: void org.w3c.tidy.Tidy:setXHTML(bool)
      tidy.setDocType("\"-//W3C//DTD XHTML 1.0 Transitional//EN\"");
    //#tidylistener.java:98: Warning: method not available
    //#    -- call on void org.w3c.tidy.Tidy:setDocType(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.TidyListener
    //#    method: String tidy(String)
    //#    unanalyzed callee: void org.w3c.tidy.Tidy:setDocType(String)
      tidy.setQuiet(true);
    //#tidylistener.java:99: Warning: method not available
    //#    -- call on void org.w3c.tidy.Tidy:setQuiet(bool)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.TidyListener
    //#    method: String tidy(String)
    //#    unanalyzed callee: void org.w3c.tidy.Tidy:setQuiet(bool)
      tidy.setShowWarnings(false);
    //#tidylistener.java:100: Warning: method not available
    //#    -- call on void org.w3c.tidy.Tidy:setShowWarnings(bool)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.TidyListener
    //#    method: String tidy(String)
    //#    unanalyzed callee: void org.w3c.tidy.Tidy:setShowWarnings(bool)
      tidy.setIndentContent(false);
    //#tidylistener.java:101: Warning: method not available
    //#    -- call on void org.w3c.tidy.Tidy:setIndentContent(bool)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.TidyListener
    //#    method: String tidy(String)
    //#    unanalyzed callee: void org.w3c.tidy.Tidy:setIndentContent(bool)
      tidy.setSmartIndent(false);
    //#tidylistener.java:102: Warning: method not available
    //#    -- call on void org.w3c.tidy.Tidy:setSmartIndent(bool)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.TidyListener
    //#    method: String tidy(String)
    //#    unanalyzed callee: void org.w3c.tidy.Tidy:setSmartIndent(bool)
      tidy.setIndentAttributes(false);
    //#tidylistener.java:103: Warning: method not available
    //#    -- call on void org.w3c.tidy.Tidy:setIndentAttributes(bool)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.TidyListener
    //#    method: String tidy(String)
    //#    unanalyzed callee: void org.w3c.tidy.Tidy:setIndentAttributes(bool)
      tidy.setWraplen(0);
    //#tidylistener.java:104: Warning: method not available
    //#    -- call on void org.w3c.tidy.Tidy:setWraplen(int)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.TidyListener
    //#    method: String tidy(String)
    //#    unanalyzed callee: void org.w3c.tidy.Tidy:setWraplen(int)
      Document doc = tidy.parseDOM(in, null);
    //#tidylistener.java:105: Warning: method not available
    //#    -- call on Document org.w3c.tidy.Tidy:parseDOM(InputStream, OutputStream)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.TidyListener
    //#    method: String tidy(String)
    //#    unanalyzed callee: Document org.w3c.tidy.Tidy:parseDOM(InputStream, OutputStream)
      tidy.pprint(doc, out);
    //#tidylistener.java:106: Warning: method not available
    //#    -- call on void org.w3c.tidy.Tidy:pprint(Document, OutputStream)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.event.blogentry.TidyListener
    //#    method: String tidy(String)
    //#    unanalyzed callee: void org.w3c.tidy.Tidy:pprint(Document, OutputStream)

      String tidied = new String(out.toByteArray());
      return tidied.substring(tidied.indexOf("<body>")+"<body>".length(), tidied.indexOf("</body>")).trim();
    } else {
      return "";
    //#tidylistener.java:111: end of method: String net.sourceforge.pebble.event.blogentry.TidyListener.tidy(String)
    }
  }

}
    //#tidylistener.java:: end of class: net.sourceforge.pebble.event.blogentry.TidyListener
