chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r908583 - in /incubator/chemistry/trunk/chemistry: chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
Date Wed, 10 Feb 2010 16:48:59 GMT
Author: fguillaume
Date: Wed Feb 10 16:48:59 2010
New Revision: 908583

URL: http://svn.apache.org/viewvc?rev=908583&view=rev
Log:
CMIS-102: fix NPE in SimpleConnection.getObjectByPath

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
    incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java

Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java?rev=908583&r1=908582&r2=908583&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
Wed Feb 10 16:48:59 2010
@@ -13,6 +13,7 @@
  *
  * Authors:
  *     Florent Guillaume, Nuxeo
+ *     Michael Durig, Day
  */
 package org.apache.chemistry.impl.simple;
 
@@ -469,8 +470,12 @@
                     throw new IllegalArgumentException(
                             "Path must not contain // : " + path);
                 }
+                Set<String> children = repository.children.get(id);
+                if (children == null) {
+                    return null;
+                }
                 String foundId = null;
-                for (String childId : repository.children.get(id)) {
+                for (String childId : children) {
                     SimpleData data = repository.datas.get(childId);
                     String name = (String) data.get(Property.NAME);
                     if (segment.equals(name)) {

Modified: incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java?rev=908583&r1=908582&r2=908583&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
Wed Feb 10 16:48:59 2010
@@ -327,7 +327,10 @@
         assertNotNull(spi.getObjectByPath("/folder 1/folder 2", null));
         assertNotNull(spi.getObjectByPath("/folder 1/folder 2/doc 2", null));
         assertNotNull(spi.getObjectByPath("/folder 1/folder 2/doc 3", null));
-        assertNull(spi.getObjectByPath("/notsuchname", null));
+        assertNull(spi.getObjectByPath("/nosuchname", null));
+        assertNull(spi.getObjectByPath("/nosuchname/foo", null));
+        assertNull(spi.getObjectByPath("/folder 1/nosuchname", null));
+        assertNull(spi.getObjectByPath("/folder 1/doc 1/nosuchname", null));
 
         assertNotNull(conn.getFolder("/"));
         assertNotNull(conn.getFolder("/folder 1"));



Mime
View raw message