Hadoop: Fix a nasty IO bug.

CephInputStream.read() needs to return an int between 0 and 255,
but bytes are signed and casting preserves that. Adjust if needed.
This commit is contained in:
Greg Farnum 2009-08-21 09:12:55 -07:00
parent e9b00e09d2
commit af72edd717

View File

@ -114,7 +114,8 @@ class CephInputStream extends FSInputStream {
byte result[] = new byte[1];
if (getPos() >= fileLength) return -1;
if (-1 == read(result, 0, 1)) return -1;
return result[0];
if (result[0]<0) return 256+(int)result[0];
else return result[0];
}
/**