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 5BBE6200BB3 for ; Wed, 19 Oct 2016 07:12:15 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 59F3E160AF7; Wed, 19 Oct 2016 05:12:15 +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 9E816160AE5 for ; Wed, 19 Oct 2016 07:12:14 +0200 (CEST) Received: (qmail 66968 invoked by uid 500); 19 Oct 2016 05:12:13 -0000 Mailing-List: contact commits-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kafka.apache.org Delivered-To: mailing list commits@kafka.apache.org Received: (qmail 66959 invoked by uid 99); 19 Oct 2016 05:12:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Oct 2016 05:12:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7C050E390E; Wed, 19 Oct 2016 05:12:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jgus@apache.org To: commits@kafka.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: kafka git commit: MINOR: Replaced unnecessary map and getOrElse with exists Date: Wed, 19 Oct 2016 05:12:13 +0000 (UTC) archived-at: Wed, 19 Oct 2016 05:12:15 -0000 Repository: kafka Updated Branches: refs/heads/trunk b8cfa167e -> 2965f50e0 MINOR: Replaced unnecessary map and getOrElse with exists Author: himani1 <1himani.arora@gmail.com> Reviewers: Jason Gustafson Closes #2035 from himani1/code_refactored Project: http://git-wip-us.apache.org/repos/asf/kafka/repo Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/2965f50e Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/2965f50e Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/2965f50e Branch: refs/heads/trunk Commit: 2965f50e0de755cd36cf5e13bd9968493a0f8279 Parents: b8cfa16 Author: himani1 <1himani.arora@gmail.com> Authored: Tue Oct 18 22:12:08 2016 -0700 Committer: Jason Gustafson Committed: Tue Oct 18 22:12:08 2016 -0700 ---------------------------------------------------------------------- .../kafka/security/auth/SimpleAclAuthorizer.scala | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kafka/blob/2965f50e/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala ---------------------------------------------------------------------- diff --git a/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala b/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala index 42bfebf..72f79d5 100644 --- a/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala +++ b/core/src/main/scala/kafka/security/auth/SimpleAclAuthorizer.scala @@ -161,15 +161,15 @@ class SimpleAclAuthorizer extends Authorizer with Logging { } private def aclMatch(session: Session, operations: Operation, resource: Resource, principal: KafkaPrincipal, host: String, permissionType: PermissionType, acls: Set[Acl]): Boolean = { - acls.find ( acl => - acl.permissionType == permissionType - && (acl.principal == principal || acl.principal == Acl.WildCardPrincipal) - && (operations == acl.operation || acl.operation == All) - && (acl.host == host || acl.host == Acl.WildCardHost) - ).map { acl: Acl => + acls.find { acl => + acl.permissionType == permissionType && + (acl.principal == principal || acl.principal == Acl.WildCardPrincipal) && + (operations == acl.operation || acl.operation == All) && + (acl.host == host || acl.host == Acl.WildCardHost) + }.exists { acl => authorizerLogger.debug(s"operation = $operations on resource = $resource from host = $host is $permissionType based on acl = $acl") true - }.getOrElse(false) + } } override def addAcls(acls: Set[Acl], resource: Resource) {