chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r929002 - in /incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src: main/java/org/apache/opencmis/inmemory/server/InMemoryObjectServiceImpl.java test/java/org/apache/opencmis/inmemory/ObjectServiceTest.java
Date Tue, 30 Mar 2010 06:09:49 GMT
Author: jens
Date: Tue Mar 30 06:09:48 2010
New Revision: 929002

URL: http://svn.apache.org/viewvc?rev=929002&view=rev
Log:
put name syntax change at proper place where other validations occur

Modified:
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/ObjectServiceTest.java

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryObjectServiceImpl.java?rev=929002&r1=929001&r2=929002&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
Tue Mar 30 06:09:48 2010
@@ -54,6 +54,7 @@ import org.apache.opencmis.commons.provi
 import org.apache.opencmis.commons.provider.RenditionData;
 import org.apache.opencmis.inmemory.DataObjectCreator;
 import org.apache.opencmis.inmemory.FilterParser;
+import org.apache.opencmis.inmemory.NameValidator;
 import org.apache.opencmis.inmemory.TypeValidator;
 import org.apache.opencmis.inmemory.storedobj.api.Content;
 import org.apache.opencmis.inmemory.storedobj.api.Document;
@@ -813,6 +814,10 @@ public class InMemoryObjectServiceImpl e
       throw new RuntimeException("Cannot create a document, with a non-document type: "
           + typeDef.getId());
 
+    // check name syntax
+    if (!NameValidator.isValidId(name))
+      throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
+
     TypeValidator.validateVersionStateForCreate((DocumentTypeDefinition) typeDef, versioningState);
     TypeValidator.validateProperties(typeDef, properties, true);
 
@@ -874,6 +879,11 @@ public class InMemoryObjectServiceImpl e
     if (null == folderName || folderName.length() == 0)
       throw new CmisInvalidArgumentException("Cannot create a folder without a name.");
 
+    // check name syntax
+    if (!NameValidator.isValidId(folderName))
+      throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
+
+
     TypeValidator.validateRequiredSystemProperties(properties);
 
     TypeDefinition typeDef = getTypeDefinition(repositoryId, properties);

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/ObjectServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/ObjectServiceTest.java?rev=929002&r1=929001&r2=929002&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/ObjectServiceTest.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/ObjectServiceTest.java
Tue Mar 30 06:09:48 2010
@@ -120,7 +120,7 @@ public class ObjectServiceTest extends A
       PropertiesData props = createDocumentProperties("abc ()", DOCUMENT_TYPE_ID);
       id = fObjSvc.createDocument(fRepositoryId, props, fRootFolderId, null, VersioningState.NONE,
           null, null, null, null);
-      fail("Creating  document with an illegal should fail.");
+      fail("Creating  document with an illegal name should fail.");
     } catch (Exception e) {
       assertTrue(e instanceof CmisInvalidArgumentException);
       log.info("Creating  document with an illegal name failed as expected.");



Mime
View raw message