chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1235359 - /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/
Date Tue, 24 Jan 2012 17:10:48 GMT
Author: jens
Date: Tue Jan 24 17:10:48 2012
New Revision: 1235359

URL: http://svn.apache.org/viewvc?rev=1235359&view=rev
Log:
add some more tolerance against null properties

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.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/server/InMemoryVersioningServiceImpl.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.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/InMemoryAbstractServiceImpl.java?rev=1235359&r1=1235358&r2=1235359&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.java
Tue Jan 24 17:10:48 2012
@@ -53,6 +53,9 @@ public class InMemoryAbstractServiceImpl
     }
 
     protected TypeDefinition getTypeDefinition(String repositoryId, Properties properties)
{
+        if (null == properties)
+            return null;
+        
         String typeId = (String) properties.getProperties().get(PropertyIds.OBJECT_TYPE_ID).getFirstValue();
         TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, typeId);
         if (typeDefC == null) {

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=1235359&r1=1235358&r2=1235359&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
Tue Jan 24 17:10:48 2012
@@ -114,7 +114,7 @@ public class InMemoryObjectServiceImpl e
 
         LOG.debug("start createDocumentFromSource()");
         StoredObject so = validator.createDocumentFromSource(context, repositoryId, sourceId,
folderId, extension);
-        TypeDefinition td = getTypeDefinition(repositoryId, so);  // typedefinition may be
copied from source object
+        TypeDefinition td = getTypeDefinition(repositoryId, so);  // type definition may
be copied from source object
 
         ContentStream content = getContentStream(context, repositoryId, sourceId, null, BigInteger.valueOf(-1),
                 BigInteger.valueOf(-1), null);
@@ -693,9 +693,13 @@ public class InMemoryObjectServiceImpl e
             ContentStream contentStream, VersioningState versioningState, List<String>
policies, Acl addACEs,
             Acl removeACEs, ExtensionsData extension) {
 
+        validator.createDocument(context, repositoryId, folderId, extension);
+
+        // Validation stuff
+        TypeValidator.validateRequiredSystemProperties(properties);
+
         String user = context.getUsername();
         TypeDefinition typeDef = getTypeDefinition(repositoryId, properties);
-        validator.createDocument(context, repositoryId, folderId, extension);
 
         ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);
         Map<String, PropertyData<?>> propMap = properties.getProperties();
@@ -703,8 +707,6 @@ public class InMemoryObjectServiceImpl e
         PropertyData<?> pd = propMap.get(PropertyIds.NAME);
         String name = (String) pd.getFirstValue();
 
-        // Validation stuff
-        TypeValidator.validateRequiredSystemProperties(properties);
 
         // validate ACL
         TypeValidator.validateAcl(typeDef, addACEs, removeACEs);
@@ -794,10 +796,9 @@ public class InMemoryObjectServiceImpl e
     private Folder createFolderIntern(CallContext context, String repositoryId, Properties
properties, String folderId,
             List<String> policies, Acl addACEs, Acl removeACEs, ExtensionsData extension)
{
 
-        // Attach the CallContext to a thread local context that can be accessed
-        // from everywhere
-        String user = context.getUsername();
         validator.createFolder(context, repositoryId, folderId, extension);
+        TypeValidator.validateRequiredSystemProperties(properties);
+        String user = context.getUsername();
 
         ObjectStore fs = fStoreManager.getObjectStore(repositoryId);
         StoredObject so = null;
@@ -815,7 +816,6 @@ public class InMemoryObjectServiceImpl e
             throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
         }
 
-        TypeValidator.validateRequiredSystemProperties(properties);
 
         TypeDefinition typeDef = getTypeDefinition(repositoryId, properties);
 
@@ -873,9 +873,11 @@ public class InMemoryObjectServiceImpl e
             Properties properties, List<String> policies,
             Acl addACEs, Acl removeACEs, ExtensionsData extension) {
 
-         String user = context.getUsername();
+        TypeValidator.validateRequiredSystemProperties(properties);
 
-          // get required properties
+        String user = context.getUsername();
+        
+        // get required properties
         PropertyData<?> pd = properties.getProperties().get(PropertyIds.SOURCE_ID);
         String sourceId = (String) pd.getFirstValue();
         if (null == sourceId || sourceId.length() == 0)
@@ -894,7 +896,6 @@ public class InMemoryObjectServiceImpl e
 
        StoredObject[] relationObjects = validator.createRelationship(context, repositoryId,
sourceId, targetId, extension);
 
-       TypeValidator.validateRequiredSystemProperties(properties);
 
        // set default properties
        Map<String, PropertyData<?>> propMap = properties.getProperties();

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.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/InMemoryVersioningServiceImpl.java?rev=1235359&r1=1235358&r2=1235359&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java
Tue Jan 24 17:10:48 2012
@@ -80,8 +80,6 @@ public class InMemoryVersioningServiceIm
         String user = context.getUsername();
         VersionedDocument verDoc = testHasProperCheckedOutStatus(so, user);
 
-        DocumentVersion pwc = verDoc.getPwc();
-
         verDoc.checkIn(major, properties, contentStream, checkinComment, user);
 
         // To be able to provide all Atom links in the response we need



Mime
View raw message