Author: ajaquith
Date: Mon Jun 8 01:28:28 2009
New Revision: 782492
URL: http://svn.apache.org/viewvc?rev=782492&view=rev
Log:
Fixed bug in BreadCrumbs tag that was causing non-WikiPage contexts to appear
as page "Main". These contexts are now omitted. Fixed related bug where
non-WikiPage contexts were causing NPEs in certain tags, like FeedDiscovery and
PermissionTag.
Modified:
incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/BreadcrumbsTag.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/FeedDiscoveryTag.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/PermissionTag.java
Modified:
incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/BreadcrumbsTag.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/BreadcrumbsTag.java?rev=782492&r1=782491&r2=782492&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/BreadcrumbsTag.java
(original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/BreadcrumbsTag.java
Mon Jun 8 01:28:28 2009
@@ -122,8 +122,6 @@
HttpSession session = pageContext.getSession();
FixedQueue trail = (FixedQueue)
session.getAttribute(BREADCRUMBTRAIL_KEY);
- String page = m_wikiContext.getPage().getName();
-
if( trail == null )
{
trail = new FixedQueue(m_maxQueueSize);
@@ -131,6 +129,7 @@
if( m_wikiContext.getRequestContext().equals( WikiContext.VIEW ) )
{
+ String page = m_wikiContext.getPage().getName();
if( m_wikiContext.getEngine().pageExists( page ) )
{
if( trail.isEmpty() )
Modified:
incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/FeedDiscoveryTag.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/FeedDiscoveryTag.java?rev=782492&r1=782491&r2=782492&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/FeedDiscoveryTag.java
(original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/FeedDiscoveryTag.java
Mon Jun 8 01:28:28 2009
@@ -44,42 +44,43 @@
throws IOException
{
WikiEngine engine = m_wikiContext.getEngine();
- WikiPage page = m_wikiContext.getPage();
-
- String encodedName = engine.encodeName( page.getName() );
-
String rssURL = engine.getGlobalRSSURL();
- String rssFeedURL = engine.getURL(WikiContext.NONE, "rss.jsp",
-
"page="+encodedName+"&mode=wiki",
- true );
if( rssURL != null )
{
String siteName = BlogUtil.getSiteName(m_wikiContext);
siteName = TextUtil.replaceEntities( siteName );
-
pageContext.getOut().print("<link rel=\"alternate\"
type=\"application/rss+xml\" title=\"RSS wiki feed for the entire site.\"
href=\""+rssURL+"\" />\n");
- pageContext.getOut().print("<link rel=\"alternate\"
type=\"application/rss+xml\" title=\"RSS wiki feed for page "+siteName+".\"
href=\""+rssFeedURL+"\" />\n");
-
- // TODO: Enable this
- /*
- pageContext.getOut().print("<link rel=\"service.post\"
type=\"application/atom+xml\" title=\""+
- siteName+"\" href=\""+atomPostURL+"\"
/>\n");
- */
- // FIXME: This does not work always, as plugins are not
initialized until the first fetch
- if( "true".equals(page.getAttribute(WeblogPlugin.ATTR_ISWEBLOG)) )
+
+ WikiPage page = m_wikiContext.getPage();
+ if ( page != null )
{
- String blogFeedURL =
engine.getURL(WikiContext.NONE,"rss.jsp","page="+encodedName,true);
- String atomFeedURL =
engine.getURL(WikiContext.NONE,"rss.jsp","page="+encodedName+"&type=atom",true);
-
- pageContext.getOut().print("<link rel=\"alternate\"
type=\"application/rss+xml\" title=\"RSS feed for weblog "+
- siteName+".\"
href=\""+blogFeedURL+"\" />\n");
+ String encodedName = engine.encodeName( page == null ?
engine.getFrontPage() : page.getName() );
+ String rssFeedURL = engine.getURL(WikiContext.NONE,
"rss.jsp",
+
"page="+encodedName+"&mode=wiki",
+ true );
+ pageContext.getOut().print("<link rel=\"alternate\"
type=\"application/rss+xml\" title=\"RSS wiki feed for page "+siteName+".\"
href=\""+rssFeedURL+"\" />\n");
+
+ // TODO: Enable this
+ /*
+ pageContext.getOut().print("<link rel=\"service.post\"
type=\"application/atom+xml\" title=\""+
+ siteName+"\"
href=\""+atomPostURL+"\" />\n");
+ */
+ // FIXME: This does not work always, as plugins are not
initialized until the first fetch
+ if(
"true".equals(page.getAttribute(WeblogPlugin.ATTR_ISWEBLOG)) )
+ {
+ String blogFeedURL =
engine.getURL(WikiContext.NONE,"rss.jsp","page="+encodedName,true);
+ String atomFeedURL =
engine.getURL(WikiContext.NONE,"rss.jsp","page="+encodedName+"&type=atom",true);
+
+ pageContext.getOut().print("<link rel=\"alternate\"
type=\"application/rss+xml\" title=\"RSS feed for weblog "+
+ siteName+".\"
href=\""+blogFeedURL+"\" />\n");
- pageContext.getOut().print("<link rel=\"service.feed\"
type=\"application/atom+xml\" title=\"Atom 1.0 weblog feed for "+
- siteName+"\"
href=\""+atomFeedURL+"\" />\n");
+ pageContext.getOut().print("<link rel=\"service.feed\"
type=\"application/atom+xml\" title=\"Atom 1.0 weblog feed for "+
+ siteName+"\"
href=\""+atomFeedURL+"\" />\n");
+ }
}
}
-
+
return SKIP_BODY;
}
}
Modified:
incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/PermissionTag.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/PermissionTag.java?rev=782492&r1=782491&r2=782492&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/PermissionTag.java
(original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/tags/PermissionTag.java
Mon Jun 8 01:28:28 2009
@@ -119,7 +119,7 @@
|| EDIT_PREFERENCES.equals( permission ) || EDIT_PROFILE.equals(
permission )
|| LOGIN.equals( permission ) )
{
- gotPermission = mgr.checkPermission( session, new WikiPermission(
page.getWiki(), permission ) );
+ gotPermission = mgr.checkPermission( session, new WikiPermission(
"*", permission ) );
}
else if ( VIEW_GROUP.equals( permission ) )
{