incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1353511 - in /sling/trunk/bundles/jcr/resource/src: main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java test/java/org/apache/sling/jcr/resource/internal/JcrPropertyMapTest.java
Date Mon, 25 Jun 2012 13:05:39 GMT
Author: cziegeler
Date: Mon Jun 25 13:05:37 2012
New Revision: 1353511

URL: http://svn.apache.org/viewvc?rev=1353511&view=rev
Log:
SLING-2518 : Exception thrown from jcrPropertyMap.containsKey("")

Modified:
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
    sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrPropertyMapTest.java

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java?rev=1353511&r1=1353510&r2=1353511&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
Mon Jun 25 13:05:37 2012
@@ -290,6 +290,10 @@ public class JcrPropertyMap
      * @throws IllegalArgumentException if a repository exception occurs
      */
     JcrPropertyMapCacheEntry read(final String name) {
+        // check for empty key
+        if ( name.length() == 0 ) {
+            return null;
+        }
         // if the name is a path, we should handle this differently
         if ( name.indexOf('/') != -1 ) {
             // first a compatibility check with the old (wrong) ISO9075

Modified: sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrPropertyMapTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrPropertyMapTest.java?rev=1353511&r1=1353510&r2=1353511&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrPropertyMapTest.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrPropertyMapTest.java
Mon Jun 25 13:05:37 2012
@@ -324,6 +324,12 @@ public class JcrPropertyMapTest extends 
         search(vm.values().iterator(), VALUE2);
     }
 
+    public void testContainsKeyEmpty() {
+        final JcrPropertyMap map = createPropertyMap(rootNode);
+        assertFalse(map.containsKey(""));
+        assertNull(map.get(""));
+    }
+
     public void testNamesOld() throws Exception {
         this.rootNode.getSession().refresh(false);
         this.rootNode.setProperty(ISO9075.encodePath(TEST_PATH), VALUE);



Mime
View raw message