Revision: 1015
          http://stripes.svn.sourceforge.net/stripes/?rev=1015&view=rev
Author:   bengunter
Date:     2008-12-23 14:57:47 +0000 (Tue, 23 Dec 2008)

Log Message:
-----------
Fixed STS-588. NameBasedActionResolver was throwing an exception calling 
charAt(0) for URLs that ended in "/".

Modified Paths:
--------------
    
trunk/stripes/src/net/sourceforge/stripes/controller/NameBasedActionResolver.java

Modified: 
trunk/stripes/src/net/sourceforge/stripes/controller/NameBasedActionResolver.java
===================================================================
--- 
trunk/stripes/src/net/sourceforge/stripes/controller/NameBasedActionResolver.java
   2008-12-12 16:15:19 UTC (rev 1014)
+++ 
trunk/stripes/src/net/sourceforge/stripes/controller/NameBasedActionResolver.java
   2008-12-23 14:57:47 UTC (rev 1015)
@@ -361,26 +361,28 @@
         String name = (lastPeriod >= path.length()) ? 
urlBinding.substring(path.length(), lastPeriod)
                                                     : 
urlBinding.substring(path.length());
 
-        // This will try /account/ViewAccount.jsp
-        attempts.add(path + name + ".jsp");
+        if (name.length() > 0) {
+            // This will try /account/ViewAccount.jsp
+            attempts.add(path + name + ".jsp");
 
-        // This will try /account/viewAccount.jsp
-        name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
-        attempts.add(path + name + ".jsp");
+            // This will try /account/viewAccount.jsp
+            name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
+            attempts.add(path + name + ".jsp");
 
-        // And finally this will try /account/view_account.jsp
-        StringBuilder builder = new StringBuilder();
-        for (int i=0; i<name.length(); ++i) {
-            char ch = name.charAt(i);
-            if (Character.isUpperCase(ch)) {
-                builder.append("_");
-                builder.append(Character.toLowerCase(ch));
+            // And finally this will try /account/view_account.jsp
+            StringBuilder builder = new StringBuilder();
+            for (int i = 0; i < name.length(); ++i) {
+                char ch = name.charAt(i);
+                if (Character.isUpperCase(ch)) {
+                    builder.append("_");
+                    builder.append(Character.toLowerCase(ch));
+                }
+                else {
+                    builder.append(ch);
+                }
             }
-            else {
-                builder.append(ch);
-            }
+            attempts.add(path + builder.toString() + ".jsp");
         }
-        attempts.add(path + builder.toString() + ".jsp");
 
         return attempts;
     }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to