From notifications-return-1589-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Thu Aug 29 17:55:11 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 95A94180608 for ; Thu, 29 Aug 2019 19:55:11 +0200 (CEST) Received: (qmail 17998 invoked by uid 500); 29 Aug 2019 17:55:11 -0000 Mailing-List: contact notifications-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list notifications@zookeeper.apache.org Received: (qmail 17981 invoked by uid 99); 29 Aug 2019 17:55:11 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Aug 2019 17:55:11 +0000 From: GitBox To: notifications@zookeeper.apache.org Subject: [GitHub] [zookeeper] symat commented on a change in pull request #1056: ZOOKEEPER-3495: fix SnapshotDigestTest to work with JDK12+ Message-ID: <156710131096.4100.4869933760757925395.gitbox@gitbox.apache.org> Date: Thu, 29 Aug 2019 17:55:10 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit symat commented on a change in pull request #1056: ZOOKEEPER-3495: fix SnapshotDigestTest to work with JDK12+ URL: https://github.com/apache/zookeeper/pull/1056#discussion_r319197471 ########## File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/util/DigestCalculator.java ########## @@ -35,18 +35,21 @@ // The hardcoded digest version, should bump up this version whenever // we changed the digest method or fields. - // - // Defined it as Integer to make it able to be changed in test via reflection - public static final Integer DIGEST_VERSION = 2; + private static final int DIGEST_VERSION = 2; public static final String ZOOKEEPER_DIGEST_ENABLED = "zookeeper.digest.enabled"; - private static boolean digestEnabled; static { - digestEnabled = Boolean.parseBoolean(System.getProperty(ZOOKEEPER_DIGEST_ENABLED, "true")); - LOG.info("{} = {}", ZOOKEEPER_DIGEST_ENABLED, digestEnabled); + LOG.info("{} = {}", ZOOKEEPER_DIGEST_ENABLED, System.getProperty(ZOOKEEPER_DIGEST_ENABLED, "true")); } + private boolean digestEnabled; + + public DigestCalculator() { Review comment: This is a good idea. I tried it, but in `SnapshotDigestTest.testDifferentDigestVersion` we create a Mockito Spy on the class and apparently you can not create Mockito Spy on a final class. So instead of this I take @anmolnar 's original idea and moved this class to the `server` package and made it packet private, so at least it can not be overwritten from non-ZK code. Let's hope it will work also for @lvfangmin. If not, then we can move back... ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services