chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1511442 - /chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
Date Wed, 07 Aug 2013 19:13:38 GMT
Author: jens
Date: Wed Aug  7 19:13:38 2013
New Revision: 1511442

URL: http://svn.apache.org/r1511442
Log:
InMemory: small fix to avoid potential NPE

Modified:
    chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java?rev=1511442&r1=1511441&r2=1511442&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
(original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
Wed Aug  7 19:13:38 2013
@@ -669,17 +669,17 @@ public class InMemoryObjectServiceImpl e
 
                 PropertyData<?> value = properties.getProperties().get(key);
                 PropertyDefinition<?> propDef = typeDef.getPropertyDefinitions().get(key);
+                if (cmis11 && null == propDef) {
+                    TypeDefinition typeDefSecondary = getSecondaryTypeDefinition(repositoryId,
secondaryTypeIds, key);
+                    if (null == typeDefSecondary)
+                        throw new CmisInvalidArgumentException("Cannot update property "
+ key
+                                + ": not contained in type");
+                    propDef = typeDefSecondary.getPropertyDefinitions().get(key);
+                }
+                
                 if (null == propDef) {
-                    if (cmis11) {
-                        TypeDefinition typeDefSecondary = getSecondaryTypeDefinition(repositoryId,
secondaryTypeIds, key);
-                        if (null == typeDefSecondary)
-                            throw new CmisInvalidArgumentException("Cannot update property
" + key
-                                    + ": not contained in type");
-                        propDef = typeDefSecondary.getPropertyDefinitions().get(key);
-                    } else {
-                        throw new CmisInvalidArgumentException("Unknown property " + key
-                                + ": not contained in type");                        
-                    }
+                    throw new CmisInvalidArgumentException("Unknown property " + key
+                            + ": not contained in type (or any secondary type)");       
                
                 }
 
                 if (value.getValues() == null || value.getFirstValue() == null) {
@@ -693,12 +693,12 @@ public class InMemoryObjectServiceImpl e
                     oldProperties.remove(key);
                     hasUpdatedProp = true;
                 } else {
-                    if (propDef.getUpdatability().equals(Updatability.WHENCHECKEDOUT)) {
+                    if (propDef.getUpdatability() == Updatability.WHENCHECKEDOUT) {
                         if (!isCheckedOut)
                             throw new CmisUpdateConflictException(
                                     "updateProperties failed, following property can't be
updated, because it is not checked-out: "
                                             + key);
-                    } else if (!propDef.getUpdatability().equals(Updatability.READWRITE))
{
+                    } else if (propDef.getUpdatability() != Updatability.READWRITE) {
                         throw new CmisConstraintException(
                                 "updateProperties failed, following property can't be updated,
because it is not writable: "
                                         + key);



Mime
View raw message