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.
Fixed in 5.5 and 6.0, will be in 5.5.30, 6.0.27.