Author: jboynes
Date: Sat Mar 21 03:47:17 2015
New Revision: 1668188

URL: http://svn.apache.org/r1668188
Log:
Make checkstyle happy

Modified:
    tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java
    tomcat/trunk/java/org/apache/coyote/http2/HpackEncoder.java
    tomcat/trunk/test/org/apache/coyote/http2/TestHpack.java

Modified: tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java?rev=1668188&r1=1668187&r2=1668188&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java Sat Mar 21 
03:47:17 2015
@@ -20,8 +20,6 @@ import java.nio.ByteBuffer;
 
 import org.apache.tomcat.util.res.StringManager;
 
-import static org.apache.coyote.http2.Hpack.HeaderField;
-
 /**
  * A decoder for HPACK.
  */
@@ -39,7 +37,7 @@ public class HpackDecoder {
     /**
      * The header table
      */
-    private HeaderField[] headerTable;
+    private Hpack.HeaderField[] headerTable;
 
     /**
      * The current HEAD position of the header table. We use a ring buffer type
@@ -67,7 +65,7 @@ public class HpackDecoder {
 
     public HpackDecoder(int maxMemorySize) {
         this.maxMemorySize = maxMemorySize;
-        headerTable = new HeaderField[DEFAULT_RING_BUFFER_SIZE];
+        headerTable = new Hpack.HeaderField[DEFAULT_RING_BUFFER_SIZE];
     }
 
     public HpackDecoder() {
@@ -109,7 +107,7 @@ public class HpackDecoder {
                     return;
                 }
                 headerEmitter.emitHeader(headerName, headerValue, false);
-                addEntryToHeaderTable(new HeaderField(headerName, 
headerValue));
+                addEntryToHeaderTable(new Hpack.HeaderField(headerName, 
headerValue));
             } else if ((b & 0b11110000) == 0) {
                 //Literal Header Field without Indexing
                 String headerName = readHeaderName(buffer, 4);
@@ -165,7 +163,7 @@ public class HpackDecoder {
                 if (firstSlotPosition == tableLength) {
                     firstSlotPosition = 0;
                 }
-                HeaderField oldData = headerTable[clearIndex];
+                Hpack.HeaderField oldData = headerTable[clearIndex];
                 headerTable[clearIndex] = null;
                 newSize -= oldData.size;
                 newTableSlots--;
@@ -225,7 +223,7 @@ public class HpackDecoder {
                 throw new HpackException();
             }
             int adjustedIndex = getRealIndex(index - 
Hpack.STATIC_TABLE_LENGTH);
-            HeaderField res = headerTable[adjustedIndex];
+            Hpack.HeaderField res = headerTable[adjustedIndex];
             if (res == null) {
                 throw new HpackException();
             }
@@ -244,7 +242,7 @@ public class HpackDecoder {
             addStaticTableEntry(index);
         } else {
             int adjustedIndex = getRealIndex(index - 
Hpack.STATIC_TABLE_LENGTH);
-            HeaderField headerField = headerTable[adjustedIndex];
+            Hpack.HeaderField headerField = headerTable[adjustedIndex];
             headerEmitter.emitHeader(headerField.name, headerField.value, 
false);
         }
     }
@@ -268,14 +266,14 @@ public class HpackDecoder {
     private void addStaticTableEntry(int index) throws HpackException {
         //adds an entry from the static table.
         //this must be an entry with a value as far as I can determine
-        HeaderField entry = Hpack.STATIC_TABLE[index];
+        Hpack.HeaderField entry = Hpack.STATIC_TABLE[index];
         if (entry.value == null) {
             throw new HpackException();
         }
         headerEmitter.emitHeader(entry.name, entry.value, false);
     }
 
-    private void addEntryToHeaderTable(HeaderField entry) {
+    private void addEntryToHeaderTable(Hpack.HeaderField entry) {
         if (entry.size > maxMemorySize) {
             //it is to big to fit, so we just completely clear the table.
             while (filledTableSlots > 0) {
@@ -301,7 +299,7 @@ public class HpackDecoder {
             if (firstSlotPosition == tableLength) {
                 firstSlotPosition = 0;
             }
-            HeaderField oldData = headerTable[clearIndex];
+            Hpack.HeaderField oldData = headerTable[clearIndex];
             headerTable[clearIndex] = null;
             newSize -= oldData.size;
             newTableSlots--;
@@ -312,7 +310,7 @@ public class HpackDecoder {
 
     private void resizeIfRequired() {
         if(filledTableSlots == headerTable.length) {
-            HeaderField[] newArray = new HeaderField[headerTable.length + 10]; 
//we only grow slowly
+            Hpack.HeaderField[] newArray = new 
Hpack.HeaderField[headerTable.length + 10]; //we only grow slowly
             for(int i = 0; i < headerTable.length; ++i) {
                 newArray[i] = headerTable[(firstSlotPosition + i) % 
headerTable.length];
             }
@@ -344,7 +342,7 @@ public class HpackDecoder {
         return firstSlotPosition;
     }
 
-    HeaderField[] getHeaderTable() {
+    Hpack.HeaderField[] getHeaderTable() {
         return headerTable;
     }
 

Modified: tomcat/trunk/java/org/apache/coyote/http2/HpackEncoder.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/HpackEncoder.java?rev=1668188&r1=1668187&r2=1668188&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/HpackEncoder.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/HpackEncoder.java Sat Mar 21 
03:47:17 2015
@@ -28,11 +28,6 @@ import java.util.Map;
 
 import org.apache.tomcat.util.http.MimeHeaders;
 
-import static org.apache.coyote.http2.Hpack.HeaderField;
-import static org.apache.coyote.http2.Hpack.STATIC_TABLE;
-import static org.apache.coyote.http2.Hpack.STATIC_TABLE_LENGTH;
-import static org.apache.coyote.http2.Hpack.encodeInteger;
-
 /**
  * Encoder for HPACK frames.
  */
@@ -76,8 +71,8 @@ public class HpackEncoder {
 
     static {
         Map<String, TableEntry[]> map = new HashMap<>();
-        for (int i = 1; i < STATIC_TABLE.length; ++i) {
-            HeaderField m = STATIC_TABLE[i];
+        for (int i = 1; i < Hpack.STATIC_TABLE.length; ++i) {
+            Hpack.HeaderField m = Hpack.STATIC_TABLE[i];
             TableEntry[] existing = map.get(m.name);
             if (existing == null) {
                 map.put(m.name, new TableEntry[]{new TableEntry(m.name, 
m.value, i)});
@@ -173,18 +168,18 @@ public class HpackEncoder {
                         if (val.equals(tableEntry.value)) {
                             //the whole thing is in the table
                             target.put((byte) (1 << 7));
-                            encodeInteger(target, tableEntry.getPosition(), 7);
+                            Hpack.encodeInteger(target, 
tableEntry.getPosition(), 7);
                         } else {
                             if (canIndex) {
                                 //add the entry to the dynamic table
                                 target.put((byte) (1 << 6));
-                                encodeInteger(target, 
tableEntry.getPosition(), 6);
+                                Hpack.encodeInteger(target, 
tableEntry.getPosition(), 6);
                                 writeHuffmanEncodableValue(target, headerName, 
val);
                                 addToDynamicTable(headerName, val);
 
                             } else {
                                 target.put((byte) (1 << 4));
-                                encodeInteger(target, 
tableEntry.getPosition(), 4);
+                                Hpack.encodeInteger(target, 
tableEntry.getPosition(), 4);
                                 writeHuffmanEncodableValue(target, headerName, 
val);
                             }
                         }
@@ -208,7 +203,7 @@ public class HpackEncoder {
             }
         }
         target.put((byte) 0); //to use encodeInteger we need to place the 
first byte in the buffer.
-        encodeInteger(target, headerName.length(), 7);
+        Hpack.encodeInteger(target, headerName.length(), 7);
         for (int j = 0; j < headerName.length(); ++j) {
             target.put(Hpack.toLower((byte) headerName.charAt(j)));
         }
@@ -227,7 +222,7 @@ public class HpackEncoder {
 
     private void writeValueString(ByteBuffer target, String val) {
         target.put((byte) 0); //to use encodeInteger we need to place the 
first byte in the buffer.
-        encodeInteger(target, val.length(), 7);
+        Hpack.encodeInteger(target, val.length(), 7);
         for (int j = 0; j < val.length(); ++j) {
             target.put((byte) val.charAt(j));
         }
@@ -317,10 +312,10 @@ public class HpackEncoder {
         }
         if (minNewMaxHeaderSize != newMaxHeaderSize) {
             target.put((byte) (1 << 5));
-            encodeInteger(target, minNewMaxHeaderSize, 5);
+            Hpack.encodeInteger(target, minNewMaxHeaderSize, 5);
         }
         target.put((byte) (1 << 5));
-        encodeInteger(target, newMaxHeaderSize, 5);
+        Hpack.encodeInteger(target, newMaxHeaderSize, 5);
         maxTableSize = newMaxHeaderSize;
         runEvictionIfRequired();
         newMaxHeaderSize = -1;
@@ -363,7 +358,7 @@ public class HpackEncoder {
 
         @Override
         public int getPosition() {
-            return super.getPosition() + entryPositionCounter + 
STATIC_TABLE_LENGTH;
+            return super.getPosition() + entryPositionCounter + 
Hpack.STATIC_TABLE_LENGTH;
         }
     }
 

Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHpack.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHpack.java?rev=1668188&r1=1668187&r2=1668188&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/TestHpack.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/TestHpack.java Sat Mar 21 
03:47:17 2015
@@ -18,10 +18,11 @@ package org.apache.coyote.http2;
 
 import java.nio.ByteBuffer;
 
-import org.apache.tomcat.util.http.MimeHeaders;
 import org.junit.Assert;
 import org.junit.Test;
 
+import org.apache.tomcat.util.http.MimeHeaders;
+
 public class TestHpack {
 
     @Test



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

Reply via email to