From: kkolinko Date: Thu, 11 Nov 2010 08:53:01 +0000 (+0000) Subject: Followup to implementation of https://issues.apache.org/bugzilla/show_bug.cgi?id... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=5c367949309084e7113aad09704fad6e529751f4;p=tomcat7.0 Followup to implementation of https://issues.apache.org/bugzilla/show_bug.cgi?id=49860 Use local variable instead of array access. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1033842 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java b/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java index cd09accbe..e9e83c1f6 100644 --- a/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java +++ b/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java @@ -420,8 +420,6 @@ public class ChunkedInputFilter implements InputFilter { // boolean colon = false; - MessageBytes headerValue = null; - while (!colon) { // Read new bytes if needed @@ -432,20 +430,20 @@ public class ChunkedInputFilter implements InputFilter { chr = buf[pos]; if ((chr >= Constants.A) && (chr <= Constants.Z)) { - buf[pos] = (byte) (chr - Constants.LC_OFFSET); + chr = (byte) (chr - Constants.LC_OFFSET); } - if (buf[pos] == Constants.COLON) { + if (chr == Constants.COLON) { colon = true; } else { - trailingHeaders.append(buf[pos]); + trailingHeaders.append(chr); } pos++; } - headerValue = headers.addValue(trailingHeaders.getBytes(), start, - trailingHeaders.getEnd() - start); + MessageBytes headerValue = headers.addValue(trailingHeaders.getBytes(), + start, trailingHeaders.getEnd() - start); // Mark the current buffer position start = trailingHeaders.getEnd(); @@ -471,7 +469,8 @@ public class ChunkedInputFilter implements InputFilter { throw new EOFException("Unexpected end of stream whilst reading trailer headers for chunked request"); } - if ((buf[pos] == Constants.SP) || (buf[pos] == Constants.HT)) { + chr = buf[pos]; + if ((chr == Constants.SP) || (chr == Constants.HT)) { pos++; } else { space = false; @@ -488,14 +487,15 @@ public class ChunkedInputFilter implements InputFilter { throw new EOFException("Unexpected end of stream whilst reading trailer headers for chunked request"); } - if (buf[pos] == Constants.CR) { + chr = buf[pos]; + if (chr == Constants.CR) { // Skip - } else if (buf[pos] == Constants.LF) { + } else if (chr == Constants.LF) { eol = true; - } else if (buf[pos] == Constants.SP) { - trailingHeaders.append(buf[pos]); + } else if (chr == Constants.SP) { + trailingHeaders.append(chr); } else { - trailingHeaders.append(buf[pos]); + trailingHeaders.append(chr); lastSignificantChar = trailingHeaders.getEnd(); }