> On 12 Apr 2016, at 16:56, Roger Riggs <roger.ri...@oracle.com> wrote: > > Since you have a TestHelper class you could put it there and not duplicate > the code in several tests.
Thanks! Done. http://cr.openjdk.java.net/~prappo/8153353/webrev.00/test/java/net/httpclient/http2/java.httpclient/sun/net/httpclient/hpack/TestHelper.java.html 32 public static Random newRandom() { 33 long seed = System.currentTimeMillis(); 34 System.out.println("new java.util.Random(" + seed + ")"); 35 return new Random(seed); 36 } >>> IntegerReader: >>> - It would be useful to have a reference to the spec for variable length >>> integers: i.e. rfc 7541 5.1 Integer Representation >>> >> [*] I have it in my TODO list. > it could be as simple as referring to "RFC 7541 section 5.1 Integer > Representation." I have a TODO item on changing all exceptions' messages to more informative ones. I'd prefer to bulk-address it later. >> Fixed remainder operator '%' mentioned by Simone, which I guess >> now reads better (and explained the intention as an assert): >> >> 474 public int lengthOf(CharSequence value, int start, int end) { >> 475 int len = 0; >> 476 for (int i = start; i < end; i++) { >> 477 char c = value.charAt(i); >> 478 len += INSTANCE.codeOf(c).length; >> 479 } >> 480 // Integer division with ceiling, assumption: >> 481 assert (len / 8 + (len % 8 != 0 ? 1 : 0)) == (len + 7) / 8 : len; >> > You don't believe the expression is equivalent? >> 482 return (len + 7) / 8; >> 483 } I do. They are equivalent within the range 0 <= len <= (Integer.MAX_VALUE - 7) I just thought my belief should be supported with an assertion [1] :-) -------------------------------------------------------------------------------- [1] https://docs.oracle.com/javase/7/docs/technotes/guides/language/assert.html#usage-invariants