Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A3C4D200B9A for ; Fri, 7 Oct 2016 22:03:45 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A25FE160AE9; Fri, 7 Oct 2016 20:03:45 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BC5C6160AC6 for ; Fri, 7 Oct 2016 22:03:44 +0200 (CEST) Received: (qmail 33987 invoked by uid 500); 7 Oct 2016 20:03:43 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 33977 invoked by uid 99); 7 Oct 2016 20:03:43 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Oct 2016 20:03:43 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 24CAB18060C for ; Fri, 7 Oct 2016 20:03:43 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.199 X-Spam-Level: X-Spam-Status: No, score=-1.199 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id E3y7f_Q7IOJI for ; Fri, 7 Oct 2016 20:03:41 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTP id 89C075FAF6 for ; Fri, 7 Oct 2016 20:03:41 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 088CAE0099 for ; Fri, 7 Oct 2016 20:03:41 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id D9EED3A039C for ; Fri, 7 Oct 2016 20:03:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1763823 - in /tomcat/trunk: java/org/apache/coyote/http2/ByteUtil.java test/org/apache/coyote/http2/Http2TestBase.java test/org/apache/coyote/http2/TestHttp2Section_6_9.java Date: Fri, 07 Oct 2016 20:03:40 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20161007200340.D9EED3A039C@svn01-us-west.apache.org> archived-at: Fri, 07 Oct 2016 20:03:45 -0000 Author: markt Date: Fri Oct 7 20:03:39 2016 New Revision: 1763823 URL: http://svn.apache.org/viewvc?rev=1763823&view=rev Log: Reduce visibility as recommended by UCdetector Move utility method only used by tests to test code Modified: tomcat/trunk/java/org/apache/coyote/http2/ByteUtil.java tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_9.java Modified: tomcat/trunk/java/org/apache/coyote/http2/ByteUtil.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/ByteUtil.java?rev=1763823&r1=1763822&r2=1763823&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/ByteUtil.java (original) +++ tomcat/trunk/java/org/apache/coyote/http2/ByteUtil.java Fri Oct 7 20:03:39 2016 @@ -19,25 +19,25 @@ package org.apache.coyote.http2; /** * Utility class for extracting values from byte arrays. */ -public class ByteUtil { +class ByteUtil { private ByteUtil() { // Hide default constructor } - public static boolean isBit7Set(byte input) { + static boolean isBit7Set(byte input) { return (input & 0x80) > 0; } - public static int get31Bits(byte[] input, int firstByte) { + static int get31Bits(byte[] input, int firstByte) { return ((input[firstByte] & 0x7F) << 24) + ((input[firstByte + 1] & 0xFF) << 16) + ((input[firstByte + 2] & 0xFF) << 8) + (input[firstByte + 3] & 0xFF); } - public static void set31Bits(byte[] output, int firstByte, int value) { + static void set31Bits(byte[] output, int firstByte, int value) { output[firstByte] = (byte) ((value & 0x7F000000) >> 24); output[firstByte + 1] = (byte) ((value & 0xFF0000) >> 16); output[firstByte + 2] = (byte) ((value & 0xFF00) >> 8); @@ -45,47 +45,42 @@ public class ByteUtil { } - public static int getOneByte(byte[] input, int pos) { + static int getOneByte(byte[] input, int pos) { return (input[pos] & 0xFF); } - public static int getTwoBytes(byte[] input, int firstByte) { + static int getTwoBytes(byte[] input, int firstByte) { return ((input[firstByte] & 0xFF) << 8) + (input[firstByte + 1] & 0xFF); } - public static int getThreeBytes(byte[] input, int firstByte) { + static int getThreeBytes(byte[] input, int firstByte) { return ((input[firstByte] & 0xFF) << 16) + ((input[firstByte + 1] & 0xFF) << 8) + (input[firstByte + 2] & 0xFF); } - public static void setOneBytes(byte[] output, int firstByte, int value) { - output[firstByte] = (byte) (value & 0xFF); - } - - - public static void setTwoBytes(byte[] output, int firstByte, int value) { + static void setTwoBytes(byte[] output, int firstByte, int value) { output[firstByte] = (byte) ((value & 0xFF00) >> 8); output[firstByte + 1] = (byte) (value & 0xFF); } - public static void setThreeBytes(byte[] output, int firstByte, int value) { + static void setThreeBytes(byte[] output, int firstByte, int value) { output[firstByte] = (byte) ((value & 0xFF0000) >> 16); output[firstByte + 1] = (byte) ((value & 0xFF00) >> 8); output[firstByte + 2] = (byte) (value & 0xFF); } - public static long getFourBytes(byte[] input, int firstByte) { + static long getFourBytes(byte[] input, int firstByte) { return ((long)(input[firstByte] & 0xFF) << 24) + ((input[firstByte + 1] & 0xFF) << 16) + ((input[firstByte + 2] & 0xFF) << 8) + (input[firstByte + 3] & 0xFF); } - public static void setFourBytes(byte[] output, int firstByte, long value) { + static void setFourBytes(byte[] output, int firstByte, long value) { output[firstByte] = (byte) ((value & 0xFF000000) >> 24); output[firstByte + 1] = (byte) ((value & 0xFF0000) >> 16); output[firstByte + 2] = (byte) ((value & 0xFF00) >> 8); Modified: tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java?rev=1763823&r1=1763822&r2=1763823&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java (original) +++ tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java Fri Oct 7 20:03:39 2016 @@ -582,7 +582,7 @@ public abstract class Http2TestBase exte pingHeader[3] = FrameType.PING.getIdByte(); // Flags if (ack) { - ByteUtil.setOneBytes(pingHeader, 4, 0x01); + setOneBytes(pingHeader, 4, 0x01); } // Stream ByteUtil.set31Bits(pingHeader, 5, streamId); @@ -659,7 +659,7 @@ public abstract class Http2TestBase exte // Payload ByteUtil.set31Bits(priorityFrame, 9, streamDependencyId); - ByteUtil.setOneBytes(priorityFrame, 13, weight); + setOneBytes(priorityFrame, 13, weight); os.write(priorityFrame); os.flush(); @@ -701,6 +701,11 @@ public abstract class Http2TestBase exte } + static void setOneBytes(byte[] output, int firstByte, int value) { + output[firstByte] = (byte) (value & 0xFF); + } + + private static class TestInput implements Http2Parser.Input { private final InputStream is; Modified: tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_9.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_9.java?rev=1763823&r1=1763822&r2=1763823&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_9.java (original) +++ tomcat/trunk/test/org/apache/coyote/http2/TestHttp2Section_6_9.java Fri Oct 7 20:03:39 2016 @@ -81,7 +81,7 @@ public class TestHttp2Section_6_9 extend byte[] zeroLengthWindowFrame = new byte[9]; // Length zero - ByteUtil.setOneBytes(zeroLengthWindowFrame, 3, FrameType.WINDOW_UPDATE.getIdByte()); + setOneBytes(zeroLengthWindowFrame, 3, FrameType.WINDOW_UPDATE.getIdByte()); // No flags // Stream 1 ByteUtil.set31Bits(zeroLengthWindowFrame, 5, 1); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org