]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Hadoop: Fix a nasty IO bug.
authorGreg Farnum <gregf@hq.newdream.net>
Fri, 21 Aug 2009 16:12:55 +0000 (09:12 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Mon, 24 Aug 2009 18:09:51 +0000 (11:09 -0700)
CephInputStream.read() needs to return an int between 0 and 255,
but bytes are signed and casting preserves that. Adjust if needed.

src/client/hadoop/ceph/CephInputStream.java

index e41153ecf9c4a68ca5e8c7ae5f607acff7dd7226..b0b7dd56f0134985b13daa80e7a30e1287d4a5b4 100644 (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];
     }
 
   /**