tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Hanik - Dev Lists <devli...@hanik.com>
Subject Re: Bug in B2C converter WAS: svn commit: r568307 - /tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java
Date Wed, 22 Aug 2007 00:36:12 GMT
Remy Maucherat wrote:
> Filip Hanik - Dev Lists wrote:
>> Test Case and 5.5.x patch can be found here.
>> http://people.apache.org/~fhanik/tomcat/b2c/
>>
>> This is what is happening
>>
>> int cnt=conv.read( result, 0, BUFFER_SIZE );
>> is called with a "while (true)" statement,
>>
>> When the IntermediateInputStream.read returns -1, the above statement 
>> returns cnt==1.
>> So to avoid calling conv.read, we must check to see if we have more 
>> bytes to read by implementing the available() method, to avoid the 
>> inputstream ever returning -1.
>
> It's possible, but I have a hard time understanding the issue.
you'd have to run it through a debugger to understand it
>
>
> Some parts of the patch look weird, in particular, the:
those are just overwritten methods from the parent. ie, no-ops right now
>
> +import java.nio.CharBuffer;
>
>  /** Efficient conversion of bytes  to character .
>   *
> @@ -211,6 +212,18 @@
>      return super.read( cbuf, off, len );
>      }
>
> +    public final int read() throws IOException {
> +        return super.read();
> +    }
> +
> +    public final int read(CharBuffer cb) throws IOException {
> +        return super.read(cb);
> +    }
> +
> +    public final int read(char[] cbuf) throws IOException {
> +        return super.read(cbuf);
> +    }
> +
>
> Overall, it's a good candidate for the new process, I think.
>
> Rémy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message