jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1399576 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValueFactory.java
Date Thu, 18 Oct 2012 10:49:28 GMT
Author: jukka
Date: Thu Oct 18 10:49:27 2012
New Revision: 1399576

URL: http://svn.apache.org/viewvc?rev=1399576&view=rev
Log:
JCR-3447: InternalValueFactory should use the DataStore whenever available

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValueFactory.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValueFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValueFactory.java?rev=1399576&r1=1399575&r2=1399576&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValueFactory.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValueFactory.java
Thu Oct 18 10:49:27 2012
@@ -25,6 +25,8 @@ import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.commons.value.AbstractQValueFactory;
 
 import javax.jcr.RepositoryException;
+
+import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -92,7 +94,11 @@ public final class InternalValueFactory 
     }
 
     public QValue create(byte[] value) throws RepositoryException {
-        return InternalValue.create(value);
+        if (store == null) {
+            return InternalValue.create(value);
+        } else {
+            return InternalValue.create(new ByteArrayInputStream(value), store);
+        }
     }
 
     public QValue create(InputStream value) throws RepositoryException, IOException {
@@ -105,7 +111,11 @@ public final class InternalValueFactory 
 
     public QValue create(File value) throws RepositoryException, IOException {
         InputStream in = new FileInputStream(value);
-        return InternalValue.createTemporary(in);
+        if (store == null) {
+            return InternalValue.createTemporary(in);
+        } else {
+            return InternalValue.create(in, store);
+        }
     }
 
     @Override



Mime
View raw message