You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/03/23 14:05:36 UTC

svn commit: r1668623 - in /tomcat/trunk/java/org/apache/coyote/http2: HPackHuffman.java Hpack.java HpackDecoder.java HpackEncoder.java HpackException.java

Author: markt
Date: Mon Mar 23 13:05:36 2015
New Revision: 1668623

URL: http://svn.apache.org/r1668623
Log:
Fix the Javadoc warnings

Modified:
    tomcat/trunk/java/org/apache/coyote/http2/HPackHuffman.java
    tomcat/trunk/java/org/apache/coyote/http2/Hpack.java
    tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java
    tomcat/trunk/java/org/apache/coyote/http2/HpackEncoder.java
    tomcat/trunk/java/org/apache/coyote/http2/HpackException.java

Modified: tomcat/trunk/java/org/apache/coyote/http2/HPackHuffman.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/HPackHuffman.java?rev=1668623&r1=1668622&r2=1668623&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/HPackHuffman.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/HPackHuffman.java Mon Mar 23 13:05:36 2015
@@ -364,14 +364,18 @@ public class HPackHuffman {
     }
 
     /**
-     * Decodes a huffman encoded string into the target StringBuilder. There must be enough space left in the buffer
-     * for this method to succeed.
+     * Decodes a huffman encoded string into the target StringBuilder. There
+     * must be enough space left in the buffer for this method to succeed.
      *
      * @param data   The byte buffer
-     * @param length The data length
+     * @param length The length of data from the buffer to decode
      * @param target The target for the decompressed data
+     *
+     * @throws HpackException If the Huffman encoded value in HPACK headers did
+     *                        not end with EOS padding
      */
-    public static void decode(ByteBuffer data, int length, StringBuilder target) throws HpackException {
+    public static void decode(ByteBuffer data, int length, StringBuilder target)
+            throws HpackException {
         assert data.remaining() >= length;
         int treePos = 0;
         boolean eosBits = true;
@@ -404,14 +408,16 @@ public class HPackHuffman {
             }
         }
         if (!eosBits) {
-            throw new HpackException(sm.getString("hpackhuffman.huffmanEncodedHpackValueDidNotEndWithEOS"));
+            throw new HpackException(sm.getString(
+                    "hpackhuffman.huffmanEncodedHpackValueDidNotEndWithEOS"));
         }
     }
 
 
     /**
-     * Encodes the given string into the buffer. If there is not enough space in the buffer, or the encoded
-     * version is bigger than the original it will return false and not modify the buffers position
+     * Encodes the given string into the buffer. If there is not enough space in
+     * the buffer, or the encoded version is bigger than the original it will
+     * return false and not modify the buffers position.
      *
      * @param buffer   The buffer to encode into
      * @param toEncode The string to encode

Modified: tomcat/trunk/java/org/apache/coyote/http2/Hpack.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Hpack.java?rev=1668623&r1=1668622&r2=1668623&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/Hpack.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Hpack.java Mon Mar 23 13:05:36 2015
@@ -159,7 +159,8 @@ final class Hpack {
             int m = 0;
             do {
                 if(count++ > MAX_INTEGER_OCTETS) {
-                    throw new HpackException(sm.getString("hpack.integerEncodedOverTooManyOctets", MAX_INTEGER_OCTETS));
+                    throw new HpackException(sm.getString("hpack.integerEncodedOverTooManyOctets",
+                            Integer.valueOf(MAX_INTEGER_OCTETS)));
                 }
                 if (source.remaining() == 0) {
                     //we have run out of data

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=1668623&r1=1668622&r2=1668623&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java Mon Mar 23 13:05:36 2015
@@ -73,11 +73,13 @@ public class HpackDecoder {
     }
 
     /**
-     * Decodes the provided frame data. If this method leaves data in the buffer then
-     * this buffer should be compacted so this data is preserved, unless there is no
-     * more data in which case this should be considered a protocol error.
+     * Decodes the provided frame data. If this method leaves data in the buffer
+     * then this buffer should be compacted so this data is preserved, unless
+     * there is no more data in which case this should be considered a protocol error.
      *
      * @param buffer The buffer
+     *
+     * @throws HpackException If the packed data is not valid
      */
     public void decode(ByteBuffer buffer) throws HpackException {
         while (buffer.hasRemaining()) {
@@ -91,7 +93,8 @@ public class HpackDecoder {
                     buffer.position(originalPos);
                     return;
                 } else if(index == 0) {
-                    throw new HpackException(sm.getString("hpackdecoder.zeroNotValidHeaderTableIndex"));
+                    throw new HpackException(
+                            sm.getString("hpackdecoder.zeroNotValidHeaderTableIndex"));
                 }
                 handleIndex(index);
             } else if ((b & 0b01000000) != 0) {

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=1668623&r1=1668622&r2=1668623&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/HpackEncoder.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/HpackEncoder.java Mon Mar 23 13:05:36 2015
@@ -110,8 +110,10 @@ public class HpackEncoder {
     /**
      * Encodes the headers into a buffer.
      *
-     * @param headers
-     * @param target
+     * @param headers The headers to encode
+     * @param target  The buffer to which to write the encoded headers
+     *
+     * @return The state of the encoding process
      */
     public State encode(MimeHeaders headers, ByteBuffer target) {
         int it = headersIterator;
@@ -233,7 +235,7 @@ public class HpackEncoder {
         DynamicTableEntry d = new DynamicTableEntry(headerName, val, -pos);
         List<TableEntry> existing = dynamicTable.get(headerName);
         if (existing == null) {
-            dynamicTable.put(headerName, existing = new ArrayList<TableEntry>(1));
+            dynamicTable.put(headerName, existing = new ArrayList<>(1));
         }
         existing.add(d);
         evictionQueue.add(d);

Modified: tomcat/trunk/java/org/apache/coyote/http2/HpackException.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/HpackException.java?rev=1668623&r1=1668622&r2=1668623&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/HpackException.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/HpackException.java Mon Mar 23 13:05:36 2015
@@ -22,6 +22,9 @@ package org.apache.coyote.http2;
  * In this case the connection must be closed.
  */
 public class HpackException extends Exception {
+
+    private static final long serialVersionUID = 1L;
+
     public HpackException(String message, Throwable cause) {
         super(message, cause);
     }



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