classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BUG: java.net.SocketInputStream.read() is broken


From: Bryce McKinlay
Subject: Re: BUG: java.net.SocketInputStream.read() is broken
Date: Fri, 30 Aug 2002 15:51:10 +1200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1a) Gecko/20020610

Jeroen Frijters wrote:

Hi everyone,

SocketInputStream.read() contains the following code:

 if (bytes_read != -1)
   return((int)buf[0]);

This is incorrect, as it promotes the signed byte to an int. The correct
code is:

 if (bytes_read != -1)
   return(buf[0] & 0xff);

Thanks. I have checked in the fix.

regards

Bryce.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]