emissionnebula commented on code in PR #14440:
URL: https://github.com/apache/kafka/pull/14440#discussion_r1335745349


##########
clients/src/test/java/org/apache/kafka/test/TestSslUtils.java:
##########
@@ -399,10 +399,12 @@ public CertificateBuilder(int days, String algorithm) {
         }
 
         public CertificateBuilder sanDnsNames(String... hostNames) throws 
IOException {
-            GeneralName[] altNames = new GeneralName[hostNames.length];
-            for (int i = 0; i < hostNames.length; i++)
-                altNames[i] = new GeneralName(GeneralName.dNSName, 
hostNames[i]);
-            subjectAltName = GeneralNames.getInstance(new 
DERSequence(altNames)).getEncoded();
+            if (hostNames.length > 0) {
+                GeneralName[] altNames = new GeneralName[hostNames.length];
+                for (int i = 0; i < hostNames.length; i++)
+                    altNames[i] = new GeneralName(GeneralName.dNSName, 
hostNames[i]);
+                subjectAltName = GeneralNames.getInstance(new 
DERSequence(altNames)).getEncoded();
+            }

Review Comment:
   Makes sense. Added the `else` clause. Thank you!



-- 
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.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to