InMemory: small fix to avoid potential NPE

git-svn-id: https://svn.apache.org/repos/asf/chemistry/opencmis/branches/inmemory-refactoring@1511442 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java b/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
index 1593de3..611358d 100644
--- a/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
+++ b/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
@@ -669,17 +669,17 @@
 
                 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 @@
                     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);