https://issues.apache.org/bugzilla/show_bug.cgi?id=49398
Summary: ByteChunk.indexOf(String, ...) behaviour with strings of length 1 Product: Tomcat 6 Version: 6.0.26 Platform: PC OS/Version: Windows XP Status: NEW Severity: minor Priority: P2 Component: Catalina AssignedTo: dev@tomcat.apache.org ReportedBy: knst.koli...@gmail.com There is a bug in implementation of the following method org.apache.tomcat.util.buf.ByteChunk.indexOf(String src, int srcOff, int srcLen, int myOff) in 6.0.26 and 5.5.29. The problem is that the method can not find a string which consists of one character, as the only successful exit from the method is from inside the loop that checks the second and subsequent characters. E.g., to reproduce: byte[] bytes = "Hello\u00a0world".getBytes("ISO-8859-1"); final int len = bytes.length; ByteChunk bc = new ByteChunk(); bc.setBytes(bytes, 0, len); bc.indexOf("o", 0, 1, 5); // returns -1, instead of 7. A testcase for this was added in r945230 and it was fixed in trunk in r945231 This is not observable without a testcase, because all calls to this method in the current Tomcat 6.0.26 and 5.5.29 code pass a string of several characters. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org