Author: nextgens
Date: 2008-08-31 07:48:30 +0000 (Sun, 31 Aug 2008)
New Revision: 22265

Modified:
   trunk/freenet/src/freenet/support/io/TempBucketFactory.java
Log:
TempBucket: skip() only if necessary and double-check that we did skip the 
right length

Modified: trunk/freenet/src/freenet/support/io/TempBucketFactory.java
===================================================================
--- trunk/freenet/src/freenet/support/io/TempBucketFactory.java 2008-08-30 
23:11:39 UTC (rev 22264)
+++ trunk/freenet/src/freenet/support/io/TempBucketFactory.java 2008-08-31 
07:48:30 UTC (rev 22265)
@@ -249,7 +249,10 @@
                                if(currentOS != os) {
                                        Closer.close(currentIS);
                                        currentIS = 
currentBucket.getInputStream();
-                                       currentIS.skip(index);
+                                       long toSkip = index;
+                                       while(toSkip > 0) {
+                                               toSkip -= 
currentIS.skip(toSkip);
+                                       }
                                        currentOS = os;
                                }
                        }


Reply via email to