[Yanel-commits] rev 53771 - public/yanel/trunk/src/contributions/resources/security-api/src/java/org/wyona/yanel/impl/resources/securityapi

michi at wyona.com michi at wyona.com
Thu Oct 7 13:58:04 CEST 2010


Author: michi
Date: 2010-10-07 13:58:03 +0200 (Thu, 07 Oct 2010)
New Revision: 53771

Modified:
   public/yanel/trunk/src/contributions/resources/security-api/src/java/org/wyona/yanel/impl/resources/securityapi/UserManagerResource.java
Log:
more error messages to response added

Modified: public/yanel/trunk/src/contributions/resources/security-api/src/java/org/wyona/yanel/impl/resources/securityapi/UserManagerResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/security-api/src/java/org/wyona/yanel/impl/resources/securityapi/UserManagerResource.java	2010-10-07 11:25:11 UTC (rev 53770)
+++ public/yanel/trunk/src/contributions/resources/security-api/src/java/org/wyona/yanel/impl/resources/securityapi/UserManagerResource.java	2010-10-07 11:58:03 UTC (rev 53771)
@@ -270,21 +270,29 @@
         int MAX_LENGTH = 30;
         if (id != null && name != null) {
             if (id.length() <= 0 || name.length() <= 0) {
-                log.warn("Either ID or name is empty, hence will not be created!");
+                String message = "Either ID or name is empty, hence will not be created!";
+                log.warn(message);
+                sb.append("<exception status=\"400\">" + message + "</exception>");
             } else if (id.length() > MAX_LENGTH) { // TODO: Make this configurable
-                log.warn("ID '" + id + "' is more than '" + MAX_LENGTH + "' characters, hence will not be created!");
+                String message = "ID '" + id + "' is more than '" + MAX_LENGTH + "' characters, hence will not be created!";
+                log.warn(message);
+                sb.append("<exception status=\"400\">" + message + "</exception>");
             } else if (gm.existsGroup(id)) {
                 String message = "Group with ID '" + id + "' already exists, hence will not be created!";
                 log.warn(message);
                 sb.append("<exception status=\"400\">" + message + "</exception>");
                 //rootElement.appendChild();
             } else if (id.contains("/") || id.contains("*") || id.contains("?") || id.contains(".")) { // TODO: Make this configurable
-                log.warn("ID '" + id + "' contains special characters (/*?.), hence will not be created!");
+                String message = "ID '" + id + "' contains special characters (/*?.), hence will not be created!";
+                log.warn(message);
+                sb.append("<exception status=\"400\">" + message + "</exception>");
             } else {
                 gm.createGroup(id, name);
             }
         } else {
-            log.warn("Either ID or name is null, hence will not be created!");
+            String message = "Either ID or name is null, hence will not be created!";
+            log.warn(message);
+            sb.append("<exception status=\"400\">" + message + "</exception>");
         }
     }
 



More information about the Yanel-commits mailing list