kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rsiva...@apache.org
Subject [kafka] branch trunk updated: KAFKA-4883: handle NullPointerException while parsing login modue control flag (#4849)
Date Tue, 10 Apr 2018 19:46:35 GMT
This is an automated email from the ASF dual-hosted git repository.

rsivaram pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 5e277e5  KAFKA-4883: handle NullPointerException while parsing login modue control
flag (#4849)
5e277e5 is described below

commit 5e277e5579f4a989ecef6473fbc3619178b33a35
Author: Manikumar Reddy O <manikumar.reddy@gmail.com>
AuthorDate: Wed Apr 11 01:16:32 2018 +0530

    KAFKA-4883: handle NullPointerException while parsing login modue control flag (#4849)
---
 .../src/main/java/org/apache/kafka/common/security/JaasConfig.java   | 3 +++
 .../test/java/org/apache/kafka/common/security/JaasContextTest.java  | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/clients/src/main/java/org/apache/kafka/common/security/JaasConfig.java b/clients/src/main/java/org/apache/kafka/common/security/JaasConfig.java
index 24bdac2..5e837a6 100644
--- a/clients/src/main/java/org/apache/kafka/common/security/JaasConfig.java
+++ b/clients/src/main/java/org/apache/kafka/common/security/JaasConfig.java
@@ -81,6 +81,9 @@ class JaasConfig extends Configuration {
     }
 
     private LoginModuleControlFlag loginModuleControlFlag(String flag) {
+        if (flag == null)
+            throw new IllegalArgumentException("Login module control flag is not available
in the JAAS config");
+
         LoginModuleControlFlag controlFlag;
         switch (flag.toUpperCase(Locale.ROOT)) {
             case "REQUIRED":
diff --git a/clients/src/test/java/org/apache/kafka/common/security/JaasContextTest.java b/clients/src/test/java/org/apache/kafka/common/security/JaasContextTest.java
index e8535d2..d96b359 100644
--- a/clients/src/test/java/org/apache/kafka/common/security/JaasContextTest.java
+++ b/clients/src/test/java/org/apache/kafka/common/security/JaasContextTest.java
@@ -175,6 +175,11 @@ public class JaasContextTest {
     }
 
     @Test
+    public void testInvalidControlFlag() throws Exception {
+        checkInvalidConfiguration("test.testInvalidControlFlag { option1=3;");
+    }
+
+    @Test
     public void testNumericOptionWithQuotes() throws Exception {
         Map<String, Object> options = new HashMap<>();
         options.put("option1", "3");

-- 
To stop receiving notification emails like this one, please contact
rsivaram@apache.org.

Mime
View raw message