### Eclipse Workspace Patch 1.0
#P xwiki-core
Index: src/main/resources/ApplicationResources.properties
===================================================================
--- src/main/resources/ApplicationResources.properties (revision 32887)
+++ src/main/resources/ApplicationResources.properties (working copy)
@@ -234,7 +234,7 @@
Names must not start with a number or punctuation character. \
Names must not start with the letters xml (or XML, or Xml, etc). \
Names cannot contain spaces.
-
+propertyexists="Property {0} already exists"
backtoedit=Back To Edit
browsernoncompatible=Browser is non compatible!
wysiwygeditor=WYSIWYG Editor
Index: src/main/java/com/xpn/xwiki/web/PropAddAction.java
===================================================================
--- src/main/java/com/xpn/xwiki/web/PropAddAction.java (revision 32887)
+++ src/main/java/com/xpn/xwiki/web/PropAddAction.java (working copy)
@@ -20,6 +20,9 @@
*/
package com.xpn.xwiki.web;
+import java.util.ArrayList;
+import java.util.List;
+
import javax.servlet.http.HttpServletResponse;
import com.xpn.xwiki.XWiki;
@@ -60,7 +63,12 @@
BaseClass bclass = doc.getxWikiClass();
bclass.setName(doc.getFullName());
if (bclass.get(propName) != null) {
- // TODO: handle the error of the property already existing when we want to add a class property
+ context.put("message", "propertyexists");
+ List params = new ArrayList();
+ params.add(propName);
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST, context.getMessageTool().get(
+ "propertyexists", params));
+ return true;
} else {
MetaClass mclass = xwiki.getMetaclass();
PropertyMetaClass pmclass = (PropertyMetaClass) mclass.get(propType);