http-client-branch: (HPACK) fix for OOME in test http-client-branch
authorprappo
Wed, 29 Nov 2017 14:27:12 +0300
branchhttp-client-branch
changeset 55910 9b2f7e9e95a2
parent 55909 583695a0ed6a
child 55911 d3298b9365e7
http-client-branch: (HPACK) fix for OOME in test
test/jdk/java/net/httpclient/http2/jdk.incubator.httpclient/jdk/incubator/http/internal/hpack/HeaderTableTest.java
--- a/test/jdk/java/net/httpclient/http2/jdk.incubator.httpclient/jdk/incubator/http/internal/hpack/HeaderTableTest.java	Wed Nov 29 11:15:19 2017 +0000
+++ b/test/jdk/java/net/httpclient/http2/jdk.incubator.httpclient/jdk/incubator/http/internal/hpack/HeaderTableTest.java	Wed Nov 29 14:27:12 2017 +0300
@@ -267,9 +267,11 @@
 
     @Test
     public void fifo() {
-        HeaderTable t = new HeaderTable(Integer.MAX_VALUE, HPACK.getLogger());
         // Let's add a series of header fields
         int NUM_HEADERS = 32;
+        HeaderTable t = new HeaderTable((32 + 4) * NUM_HEADERS, HPACK.getLogger());
+        //                                ^   ^
+        //                   entry overhead   symbols per entry (max 2x2 digits)
         for (int i = 1; i <= NUM_HEADERS; i++) {
             String s = String.valueOf(i);
             t.put(s, s);
@@ -293,9 +295,11 @@
 
     @Test
     public void indexOf() {
-        HeaderTable t = new HeaderTable(Integer.MAX_VALUE, HPACK.getLogger());
         // Let's put a series of header fields
         int NUM_HEADERS = 32;
+        HeaderTable t = new HeaderTable((32 + 4) * NUM_HEADERS, HPACK.getLogger());
+        //                                ^   ^
+        //                   entry overhead   symbols per entry (max 2x2 digits)
         for (int i = 1; i <= NUM_HEADERS; i++) {
             String s = String.valueOf(i);
             t.put(s, s);