Flume
  1. Flume
  2. FLUME-2593

ResettableFileInputStream returns negate values from read() method

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: v1.5.2
    • Fix Version/s: v1.7.0
    • Component/s: None
    • Labels:
      None

      Description

      the int value returned from the method should be in range 0-255 for a byte read, or -1 when EOF was reached, as described in InputStream class javadoc.

      Fix is to change the line in read() method:

       return byteBuf[0];
      

      to

       return byteBuf[0] & 0xFF;
      

        Issue Links

          Activity

          Hide
          Hari Shreedharan added a comment -

          Do you have a patch?

          Show
          Hari Shreedharan added a comment - Do you have a patch?
          Hide
          Miroslav Holubec added a comment -

          patch attached

          Show
          Miroslav Holubec added a comment - patch attached
          Hide
          Johny Rufus added a comment -

          +1, it would be good to add a test case that makes sure the behavior is consistent with FileInputStream

          Show
          Johny Rufus added a comment - +1, it would be good to add a test case that makes sure the behavior is consistent with FileInputStream
          Hide
          Miroslav Holubec added a comment -

          new patch with jUnit attached

          Show
          Miroslav Holubec added a comment - new patch with jUnit attached
          Hide
          Miroslav Holubec added a comment -

          Johny Rufus any further change needed?

          Show
          Miroslav Holubec added a comment - Johny Rufus any further change needed?
          Hide
          Johny Rufus added a comment -

          Miroslav Holubec, Thanks for the patch with test case, running tests now, will commit today

          Show
          Johny Rufus added a comment - Miroslav Holubec , Thanks for the patch with test case, running tests now, will commit today
          Hide
          ASF subversion and git services added a comment -

          Commit 0e40e831108f34b5bc6d01bf1ffa9efae330ea82 in flume's branch refs/heads/trunk from Johny Rufus
          [ https://git-wip-us.apache.org/repos/asf?p=flume.git;h=0e40e83 ]

          FLUME-2593. ResettableFileInputStream returns negate values from read() method

          (Miroslav Holubec via Johny Rufus)

          Show
          ASF subversion and git services added a comment - Commit 0e40e831108f34b5bc6d01bf1ffa9efae330ea82 in flume's branch refs/heads/trunk from Johny Rufus [ https://git-wip-us.apache.org/repos/asf?p=flume.git;h=0e40e83 ] FLUME-2593 . ResettableFileInputStream returns negate values from read() method (Miroslav Holubec via Johny Rufus)
          Hide
          ASF subversion and git services added a comment -

          Commit 589bfa202fbbe8b862f8ee943b81d0e1ea2d670b in flume's branch refs/heads/flume-1.7 from Johny Rufus
          [ https://git-wip-us.apache.org/repos/asf?p=flume.git;h=589bfa2 ]

          FLUME-2593. ResettableFileInputStream returns negate values from read() method

          (Miroslav Holubec via Johny Rufus)

          Show
          ASF subversion and git services added a comment - Commit 589bfa202fbbe8b862f8ee943b81d0e1ea2d670b in flume's branch refs/heads/flume-1.7 from Johny Rufus [ https://git-wip-us.apache.org/repos/asf?p=flume.git;h=589bfa2 ] FLUME-2593 . ResettableFileInputStream returns negate values from read() method (Miroslav Holubec via Johny Rufus)
          Hide
          Johny Rufus added a comment -

          Thanks for the patch Miroslav Holubec !!

          Show
          Johny Rufus added a comment - Thanks for the patch Miroslav Holubec !!
          Hide
          Hudson added a comment -

          UNSTABLE: Integrated in Flume-trunk-hbase-1 #131 (See https://builds.apache.org/job/Flume-trunk-hbase-1/131/)
          FLUME-2593. ResettableFileInputStream returns negate values from read() (johnyrufus: http://git-wip-us.apache.org/repos/asf/flume/repo?p=flume.git&a=commit&h=0e40e831108f34b5bc6d01bf1ffa9efae330ea82)

          • flume-ng-core/src/test/java/org/apache/flume/serialization/TestResettableFileInputStream.java
          • flume-ng-core/src/main/java/org/apache/flume/serialization/ResettableFileInputStream.java
          Show
          Hudson added a comment - UNSTABLE: Integrated in Flume-trunk-hbase-1 #131 (See https://builds.apache.org/job/Flume-trunk-hbase-1/131/ ) FLUME-2593 . ResettableFileInputStream returns negate values from read() (johnyrufus: http://git-wip-us.apache.org/repos/asf/flume/repo?p=flume.git&a=commit&h=0e40e831108f34b5bc6d01bf1ffa9efae330ea82 ) flume-ng-core/src/test/java/org/apache/flume/serialization/TestResettableFileInputStream.java flume-ng-core/src/main/java/org/apache/flume/serialization/ResettableFileInputStream.java
          Hide
          Mikhail Golubtsov added a comment -

          Can this issue be fixed in 1.5 version too, please?

          Show
          Mikhail Golubtsov added a comment - Can this issue be fixed in 1.5 version too, please?

            People

            • Assignee:
              Miroslav Holubec
              Reporter:
              Miroslav Holubec
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development