jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r1209033 - in /jackrabbit/trunk: jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/GetPropertyTest.java jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
Date Thu, 01 Dec 2011 11:04:09 GMT
Author: tripod
Date: Thu Dec  1 11:04:08 2011
New Revision: 1209033

URL: http://svn.apache.org/viewvc?rev=1209033&view=rev
Log:
JCR-3163 NPE in RepositoryServiceImpl.getPropertyInfo()

Modified:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/GetPropertyTest.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/GetPropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/GetPropertyTest.java?rev=1209033&r1=1209032&r2=1209033&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/GetPropertyTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/GetPropertyTest.java
Thu Dec  1 11:04:08 2011
@@ -271,4 +271,16 @@ public class GetPropertyTest extends Abs
             rw.logout();
         }
     }
+
+    public void testGetDeepEmptyStringProperty() throws RepositoryException, NotExecutableException
{
+        Node n = testRootNode.getNode(nodeName1);
+        Node n2 = n.addNode(nodeName2);
+        Node n3 = n2.addNode(nodeName3);
+        Node n4 = n3.addNode(nodeName4);
+        Property emptyProp = n4.setProperty(propertyName1, "");
+        testRootNode.save();
+
+        Property p = readOnly.getProperty(emptyProp.getPath());
+        assertEquals("", p.getString());
+    }
 }

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java?rev=1209033&r1=1209032&r2=1209033&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
Thu Dec  1 11:04:08 2011
@@ -413,9 +413,10 @@ public class RepositoryServiceImpl exten
                     QValue qValue = getQValueFactory(sessionInfo).create(length, uri, QValueFactoryImpl.NO_INDEX)
;
                     return new PropertyInfoImpl(propertyId, p, propertyType, qValue);
                 }
-            } else if (props.contains(JCR_GET_STRING) && props.get(JCR_GET_STRING).getValue()
!= null) {
+            } else if (props.contains(JCR_GET_STRING)) {
                 // single valued non-binary property
-                String str = props.get(JCR_GET_STRING).getValue().toString();
+                Object v = props.get(JCR_GET_STRING).getValue();
+                String str = (v == null) ? "" : v.toString();
                 QValue qValue = ValueFormat.getQValue(str, propertyType, getNamePathResolver(sessionInfo),
getQValueFactory(sessionInfo));
                 return new PropertyInfoImpl(propertyId, p, propertyType, qValue);
             } else {



Mime
View raw message