tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkoli...@apache.org
Subject svn commit: r1033842 - /tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
Date Thu, 11 Nov 2010 08:53:01 GMT
Author: kkolinko
Date: Thu Nov 11 08:53:01 2010
New Revision: 1033842

URL: http://svn.apache.org/viewvc?rev=1033842&view=rev
Log:
Followup to implementation of https://issues.apache.org/bugzilla/show_bug.cgi?id=49860
Use local variable instead of array access.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java?rev=1033842&r1=1033841&r2=1033842&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java Thu Nov 11
08:53:01 2010
@@ -420,8 +420,6 @@ public class ChunkedInputFilter implemen
         //
     
         boolean colon = false;
-        MessageBytes headerValue = null;
-    
         while (!colon) {
     
             // Read new bytes if needed
@@ -432,20 +430,20 @@ public class ChunkedInputFilter implemen
     
             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 implemen
                         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 implemen
                         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();
                 }
     



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message