//# 0 errors, 146 messages
//#
/*
    //#titlepermalinkprovider.java:1:1: class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#titlepermalinkprovider.java:1:1: method: net.sourceforge.pebble.permalink.TitlePermalinkProvider.net.sourceforge.pebble.permalink.TitlePermalinkProvider__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.permalink;

import net.sourceforge.pebble.domain.*;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

/**
 * Generates permalinks based upon the blog entry title. This implementation
 * only uses the following characters from the title:
 * <ul>
 * <li>a-z</li>
 * <li>A-Z</li>
 * <li>0-9</li>
 * <li>_ (underscore)</li>
 * </ul>
 * For titles without these characters (e.g. those using an extended character
 * set) the blog entry ID is used for the permalink instead.
 *
 * @author Simon Brown
 */
public class TitlePermalinkProvider extends PermalinkProviderSupport {
    //#titlepermalinkprovider.java:56: method: void net.sourceforge.pebble.permalink.TitlePermalinkProvider.net.sourceforge.pebble.permalink.TitlePermalinkProvider()
    //#input(void net.sourceforge.pebble.permalink.TitlePermalinkProvider()): this
    //#titlepermalinkprovider.java:56: end of method: void net.sourceforge.pebble.permalink.TitlePermalinkProvider.net.sourceforge.pebble.permalink.TitlePermalinkProvider()

  /** the regex used to check for a blog entry permalink */
  private static final String BLOG_ENTRY_PERMALINK_REGEX = "/\\d\\d\\d\\d/\\d\\d/\\d\\d/[\\w]*.html";

  /**
   * Gets the permalink for a blog entry.
   *
   * @return  a URI as a String
   */
  public synchronized String getPermalink(BlogEntry blogEntry) {
    if (blogEntry.getTitle() == null || blogEntry.getTitle().length() == 0) {
    //#titlepermalinkprovider.java:67: method: String net.sourceforge.pebble.permalink.TitlePermalinkProvider.getPermalink(BlogEntry)
    //#titlepermalinkprovider.java:67: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getTitle()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String getPermalink(BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getTitle()
    //#input(String getPermalink(BlogEntry)): __Descendant_Table[net/sourceforge/pebble/permalink/TitlePermalinkProvider]
    //#input(String getPermalink(BlogEntry)): __Descendant_Table[others]
    //#input(String getPermalink(BlogEntry)): __Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(String getPermalink(BlogEntry)): blogEntry
    //#input(String getPermalink(BlogEntry)): this
    //#input(String getPermalink(BlogEntry)): this.__Tag
    //#input(String getPermalink(BlogEntry)): this.blog
    //#output(String getPermalink(BlogEntry)): return_value
    //#pre[1] (String getPermalink(BlogEntry)): blogEntry != null
    //#pre[3] (String getPermalink(BlogEntry)): (soft) this.__Tag == net/sourceforge/pebble/permalink/TitlePermalinkProvider
    //#pre[4] (String getPermalink(BlogEntry)): (soft) this.blog != null
    //#presumption(String getPermalink(BlogEntry)): java.util.List:indexOf(...)@74 - java.util.List:size(...)@74 in -4_294_967_296..6_442_450_942
    //#presumption(String getPermalink(BlogEntry)): java.util.List:size(...)@74 >= -2_147_483_647
    //#presumption(String getPermalink(BlogEntry)): net.sourceforge.pebble.domain.Blog:getBlogForDay(...)@71 != null
    //#presumption(String getPermalink(BlogEntry)): net.sourceforge.pebble.domain.BlogEntry:getTitle(...)@67 != null
    //#presumption(String getPermalink(BlogEntry)): net.sourceforge.pebble.domain.BlogEntry:getTitle(...)@77 != null
    //#presumption(String getPermalink(BlogEntry)): net.sourceforge.pebble.domain.BlogService:getBlogEntry(...)@76 != null
    //#presumption(String getPermalink(BlogEntry)): net.sourceforge.pebble.domain.Day:getBlogEntries(...)@72 != null
    //#post(String getPermalink(BlogEntry)): return_value != null
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getTitle
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getId
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:java.lang.String:replaceAll
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getBlog
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getDate
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:java.text.SimpleDateFormat
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:net.sourceforge.pebble.domain.Blog:getTimeZone
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:java.text.DateFormat:setTimeZone
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:java.lang.StringBuffer
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:java.lang.StringBuffer:append
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:java.text.DateFormat:format
    //#unanalyzed(String getPermalink(BlogEntry)): Effects-of-calling:java.lang.StringBuffer:toString
    //#test_vector(String getPermalink(BlogEntry)): java.lang.String:equals(...)@77: {0}, {1}
    //#test_vector(String getPermalink(BlogEntry)): java.lang.String:length(...)@67: {1..4_294_967_295}, {0}
    //#test_vector(String getPermalink(BlogEntry)): net.sourceforge.pebble.domain.BlogEntry:getTitle(...)@67: Addr_Set{null}, Inverse{null}
      return buildPermalink(blogEntry) + ".html";
    } else {
      BlogService service = new BlogService();
    //#titlepermalinkprovider.java:70: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogService()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String getPermalink(BlogEntry)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogService()
      Day day = getBlog().getBlogForDay(blogEntry.getDate());
    //#titlepermalinkprovider.java:71: Warning: method not available
    //#    -- call on Date net.sourceforge.pebble.domain.BlogEntry:getDate()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String getPermalink(BlogEntry)
    //#    unanalyzed callee: Date net.sourceforge.pebble.domain.BlogEntry:getDate()
    //#titlepermalinkprovider.java:71: Warning: method not available
    //#    -- call on Day net.sourceforge.pebble.domain.Blog:getBlogForDay(Date)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String getPermalink(BlogEntry)
    //#    unanalyzed callee: Day net.sourceforge.pebble.domain.Blog:getBlogForDay(Date)
      List entries = day.getBlogEntries();
    //#titlepermalinkprovider.java:72: Warning: method not available
    //#    -- call on List net.sourceforge.pebble.domain.Day:getBlogEntries()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String getPermalink(BlogEntry)
    //#    unanalyzed callee: List net.sourceforge.pebble.domain.Day:getBlogEntries()
      int count = 0;
      for (int i = entries.size()-1; i > entries.indexOf(blogEntry.getId()); i--) {
    //#titlepermalinkprovider.java:74: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getId()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String getPermalink(BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getId()
        try {
          BlogEntry entry = service.getBlogEntry(getBlog(), (String)entries.get(i));
    //#titlepermalinkprovider.java:76: Warning: method not available
    //#    -- call on BlogEntry net.sourceforge.pebble.domain.BlogService:getBlogEntry(Blog, String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String getPermalink(BlogEntry)
    //#    unanalyzed callee: BlogEntry net.sourceforge.pebble.domain.BlogService:getBlogEntry(Blog, String)
          if (entry.getTitle().equals(blogEntry.getTitle())) {
    //#titlepermalinkprovider.java:77: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getTitle()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String getPermalink(BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getTitle()
            count++;
          }
        } catch (BlogServiceException e) {
          // do nothing
        }
      }

      if (count == 0) {
        return buildPermalink(blogEntry) + ".html";
      } else {
        return buildPermalink(blogEntry) + "_" + blogEntry.getId() + ".html";
    //#titlepermalinkprovider.java:88: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getId()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String getPermalink(BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getId()
    //#titlepermalinkprovider.java:88: end of method: String net.sourceforge.pebble.permalink.TitlePermalinkProvider.getPermalink(BlogEntry)
      }
    }
  }

  private String buildPermalink(BlogEntry blogEntry) {
    String title = blogEntry.getTitle();
    //#titlepermalinkprovider.java:94: method: String net.sourceforge.pebble.permalink.TitlePermalinkProvider.buildPermalink(BlogEntry)
    //#titlepermalinkprovider.java:94: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getTitle()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String buildPermalink(BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getTitle()
    //#input(String buildPermalink(BlogEntry)): blogEntry
    //#output(String buildPermalink(BlogEntry)): return_value
    //#pre[1] (String buildPermalink(BlogEntry)): blogEntry != null
    //#presumption(String buildPermalink(BlogEntry)): net.sourceforge.pebble.domain.BlogEntry:getBlog(...)@111 != null
    //#post(String buildPermalink(BlogEntry)): return_value != null
    //#test_vector(String buildPermalink(BlogEntry)): java.lang.String:length(...)@107: {1..4_294_967_295}, {0}
    //#test_vector(String buildPermalink(BlogEntry)): java.lang.String:length(...)@95: {1..4_294_967_295}, {0}
    //#test_vector(String buildPermalink(BlogEntry)): net.sourceforge.pebble.domain.BlogEntry:getTitle(...)@94: Addr_Set{null}, Inverse{null}
    if (title == null || title.length() == 0) {
      title = "" + blogEntry.getId();
    //#titlepermalinkprovider.java:96: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getId()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String buildPermalink(BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getId()
    } else {
      title = title.toLowerCase();
      title = title.replaceAll("[\\. ,;/\\\\-]", "_");
      title = title.replaceAll("[^a-z0-9_]", "");
      title = title.replaceAll("_+", "_");
      title = title.replaceAll("^_*", "");
      title = title.replaceAll("_*$", "");
    }

    // if the title has been blanked out, use the blog entry instead
    if (title == null || title.length() == 0) {
    //#titlepermalinkprovider.java:107: Warning: test always goes same way
    //#    test predetermined because title != null
    //#    severity: LOW
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String buildPermalink(BlogEntry)
    //#    from bb: bb_5
    //#    live edge: bb_5-->bb_6
    //#    tested vn: title == null
    //#    tested vn values: {0}
      title = "" + blogEntry.getId();
    //#titlepermalinkprovider.java:108: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getId()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String buildPermalink(BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getId()
    }

    Blog blog = blogEntry.getBlog();
    //#titlepermalinkprovider.java:111: Warning: method not available
    //#    -- call on Blog net.sourceforge.pebble.domain.BlogEntry:getBlog()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String buildPermalink(BlogEntry)
    //#    unanalyzed callee: Blog net.sourceforge.pebble.domain.BlogEntry:getBlog()
    Date date = blogEntry.getDate();
    //#titlepermalinkprovider.java:112: Warning: method not available
    //#    -- call on Date net.sourceforge.pebble.domain.BlogEntry:getDate()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String buildPermalink(BlogEntry)
    //#    unanalyzed callee: Date net.sourceforge.pebble.domain.BlogEntry:getDate()
    DateFormat year = new SimpleDateFormat("yyyy");
    year.setTimeZone(blog.getTimeZone());
    //#titlepermalinkprovider.java:114: Warning: method not available
    //#    -- call on TimeZone net.sourceforge.pebble.domain.Blog:getTimeZone()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String buildPermalink(BlogEntry)
    //#    unanalyzed callee: TimeZone net.sourceforge.pebble.domain.Blog:getTimeZone()
    DateFormat month = new SimpleDateFormat("MM");
    month.setTimeZone(blog.getTimeZone());
    //#titlepermalinkprovider.java:116: Warning: method not available
    //#    -- call on TimeZone net.sourceforge.pebble.domain.Blog:getTimeZone()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String buildPermalink(BlogEntry)
    //#    unanalyzed callee: TimeZone net.sourceforge.pebble.domain.Blog:getTimeZone()
    DateFormat day = new SimpleDateFormat("dd");
    day.setTimeZone(blog.getTimeZone());
    //#titlepermalinkprovider.java:118: Warning: method not available
    //#    -- call on TimeZone net.sourceforge.pebble.domain.Blog:getTimeZone()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: String buildPermalink(BlogEntry)
    //#    unanalyzed callee: TimeZone net.sourceforge.pebble.domain.Blog:getTimeZone()

    StringBuffer buf = new StringBuffer();
    buf.append("/");
    buf.append(year.format(date));
    buf.append("/");
    buf.append(month.format(date));
    buf.append("/");
    buf.append(day.format(date));
    buf.append("/");
    buf.append(title);

    return buf.toString();
    //#titlepermalinkprovider.java:130: end of method: String net.sourceforge.pebble.permalink.TitlePermalinkProvider.buildPermalink(BlogEntry)
  }

  /**
   * Determines whether the specified URI is a blog entry permalink.
   *
   * @param uri   a relative URI
   * @return      true if the URI represents a permalink to a blog entry,
   *              false otherwise
   */
  public boolean isBlogEntryPermalink(String uri) {
    if (uri != null) {
    //#titlepermalinkprovider.java:141: method: bool net.sourceforge.pebble.permalink.TitlePermalinkProvider.isBlogEntryPermalink(String)
    //#input(bool isBlogEntryPermalink(String)): uri
    //#output(bool isBlogEntryPermalink(String)): return_value
    //#post(bool isBlogEntryPermalink(String)): init'ed(return_value)
    //#test_vector(bool isBlogEntryPermalink(String)): uri: Addr_Set{null}, Inverse{null}
      return uri.matches(BLOG_ENTRY_PERMALINK_REGEX);
    } else {
      return false;
    //#titlepermalinkprovider.java:144: end of method: bool net.sourceforge.pebble.permalink.TitlePermalinkProvider.isBlogEntryPermalink(String)
    }
  }

  /**
   * Gets the blog entry referred to by the specified URI.
   *
   * @param uri   a relative URI
   * @return  a BlogEntry instance, or null if one can't be found
   */
  public BlogEntry getBlogEntry(String uri) {
    BlogService service = new BlogService();
    //#titlepermalinkprovider.java:155: method: BlogEntry net.sourceforge.pebble.permalink.TitlePermalinkProvider.getBlogEntry(String)
    //#titlepermalinkprovider.java:155: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogService()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: BlogEntry getBlogEntry(String)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogService()
    //#input(BlogEntry getBlogEntry(String)): __Descendant_Table[net/sourceforge/pebble/permalink/TitlePermalinkProvider]
    //#input(BlogEntry getBlogEntry(String)): __Descendant_Table[others]
    //#input(BlogEntry getBlogEntry(String)): __Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(BlogEntry getBlogEntry(String)): __Dispatch_Table.getDay(Ljava/lang/String;)Lnet/sourceforge/pebble/domain/Day;
    //#input(BlogEntry getBlogEntry(String)): net/sourceforge/pebble/permalink/DefaultPermalinkProvider.__Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(BlogEntry getBlogEntry(String)): net/sourceforge/pebble/permalink/PermalinkProviderSupport.__Descendant_Table[net/sourceforge/pebble/permalink/DefaultPermalinkProvider]
    //#input(BlogEntry getBlogEntry(String)): net/sourceforge/pebble/permalink/PermalinkProviderSupport.__Descendant_Table[net/sourceforge/pebble/permalink/PermalinkProviderSupport]
    //#input(BlogEntry getBlogEntry(String)): net/sourceforge/pebble/permalink/PermalinkProviderSupport.__Descendant_Table[net/sourceforge/pebble/permalink/ShortPermalinkProvider]
    //#input(BlogEntry getBlogEntry(String)): net/sourceforge/pebble/permalink/PermalinkProviderSupport.__Descendant_Table[net/sourceforge/pebble/permalink/TitlePermalinkProvider]
    //#input(BlogEntry getBlogEntry(String)): net/sourceforge/pebble/permalink/PermalinkProviderSupport.__Descendant_Table[others]
    //#input(BlogEntry getBlogEntry(String)): net/sourceforge/pebble/permalink/PermalinkProviderSupport.__Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(BlogEntry getBlogEntry(String)): net/sourceforge/pebble/permalink/ShortPermalinkProvider.__Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(BlogEntry getBlogEntry(String)): this
    //#input(BlogEntry getBlogEntry(String)): this.__Tag
    //#input(BlogEntry getBlogEntry(String)): this.blog
    //#input(BlogEntry getBlogEntry(String)): uri
    //#output(BlogEntry getBlogEntry(String)): return_value
    //#pre[2] (BlogEntry getBlogEntry(String)): this.__Tag == net/sourceforge/pebble/permalink/TitlePermalinkProvider
    //#pre[3] (BlogEntry getBlogEntry(String)): this.blog != null
    //#pre[4] (BlogEntry getBlogEntry(String)): uri != null
    //#presumption(BlogEntry getBlogEntry(String)): net.sourceforge.pebble.domain.Blog:getBlogForDay(...)@154 != null
    //#presumption(BlogEntry getBlogEntry(String)): net.sourceforge.pebble.domain.BlogEntry:getLocalPermalink(...)@164 != null
    //#presumption(BlogEntry getBlogEntry(String)): net.sourceforge.pebble.domain.BlogService:getBlogEntry(...)@161 != null
    //#presumption(BlogEntry getBlogEntry(String)): net.sourceforge.pebble.domain.Day:getBlogEntries(...)@158 != null
    //#post(BlogEntry getBlogEntry(String)): init'ed(return_value)
    //#unanalyzed(BlogEntry getBlogEntry(String)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(BlogEntry getBlogEntry(String)): Effects-of-calling:java.lang.Integer:parseInt
    //#unanalyzed(BlogEntry getBlogEntry(String)): Effects-of-calling:net.sourceforge.pebble.domain.Blog:getBlogForDay
    //#test_vector(BlogEntry getBlogEntry(String)): java.lang.String:endsWith(...)@164: {0}, {1}
    //#test_vector(BlogEntry getBlogEntry(String)): java.util.Iterator:hasNext(...)@159: {1}, {0}
    Day day = getDay(uri);

    Iterator it = day.getBlogEntries().iterator();
    //#titlepermalinkprovider.java:158: Warning: method not available
    //#    -- call on List net.sourceforge.pebble.domain.Day:getBlogEntries()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: BlogEntry getBlogEntry(String)
    //#    unanalyzed callee: List net.sourceforge.pebble.domain.Day:getBlogEntries()
    while (it.hasNext()) {
      try {
        BlogEntry blogEntry = service.getBlogEntry(getBlog(), (String)it.next());
    //#titlepermalinkprovider.java:161: Warning: method not available
    //#    -- call on BlogEntry net.sourceforge.pebble.domain.BlogService:getBlogEntry(Blog, String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: BlogEntry getBlogEntry(String)
    //#    unanalyzed callee: BlogEntry net.sourceforge.pebble.domain.BlogService:getBlogEntry(Blog, String)
        // use the local permalink, just in case the entry has been aggregated
        // and an original permalink assigned
        if (blogEntry.getLocalPermalink().endsWith(uri)) {
    //#titlepermalinkprovider.java:164: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getLocalPermalink()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
    //#    method: BlogEntry getBlogEntry(String)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getLocalPermalink()
          return blogEntry;
        }
      } catch (BlogServiceException e) {
        // do nothing
      }
    }

    return null;
    //#titlepermalinkprovider.java:172: end of method: BlogEntry net.sourceforge.pebble.permalink.TitlePermalinkProvider.getBlogEntry(String)
  }

}
    //#output(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Descendant_Table[net/sourceforge/pebble/permalink/TitlePermalinkProvider]
    //#output(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.buildPermalink(Lnet/sourceforge/pebble/domain/BlogEntry;)Ljava/lang/String;
    //#output(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#output(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.getBlogEntry(Ljava/lang/String;)Lnet/sourceforge/pebble/domain/BlogEntry;
    //#output(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.getDay(Ljava/lang/String;)Lnet/sourceforge/pebble/domain/Day;
    //#output(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.getMonth(Ljava/lang/String;)Lnet/sourceforge/pebble/domain/Month;
    //#output(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.getPermalink(Lnet/sourceforge/pebble/domain/BlogEntry;)Ljava/lang/String;
    //#output(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.getPermalink(Lnet/sourceforge/pebble/domain/Day;)Ljava/lang/String;
    //#output(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.getPermalink(Lnet/sourceforge/pebble/domain/Month;)Ljava/lang/String;
    //#output(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.isBlogEntryPermalink(Ljava/lang/String;)Z
    //#output(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.isDayPermalink(Ljava/lang/String;)Z
    //#output(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.isMonthPermalink(Ljava/lang/String;)Z
    //#output(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.setBlog(Lnet/sourceforge/pebble/domain/Blog;)V
    //#output(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): net/sourceforge/pebble/permalink/PermalinkProviderSupport.__Descendant_Table[net/sourceforge/pebble/permalink/TitlePermalinkProvider]
    //#post(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Descendant_Table[net/sourceforge/pebble/permalink/TitlePermalinkProvider] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): net/sourceforge/pebble/permalink/PermalinkProviderSupport.__Descendant_Table[net/sourceforge/pebble/permalink/TitlePermalinkProvider] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.buildPermalink(Lnet/sourceforge/pebble/domain/BlogEntry;)Ljava/lang/String; == &buildPermalink
    //#post(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog; == &net/sourceforge/pebble/permalink/PermalinkProviderSupport.getBlog
    //#post(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.getBlogEntry(Ljava/lang/String;)Lnet/sourceforge/pebble/domain/BlogEntry; == &getBlogEntry
    //#post(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.getDay(Ljava/lang/String;)Lnet/sourceforge/pebble/domain/Day; == &net/sourceforge/pebble/permalink/PermalinkProviderSupport.getDay
    //#post(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.getMonth(Ljava/lang/String;)Lnet/sourceforge/pebble/domain/Month; == &net/sourceforge/pebble/permalink/PermalinkProviderSupport.getMonth
    //#post(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.getPermalink(Lnet/sourceforge/pebble/domain/BlogEntry;)Ljava/lang/String; == &getPermalink
    //#post(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.getPermalink(Lnet/sourceforge/pebble/domain/Day;)Ljava/lang/String; == &net/sourceforge/pebble/permalink/PermalinkProviderSupport.getPermalink
    //#post(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.getPermalink(Lnet/sourceforge/pebble/domain/Month;)Ljava/lang/String; == &net/sourceforge/pebble/permalink/PermalinkProviderSupport.getPermalink
    //#post(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.isBlogEntryPermalink(Ljava/lang/String;)Z == &isBlogEntryPermalink
    //#post(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.isDayPermalink(Ljava/lang/String;)Z == &net/sourceforge/pebble/permalink/PermalinkProviderSupport.isDayPermalink
    //#post(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.isMonthPermalink(Ljava/lang/String;)Z == &net/sourceforge/pebble/permalink/PermalinkProviderSupport.isMonthPermalink
    //#post(net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init): __Dispatch_Table.setBlog(Lnet/sourceforge/pebble/domain/Blog;)V == &net/sourceforge/pebble/permalink/PermalinkProviderSupport.setBlog
    //#titlepermalinkprovider.java:: end of method: net.sourceforge.pebble.permalink.TitlePermalinkProvider.net.sourceforge.pebble.permalink.TitlePermalinkProvider__static_init
    //#titlepermalinkprovider.java:: end of class: net.sourceforge.pebble.permalink.TitlePermalinkProvider
