Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-679

input.AbstractCharacterFilterReader passes count of chars read to filter, not the filter char

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.7
    • 2.8.0
    • Streams/Writers
    • None

    Description

       Ran into a bug with AbstractCharacterFilterReader where I noticed that my filter was not receiving the actual characters, but was instead receiving an int value corresponding to the number of chars in my input stream buffer.

      I looked at the source file and realized that on line 64:
      if (filter(read)) {
      should have been:

      if (filter(cbuf[readPos])) {

      'read` has the number of chars read from the source reader, not the code point of the character read.

      I have attached a sample program that illustrates the issue.

      I can work on a patch and submit it when done. I will add a test case in the patch.

       

      Attachments

        1. AbstractCharacterFilterIssue.java
          1 kB
          Proneel Guptan

        Activity

          People

            Unassigned Unassigned
            proneel Proneel Guptan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m