You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2012/04/26 21:05:58 UTC
svn commit: r1331031 -
/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/lifecycle/DefaultRestoreViewSupport.java
Author: lu4242
Date: Thu Apr 26 19:05:58 2012
New Revision: 1331031
URL: http://svn.apache.org/viewvc?rev=1331031&view=rev
Log:
MYFACES-3531 Empty url mapping prefix causes infinite loop in DefaultRestoreViewSupport.handlePrefixMapping (thanks to Paul Nicolucci for provide this patch)
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/lifecycle/DefaultRestoreViewSupport.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/lifecycle/DefaultRestoreViewSupport.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/lifecycle/DefaultRestoreViewSupport.java?rev=1331031&r1=1331030&r2=1331031&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/lifecycle/DefaultRestoreViewSupport.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/lifecycle/DefaultRestoreViewSupport.java Thu Apr 26 19:05:58 2012
@@ -342,7 +342,18 @@ public class DefaultRestoreViewSupport i
was /faces/faces/faces/view.xhtml the result would be simply view.xhtml.
*/
String uri = viewId;
- prefix = prefix + '/'; //need to make sure its really /faces/* and not /facesPage.xhtml
+ if ( "".equals(prefix) )
+ {
+ // if prefix is an empty string, we let it be "//"
+ // in order to prevent an infinite loop in uri.startsWith(-emptyString-).
+ // Furthermore a prefix of "//" is just another double slash prevention.
+ prefix = "//";
+ }
+ else
+ {
+ //need to make sure its really /faces/* and not /facesPage.xhtml
+ prefix = prefix + '/';
+ }
while (uri.startsWith(prefix) || uri.startsWith("//"))
{
if(uri.startsWith(prefix))