jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1336700 - in /jackrabbit/oak/trunk: oak-it/jcr/pom.xml oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueImpl.java
Date Thu, 10 May 2012 14:01:12 GMT
Author: reschke
Date: Thu May 10 14:01:12 2012
New Revision: 1336700

URL: http://svn.apache.org/viewvc?rev=1336700&view=rev
Log:
OAK-16: make Value.getStream() return the same stream instance

Modified:
    jackrabbit/oak/trunk/oak-it/jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueImpl.java

Modified: jackrabbit/oak/trunk/oak-it/jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/jcr/pom.xml?rev=1336700&r1=1336699&r2=1336700&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-it/jcr/pom.xml Thu May 10 14:01:12 2012
@@ -46,7 +46,6 @@
               <value>
 org.apache.jackrabbit.test.api.NodeReadMethodsTest#testGetPrimaryItem
 org.apache.jackrabbit.test.api.NodeReadMethodsTest#testGetUUID
-org.apache.jackrabbit.test.api.BinaryPropertyTest#testSameStream
 org.apache.jackrabbit.test.api.BinaryPropertyTest#testRandomAccess
 org.apache.jackrabbit.test.api.SessionReadMethodsTest#testGetNodeByUUIDFailure
 org.apache.jackrabbit.test.api.SessionReadMethodsTest#testGetNodeByUUID

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueImpl.java?rev=1336700&r1=1336699&r2=1336700&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/value/ValueImpl.java
Thu May 10 14:01:12 2012
@@ -48,6 +48,8 @@ class ValueImpl implements Value {
 
     private final CoreValue value;
     private final NamePathMapper namePathMapper;
+    
+    private InputStream stream = null;
 
     /**
      * Constructs a {@code ValueImpl} object based on a {@code CoreValue}
@@ -191,19 +193,21 @@ class ValueImpl implements Value {
      */
     @Override
     public InputStream getStream() throws IllegalStateException, RepositoryException {
-        InputStream stream;
-        switch (getType()) {
-            case PropertyType.NAME:
-            case PropertyType.PATH:
-                try {
-                    stream = new ByteArrayInputStream(getString().getBytes("UTF-8"));
-                } catch (UnsupportedEncodingException ex) {
-                    throw new RepositoryException("UTF-8 is not supported", ex);
-                }
-                break;
-            default:
-                stream = value.getNewStream();
+        if (stream == null) {
+            switch (getType()) {
+                case PropertyType.NAME:
+                case PropertyType.PATH:
+                    try {
+                        stream = new ByteArrayInputStream(getString().getBytes("UTF-8"));
+                    } catch (UnsupportedEncodingException ex) {
+                        throw new RepositoryException("UTF-8 is not supported", ex);
+                    }
+                    break;
+                default:
+                    stream = value.getNewStream();
+            }
         }
+        
         return stream;
     }
 



Mime
View raw message