[ 
https://issues.apache.org/jira/browse/IO-679?focusedWorklogId=464391&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-464391
 ]

ASF GitHub Bot logged work on IO-679:
-------------------------------------

                Author: ASF GitHub Bot
            Created on: 30/Jul/20 07:36
            Start Date: 30/Jul/20 07:36
    Worklog Time Spent: 10m 
      Work Description: proneel opened a new pull request #132:
URL: https://github.com/apache/commons-io/pull/132


   A bug in the read(final char[] cbuf, final int off, final int len)
   method causes the filter function to receive the count of chars read
   instead of iteratively getting each char code point
   
   This affects subclasses CharacterFilterReader and
   CharacterSetFilterReader also.
   
   Added to tests to cover the bug


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 464391)
    Time Spent: 40m  (was: 0.5h)

> input.AbstractCharacterFilterReader passes count of chars read to filter, not 
> the filter char
> ---------------------------------------------------------------------------------------------
>
>                 Key: IO-679
>                 URL: https://issues.apache.org/jira/browse/IO-679
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Streams/Writers
>    Affects Versions: 2.7
>            Reporter: Proneel Guptan
>            Priority: Major
>             Fix For: 2.8
>
>         Attachments: AbstractCharacterFilterIssue.java
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
>   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|https://github.com/apache/commons-io/blob/master/src/main/java/org/apache/commons/io/input/AbstractCharacterFilterReader.java]
>  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.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to