Here's my first submission! It pertains to Tomcat-3.2.1 and looks to be
the same in 3.2.2.b4
I have some client code that sends a jar file to the servlet. The jar
file was getting corrupted. After much digging, I found a CVS commit to
Ajp13ConnectorRequest.java that mentioned a problem like this with the
doRead() method. It turns out the the same applies to the doRead(byte[],
int, int) method. The same problem exists in the Ajp12ConnectionHandler
for that byte array read. Single byte reads for both protocols work just
fine. I'm including the diffs for these classes to show what I'm talking
about. I may be called a developer now, but I'm certainly not a
commiter, so what is the procedure for getting this fix validated by
somebody else and put into the codebase?
Index: Ajp13ConnectorRequest.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/service/connector/Attic/Ajp13ConnectorRequest.java,v
retrieving revision 1.5.2.7
diff -r1.5.2.7 Ajp13ConnectorRequest.java
274c274,277
< System.arraycopy(bodyBuff, pos, b, off, c);
---
> //System.arraycopy(bodyBuff, pos, b, off, c);
> for (int i=pos, j=off, d=c; d > 0; i++, j++, d--) {
> b[j] = (byte)(((char)bodyBuff[i])&0xff);
> }
What I've done here is to replace the array copy with a loop that does
the appropriate data conversion.
Index: Ajp12ConnectionHandler.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/service/connector/Attic/Ajp12ConnectionHandler.java,v
retrieving revision 1.28.2.4
diff -r1.28.2.4 Ajp12ConnectionHandler.java
542a543,549
> public int read(byte b[], int off, int len) throws IOException {
> int ret = super.read(b, off, len);
> for (int i=0, j=off; i<len; i++, j++) {
> b[j] = (byte)(((char)b[j])&0xff);
> }
> return ret;
> }
In this case, I over-rode the read method to convert the data after
calling the super.read
I'd like to see this stuff end up in 3.2.2.b5
Thanks,
David Kavanagh