Author: jens
Date: Wed Sep 22 07:55:44 2010
New Revision: 999789

URL: http://svn.apache.org/viewvc?rev=999789&view=rev
Log:
Avoid NPE if includePropertyDefinitions is null in getType... calls

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

Modified: 
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java?rev=999789&r1=999788&r2=999789&view=diff
==============================================================================
--- 
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java
 (original)
+++ 
incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java
 Wed Sep 22 07:55:44 2010
@@ -61,6 +61,7 @@ public class InMemoryRepositoryServiceIm
     public TypeDefinitionList getTypeChildren(CallContext context, String 
repositoryId, String typeId,
             Boolean includePropertyDefinitions, BigInteger maxItems, 
BigInteger skipCount, ExtensionsData extension) {
 
+        boolean inclPropDefs = includePropertyDefinitions == null ? false : 
includePropertyDefinitions;
         getRepositoryInfoFromStoreManager(repositoryId); // just to check if
         // repository
         // exists
@@ -75,7 +76,7 @@ public class InMemoryRepositoryServiceIm
             children = fStoreManager.getRootTypes(repositoryId);
         } else {
             children = getTypeDescendants(context, repositoryId, typeId, 
BigInteger.valueOf(1),
-                    includePropertyDefinitions, null);
+                    inclPropDefs, null);
         }
         result.setNumItems(BigInteger.valueOf(children.size()));
         result.setHasMoreItems(children.size() > max - skip);
@@ -110,7 +111,8 @@ public class InMemoryRepositoryServiceIm
         getRepositoryInfoFromStoreManager(repositoryId); // just to check if
         // repository
         // exists
-
+        boolean inclPropDefs = includePropertyDefinitions == null ? false : 
includePropertyDefinitions;
+        
         if (depth != null && depth.intValue() == 0)
             throw new CmisInvalidArgumentException("depth == 0 is illegal in 
getTypeDescendants");
 
@@ -118,10 +120,10 @@ public class InMemoryRepositoryServiceIm
         if (typeId == null) {
             // spec says that depth must be ignored in this case
             Collection<TypeDefinitionContainer> tmp = 
fStoreManager.getTypeDefinitionList(repositoryId,
-                    includePropertyDefinitions);
+                    inclPropDefs);
             result = new ArrayList<TypeDefinitionContainer>(tmp);
         } else {
-            TypeDefinitionContainer tc = 
fStoreManager.getTypeById(repositoryId, typeId, includePropertyDefinitions,
+            TypeDefinitionContainer tc = 
fStoreManager.getTypeById(repositoryId, typeId, inclPropDefs,
                     depth == null ? -1 : depth.intValue());
             if (tc == null)
                 throw new CmisInvalidArgumentException("unknown type id: " + 
typeId);


Reply via email to