classpath
[Top][All Lists]
Advanced

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

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


From: Jeroen Frijters
Subject: BUG: java.net.SocketInputStream.read() is broken
Date: Thu, 29 Aug 2002 14:56:24 +0200

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);

Regards,
Jeroen





reply via email to

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