Author: ludovic
Date: 2008-01-17 01:07:43 +0100 (Thu, 17 Jan 2008)
New Revision: 6879

Modified:
   
xwiki-products/curriki/trunk/plugins/currikispacemanager/src/main/java/org/curriki/plugin/spacemanager/impl/CurrikiSpace.java
Log:
CURRIKI-1492 Error with ' in title

Modified: 
xwiki-products/curriki/trunk/plugins/currikispacemanager/src/main/java/org/curriki/plugin/spacemanager/impl/CurrikiSpace.java
===================================================================
--- 
xwiki-products/curriki/trunk/plugins/currikispacemanager/src/main/java/org/curriki/plugin/spacemanager/impl/CurrikiSpace.java
       2008-01-16 23:15:57 UTC (rev 6878)
+++ 
xwiki-products/curriki/trunk/plugins/currikispacemanager/src/main/java/org/curriki/plugin/spacemanager/impl/CurrikiSpace.java
       2008-01-17 00:07:43 UTC (rev 6879)
@@ -60,7 +60,7 @@
                boolean success = true;
                Map errors = new HashMap();
        
-               try {
+               try {                                                           
                                                                                
             success &= doc.validate(context);
             
             //title
@@ -86,7 +86,7 @@
             //same title
             List list = 
context.getWiki().getStore().searchDocumentsNames(",BaseObject as obj, 
StringProperty as tprop where doc.fullName=obj.name and obj.className='"
                                     + manager.getSpaceClassName() + "' and 
obj.id=tprop.id.id and tprop.id.name='"
-                                    + SPACE_DISPLAYTITLE + "' and 
tprop.value='" + this.getDisplayTitle() + "' and doc.fullName<>'" + 
getSpaceName() + ".WebPreferences'", context);
+                                    + SPACE_DISPLAYTITLE + "' and 
tprop.value='" + this.getDisplayTitle().replaceAll("'","''") + "' and 
doc.fullName<>'" + getSpaceName() + ".WebPreferences'", context);
             if(list!=null && list.size()>0)
                         errors.put( this.VALIDATION_TITLE_EXISTS, "1" );
 
@@ -101,7 +101,7 @@
             if (url.length()>0) {
                 list = 
context.getWiki().getStore().searchDocumentsNames(",BaseObject as obj, 
StringProperty as urlprop where doc.fullName=obj.name and obj.className='"
                         + manager.getSpaceClassName() + "' and 
obj.id=urlprop.id.id and urlprop.id.name='"
-                        + SPACE_URLSHORTCUT + "' and urlprop.value='" + 
this.getHomeShortcutURL() + "' and doc.fullName<>'" + getSpaceName() + 
".WebPreferences'", context);
+                        + SPACE_URLSHORTCUT + "' and urlprop.value='" + 
this.getHomeShortcutURL().replaceAll("'","''") + "' and doc.fullName<>'" + 
getSpaceName() + ".WebPreferences'", context);
                 if(list!=null && list.size()>0)
                     errors.put( this.VALIDATION_URL_EXISTS, "1" );
             }

_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to