jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1199312 - in /jackrabbit/trunk: jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/
Date Tue, 08 Nov 2011 16:00:45 GMT
Author: jukka
Date: Tue Nov  8 16:00:45 2011
New Revision: 1199312

URL: http://svn.apache.org/viewvc?rev=1199312&view=rev
Log:
JCR-3093: Inconsistency between Session.getProperty and Node.getProperty for binary values

Patch by Angela

Modified:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/BinaryTest.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.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/BinaryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/BinaryTest.java?rev=1199312&r1=1199311&r2=1199312&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/BinaryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/BinaryTest.java
Tue Nov  8 16:00:45 2011
@@ -73,6 +73,25 @@ public class BinaryTest extends Abstract
         }
     }
 
+    public void testStreamBinary2() throws Exception {
+        Node test = testRootNode.addNode("test");
+        Property p = test.setProperty("prop", generateValue());
+        // check before save
+        checkBinary(p);
+        superuser.save();
+        // check after save
+        checkBinary(p);
+
+        // check from other session
+        Session s = getHelper().getReadOnlySession();
+        try {
+            p = s.getProperty(testRoot + "/test/prop");
+            checkBinary(p);
+        } finally {
+            s.logout();
+        }
+    }
+
     public void testBinaryTwiceNewProperty() throws Exception {
         Node test = testRootNode.addNode("test");
         Property p = test.setProperty("prop", generateValue());

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java?rev=1199312&r1=1199311&r2=1199312&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java
Tue Nov  8 16:00:45 2011
@@ -73,6 +73,8 @@ class QValueFactoryImpl extends org.apac
      */
     private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
 
+    static final int NO_INDEX = -1;
+
     private final ValueLoader loader;
     private final ValueFactory vf;
 
@@ -153,7 +155,7 @@ class QValueFactoryImpl extends org.apac
          */
         private final String uri;
         private final long length;
-        private int index = -1;
+        private final int index;
         private boolean initialized = true;
 
         private BinaryQValue(long length, String uri, int index) {
@@ -543,7 +545,7 @@ class QValueFactoryImpl extends org.apac
 
         //---------------------------------------------------------< Target >---
         public void setStream(InputStream in) throws IOException {
-            if (index == -1) {
+            if (index == NO_INDEX) {
                 init(in, true);
             } else {
                 // TODO: improve. jcr-server sends XML for multivalued properties

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=1199312&r1=1199311&r2=1199312&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
Tue Nov  8 16:00:45 2011
@@ -410,7 +410,7 @@ public class RepositoryServiceImpl exten
                 } else {
                     // single valued binary property
                     long length = Long.parseLong(props.get(JCR_LENGTH).getValue().toString());
-                    QValue qValue = getQValueFactory(sessionInfo).create(length, uri, 0)
;
+                    QValue qValue = getQValueFactory(sessionInfo).create(length, uri, QValueFactoryImpl.NO_INDEX)
;
                     return new PropertyInfoImpl(propertyId, p, propertyType, qValue);
                 }
             } else if (props.contains(JCR_GET_STRING)) {



Mime
View raw message