You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ne...@apache.org on 2007/02/25 00:36:45 UTC
svn commit: r511371 - in /lenya/trunk/src:
java/org/apache/lenya/cms/publication/URLInformation.java
modules-core/ac/java/src/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java
webapp/global-sitemap.xmap
Author: nettings
Date: Sat Feb 24 15:36:44 2007
New Revision: 511371
URL: http://svn.apache.org/viewvc?view=rev&rev=511371
Log:
avoid NPE when a user requests <host>:<port>/foo.
see bug http://issues.apache.org/bugzilla/show_bug.cgi?id=41694.
* make URLInformation handle null strings gracefully
* check for null strings in DocumentPolicyManagerWrapper
additionally, redirect "*" to "index.html" in global-sitemap.xmap to
avoid spurious authentication warnings.
FIXME: a request of the form <pub-id> without a trailing slash is not
yet handled - it triggers a login usecase, but permission is not granted
regardless of credentials.
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/publication/URLInformation.java
lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java
lenya/trunk/src/webapp/global-sitemap.xmap
Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/URLInformation.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/publication/URLInformation.java?view=diff&rev=511371&r1=511370&r2=511371
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/URLInformation.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/URLInformation.java Sat Feb 24 15:36:44 2007
@@ -39,7 +39,7 @@
public String getArea() {
if (this.area == null) {
String completeArea = getCompleteArea();
- if (completeArea.equals(Publication.DAV_AREA)) {
+ if (Publication.DAV_AREA.equals(completeArea)) {
this.area = Publication.AUTHORING_AREA;
} else {
this.area = completeArea;
Modified: lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java?view=diff&rev=511371&r1=511370&r2=511371
==============================================================================
--- lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java (original)
+++ lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/cms/ac/DocumentPolicyManagerWrapper.java Sat Feb 24 15:36:44 2007
@@ -95,10 +95,14 @@
// have to exist
URLInformation info = new URLInformation(webappUrl);
+ // Danger, Will Robinson! If area or pubId is null, webappUrl.substring()
+ // will be out of bounds, because null becomes "null" in string concatenation
String pubId = info.getPublicationId();
String area = info.getArea();
- String prefix = "/" + pubId + "/";
- String prefixWithArea = prefix + area;
+ String prefix = "/" + ((pubId != null) ? pubId : "");
+ // String prefix = "/" + pubId + "/";
+ String prefixWithArea = prefix + ((area != null) ? area : "");
+ // String prefixWithArea = prefix + area;
String authoringUrl = prefix + Publication.AUTHORING_AREA
+ webappUrl.substring(prefixWithArea.length());
Modified: lenya/trunk/src/webapp/global-sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/webapp/global-sitemap.xmap?view=diff&rev=511371&r1=511370&r2=511371
==============================================================================
--- lenya/trunk/src/webapp/global-sitemap.xmap (original)
+++ lenya/trunk/src/webapp/global-sitemap.xmap Sat Feb 24 15:36:44 2007
@@ -301,10 +301,6 @@
</map:pipeline>
<map:pipeline>
- <map:match pattern="">
- <map:redirect-to uri="index.html"/>
- </map:match>
-
<map:match pattern="index.html">
<map:aggregate element="lenya" ns="http://apache.org/cocoon/lenya/publication/1.0" prefix="lenya" label="aggregate">
<map:part src="cocoon:/publications.xml"/>
@@ -318,6 +314,10 @@
<map:generate src="lenya/content/about.xml"/>
<map:call resource="style-cms-page"/>
<map:serialize />
+ </map:match>
+
+ <map:match pattern="*">
+ <map:redirect-to uri="index.html"/>
</map:match>
<!-- Publications -->
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org