huxinqiu opened a new pull request, #4714: URL: https://github.com/apache/hadoop/pull/4714
### Description of PR The current implementation reset src and tgt to the mark and continues searching when tgt has remaining and src expired first. which is probably not necessary. For example, when q is searched, it is found that src has no remaining, and src is reset to d to continue searching. But the remaining length of src is always smaller than tgt, at this point we can return -1 directly. `@Test public void testFind() throws Exception { Text text = new Text("abcd\u20acbdcd\u20ac"); assertThat(text.find("cd\u20acq")).isEqualTo(-1); } ` ### How was this patch tested? unit test in org.apache.hadoop.io.TestText#testFind -- 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. To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org