jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jalka...@apache.org
Subject svn commit: r690570 - /incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java
Date Sat, 30 Aug 2008 19:55:18 GMT
Author: jalkanen
Date: Sat Aug 30 12:55:18 2008
New Revision: 690570

URL: http://svn.apache.org/viewvc?rev=690570&view=rev
Log:
JSPWIKI-354: removeTemplatePart() had an off-by-one error, and therefore was not removing
the template part properly.

Modified:
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java?rev=690570&r1=690569&r2=690570&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/ui/TemplateManager.java Sat Aug 30 12:55:18
2008
@@ -242,26 +242,30 @@
      */
     private static final String removeTemplatePart( String name )
     {
-        int idx = name.indexOf('/');
+        int idx = 0;
+        if( name.startsWith( "/" ) ) idx = 1;
+        
+        idx = name.indexOf('/', idx);
         if( idx != -1 )
         {
-            idx = name.indexOf('/', idx); // Find second "/"
+            idx = name.indexOf('/', idx+1); // Find second "/"
 
             if( idx != -1 )
             {
-                return name.substring( idx+1 );
+                name = name.substring( idx+1 );
             }
         }
 
+        log.info( "Final name = "+name );
         return name;
     }
 
     /**
      *  Returns the full name (/templates/foo/bar) for name=bar, template=foo.
      *
-     * @param template
-     * @param name
-     * @return
+     * @param template The name of the template.
+     * @param name The name of the resource.
+     * @return The full name for a template.
      */
     private static final String makeFullJSPName( String template, String name )
     {



Mime
View raw message