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 F0B13200D2D for ; Fri, 27 Oct 2017 19:53:16 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EF2F1160BF2; Fri, 27 Oct 2017 17:53:16 +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 6A7BB1609DD for ; Fri, 27 Oct 2017 19:53:16 +0200 (CEST) Received: (qmail 75736 invoked by uid 500); 27 Oct 2017 17:53:15 -0000 Mailing-List: contact notifications-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jira@apache.org Delivered-To: mailing list notifications@accumulo.apache.org Received: (qmail 75724 invoked by uid 99); 27 Oct 2017 17:53:15 -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; Fri, 27 Oct 2017 17:53:15 +0000 From: GitBox To: notifications@accumulo.apache.org Subject: [GitHub] keith-turner commented on a change in pull request #315: ACCUMULO-4731 Improve exception handling if a key encryption key cannot be loaded Message-ID: <150912679504.1069.9938359855308049830.gitbox@gitbox.apache.org> archived-at: Fri, 27 Oct 2017 17:53:17 -0000 keith-turner commented on a change in pull request #315: ACCUMULO-4731 Improve exception handling if a key encryption key cannot be loaded URL: https://github.com/apache/accumulo/pull/315#discussion_r147475074 ########## File path: core/src/main/java/org/apache/accumulo/core/security/crypto/CachingHDFSSecretKeyEncryptionStrategy.java ########## @@ -127,26 +128,44 @@ public synchronized void ensureSecretKeyCacheInitialized(CryptoModuleParameters pathToKeyName = Property.CRYPTO_DEFAULT_KEY_STRATEGY_KEY_LOCATION.getDefaultValue(); } - // TODO ACCUMULO-2530 Ensure volumes a properly supported + // TODO ACCUMULO-2530 Ensure volumes are properly supported Path pathToKey = new Path(pathToKeyName); FileSystem fs = FileSystem.get(CachedConfiguration.getInstance()); DataInputStream in = null; + boolean invalidFile = false; + int keyEncryptionKeyLength = 0; + try { if (!fs.exists(pathToKey)) { initializeKeyEncryptionKey(fs, pathToKey, context); } in = fs.open(pathToKey); - int keyEncryptionKeyLength = in.readInt(); + keyEncryptionKeyLength = in.readInt(); Review comment: Could also check for negative lengths below, but its seem unnecessary. Are there any negative numbers that would pass the check below? I don't think so but not 100% sure since getLen() may return a long and maybe there is some weird case I am missing with long vs int. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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