jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r778616 - /jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BinaryValue.java
Date Tue, 26 May 2009 08:30:19 GMT
Author: jukka
Date: Tue May 26 08:30:18 2009
New Revision: 778616

URL: http://svn.apache.org/viewvc?rev=778616&view=rev
Log:
JCR-2056: Binary interfaces

Multiple Value.getStream() calls are expected to return the same stream even for binary values.

Modified:
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BinaryValue.java

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BinaryValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BinaryValue.java?rev=778616&r1=778615&r2=778616&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BinaryValue.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BinaryValue.java
Tue May 26 08:30:18 2009
@@ -154,16 +154,20 @@
             throws IllegalStateException, RepositoryException {
         setStreamConsumed();
 
-        if (bin != null) {
-            return bin.getStream();
-        } else {
-            try {
-                return new ByteArrayInputStream(text.getBytes(DEFAULT_ENCODING));
-            } catch (UnsupportedEncodingException e) {
-                throw new RepositoryException(DEFAULT_ENCODING
-                        + " not supported on this platform", e);
+        if (stream == null) {
+            if (bin != null) {
+                stream = bin.getStream();
+            } else {
+                try {
+                    stream = new ByteArrayInputStream(text.getBytes(DEFAULT_ENCODING));
+                } catch (UnsupportedEncodingException e) {
+                    throw new RepositoryException(DEFAULT_ENCODING
+                            + " not supported on this platform", e);
+                }
             }
         }
+
+        return stream;
     }
 
     /**



Mime
View raw message