chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1340161 - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src: main/java/org/apache/chemistry/opencmis/inmemory/ main/java/org/apache/chemistry/opencmis/inmemory/server/ main/java/org/apache/chemis...
Date Fri, 18 May 2012 16:29:57 GMT
Author: jens
Date: Fri May 18 16:29:57 2012
New Revision: 1340161

URL: http://svn.apache.org/viewvc?rev=1340161&view=rev
Log:
InMemory: relax constraints on folder names, improve error message

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/NameValidator.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/NameValidator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/NameValidator.java?rev=1340161&r1=1340160&r2=1340161&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/NameValidator.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/NameValidator.java
Fri May 18 16:29:57 2012
@@ -22,7 +22,7 @@ package org.apache.chemistry.opencmis.in
 public class NameValidator {
 
     public static final String ERROR_ILLEGAL_ID = "Id contains illegal characters, allowed
are 'a'..'z', 'A'..'Z', '0'..'9', '-', '_'";
-    public static final String ERROR_ILLEGAL_NAME = "Name contains illegal characters, allowed
are 'a'..'z', 'A'..'Z', '0'..'9', '-', '_', '.', ' '";
+    public static final String ERROR_ILLEGAL_NAME = "Name contains illegal characters, not
allowed are '/', '\\', ':', '\"', '*'. '?', '<','>', '|'";
 
     // Utility class
     private NameValidator() {
@@ -59,8 +59,8 @@ public class NameValidator {
     }
 
     /**
-     * check whether id contains only valid characters Allowed are 'a'..'z',
-     * 'A'..'Z', '0'..'9', '.', '-', ' ', '_';
+     * check whether id contains only valid characters. Not allowed are '/', 
+     * '\\', ':', '\"', '*'. '?', '<','>', '|'"
      *
      * @param s
      *            string to verify
@@ -71,8 +71,8 @@ public class NameValidator {
         }
         for (int i = 0; i < s.length(); i++) {
             char c = s.charAt(i);
-            if (c == '\\' || c == '/' || c == '\'' || c == '\"' || c == ':' || c == '*' ||

-                    c == '?' ||c == '<' || c == '>' && c == '|')
+            if (c == '\\' || c == '/' || c == '\"' || c == ':' || c == '*' || 
+                    c == '?' || c == '<' || c == '>' && c == '|')
                 return false;
         }
         return true;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java?rev=1340161&r1=1340160&r2=1340161&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
Fri May 18 16:29:57 2012
@@ -741,7 +741,7 @@ public class InMemoryObjectServiceImpl e
 
         // check name syntax
         if (!NameValidator.isValidName(name)) {
-            throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
+            throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME + " Name
is: " + name);
         }
 
         TypeValidator.validateVersionStateForCreate((DocumentTypeDefinition) typeDef, versioningState);
@@ -817,8 +817,8 @@ public class InMemoryObjectServiceImpl e
         }
 
         // check name syntax
-        if (!NameValidator.isValidId(folderName)) {
-            throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
+        if (!NameValidator.isValidName(folderName)) {
+            throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME  + "
Name is: " + folderName);
         }
 
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java?rev=1340161&r1=1340160&r2=1340161&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java
Fri May 18 16:29:57 2012
@@ -91,9 +91,6 @@ public class FolderImpl extends Abstract
         try {
             fObjStore.lock();
             String name = so.getName();
-            if (!NameValidator.isValidId(name)) {
-                throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
-            }
 
             boolean hasChild;
             hasChild = hasChild(name);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java?rev=1340161&r1=1340160&r2=1340161&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
Fri May 18 16:29:57 2012
@@ -145,7 +145,7 @@ public class ObjectServiceTest extends A
         }
         // test create a document with an illegal name, should fail:
         try {
-            Properties props = createDocumentProperties("abc ()", DOCUMENT_TYPE_ID);
+            Properties props = createDocumentProperties("abc (:*)", DOCUMENT_TYPE_ID);
             fObjSvc.createDocument(fRepositoryId, props, fRootFolderId, null, VersioningState.NONE,
null, null,
                     null, null);
             fail("Creating  document with an illegal name should fail.");



Mime
View raw message