On Monday 25 August 2008 17:37, nextgens at freenetproject.org wrote:
> Author: nextgens
> Date: 2008-08-25 16:37:44 +0000 (Mon, 25 Aug 2008)
> New Revision: 22138
>
> Modified:
> trunk/freenet/src/freenet/support/io/TempBucketFactory.java
> Log:
> TempBucketFactory: really fix the issue with InputStreams; we need to
reimplement everything!
>
> Modified: trunk/freenet/src/freenet/support/io/TempBucketFactory.java
> ===================================================================
> --- trunk/freenet/src/freenet/support/io/TempBucketFactory.java
> 2008-08-25
16:31:57 UTC (rev 22137)
> +++ trunk/freenet/src/freenet/support/io/TempBucketFactory.java
> 2008-08-25
16:37:44 UTC (rev 22138)
> @@ -222,6 +222,54 @@
> }
>
> @Override
> + public long skip(long n) throws IOException {
> + synchronized(currentBucket) {
> + _maybeResetInputStream();
> + return is.skip(n);
> + }
> + }
You need to increment index here.
> +
> + @Override
> + public int available() throws IOException {
> + synchronized(currentBucket) {
> + _maybeResetInputStream();
> + return is.available();
> + }
> + }
> +
> + @Override
> + public void mark(int readlimit) {
> + synchronized(currentBucket) {
> + try {
> + _maybeResetInputStream();
> + } catch (IOException e) {
> + Logger.error(this,
> "IOE:"+e.getMessage(),e);
> + }
> + is.mark(readlimit);
> + }
> + }
> +
> + @Override
> + public void reset() throws IOException {
> + synchronized(currentBucket) {
> + _maybeResetInputStream();
> + is.reset();
> + }
> + }
You need to reset index here (presumably store it in mark(), subject to
isMarkSupported() and the mark limit - and don't assume the caller calls
isMarkSupported() either!).
> +
> + @Override
> + public boolean markSupported() {
> + synchronized(currentBucket) {
> + try {
> + _maybeResetInputStream();
> + } catch (IOException e) {
> + Logger.error(this,
> "IOE:"+e.getMessage(),e);
> + }
> + return is.markSupported();
> + }
> + }
> +
> + @Override
> public final void close() throws IOException {
> synchronized(currentBucket) {
> _maybeResetInputStream();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL:
<https://emu.freenetproject.org/pipermail/devl/attachments/20080825/e54159a4/attachment.pgp>