|
|
Choosing A Webhost: |
svn commit: r511371 - in /lenya/trunk/src: java/org/apache/lenya/cms/public: msg#00132cms.lenya.cvs
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 -->
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |