[ 
https://issues.apache.org/jira/browse/HADOOP-13192?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15327807#comment-15327807
 ] 

Akira AJISAKA commented on HADOOP-13192:
----------------------------------------

Applied your patch and ran the existing tests.
{noformat}
$ mvn test -Dtest=TestLineReader,TestLineRecordReader
(snip)
Running org.apache.hadoop.util.TestLineReader
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.368 sec <<< 
FAILURE! - in org.apache.hadoop.util.TestLineReader
testCustomDelimiter(org.apache.hadoop.util.TestLineReader)  Time elapsed: 0.23 
sec  <<< ERROR!
java.lang.ArrayIndexOutOfBoundsException: -1
        at org.apache.hadoop.util.LineReader.readCustomLine(LineReader.java:314)
        at org.apache.hadoop.util.LineReader.readLine(LineReader.java:172)
        at org.apache.hadoop.util.LineReader.readLine(LineReader.java:377)
        at 
org.apache.hadoop.util.TestLineReader.testCustomDelimiter(TestLineReader.java:98)
{noformat}
The failure looks related to the patch. Hi [~zhudebin], would you fix it and 
add a regression test for this bug?

> org.apache.hadoop.util.LineReader  match recordDelimiter has a bug
> ------------------------------------------------------------------
>
>                 Key: HADOOP-13192
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13192
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: util
>    Affects Versions: 2.6.2
>            Reporter: binde
>   Original Estimate: 5m
>  Remaining Estimate: 5m
>
> org.apache.hadoop.util.LineReader.readCustomLine()  has a bug,
> when line is   aaaabccc, recordDelimiter is aaab, the result should be a,ccc,
> show the code on line 310:
>       for (; bufferPosn < bufferLength; ++bufferPosn) {
>         if (buffer[bufferPosn] == recordDelimiterBytes[delPosn]) {
>           delPosn++;
>           if (delPosn >= recordDelimiterBytes.length) {
>             bufferPosn++;
>             break;
>           }
>         } else if (delPosn != 0) {
>           bufferPosn--;
>           delPosn = 0;
>         }
>       }
> shoud be :
>       for (; bufferPosn < bufferLength; ++bufferPosn) {
>         if (buffer[bufferPosn] == recordDelimiterBytes[delPosn]) {
>           delPosn++;
>           if (delPosn >= recordDelimiterBytes.length) {
>             bufferPosn++;
>             break;
>           }
>         } else if (delPosn != 0) {
>          // ------------- change here ------------- start ----
>           bufferPosn -= delPosn;
>          // ------------- change here ------------- end ----
>   
>           delPosn = 0;
>         }
>       }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to