jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r815839 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBFileValue.java
Date Wed, 16 Sep 2009 15:30:36 GMT
Author: thomasm
Date: Wed Sep 16 15:30:25 2009
New Revision: 815839

URL: http://svn.apache.org/viewvc?rev=815839&view=rev
Log:
JCR-2307 BLOBFileValue.read(byte[] b, long pos) ignores return value of InputStream.skip

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

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBFileValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBFileValue.java?rev=815839&r1=815838&r2=815839&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBFileValue.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBFileValue.java
Wed Sep 16 15:30:25 2009
@@ -78,10 +78,18 @@
     public int read(byte[] b, long position) throws IOException, RepositoryException {
         InputStream in = getStream();
         try {
-            in.skip(position);
+            long skip = position;
+            while (skip > 0) {
+                long skipped = in.skip(skip);
+                if (skipped <= 0) {
+                    return -1;
+                }
+                skip -= skipped;
+            }
             return in.read(b);
         } finally {
             in.close();
         }
     }
+
 }



Mime
View raw message