You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Haohui Mai (JIRA)" <ji...@apache.org> on 2014/11/05 20:08:34 UTC

[jira] [Comment Edited] (HADOOP-11267) TestSecurityUtil fails when run with JDK8 because of empty principal names

    [ https://issues.apache.org/jira/browse/HADOOP-11267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14198878#comment-14198878 ] 

Haohui Mai edited comment on HADOOP-11267 at 11/5/14 7:08 PM:
--------------------------------------------------------------

{code}
+    try {
+      assertFalse(SecurityUtil.isTGSPrincipal
+          (new KerberosPrincipal("/@")));
+    } catch (IllegalArgumentException iae) {
+      // Same as above. In recent JDK versions, an IllegalArgumentException
+      // is thrown if the principal name is empty.
+      GenericTestUtils.assertExceptionContains("Empty nameString not allowed", iae);
+    }
{code}
Maybe it makes more sense to remove the assertions instead of catching the Exception as the check does not offer much value.


was (Author: wheat9):
+    try {
+      assertFalse(SecurityUtil.isTGSPrincipal
+          (new KerberosPrincipal("/@")));
+    } catch (IllegalArgumentException iae) {
+      // Same as above. In recent JDK versions, an IllegalArgumentException
+      // is thrown if the principal name is empty.
+      GenericTestUtils.assertExceptionContains("Empty nameString not allowed", iae);
+    }

Maybe it makes more sense to remove the assertions instead of catching the Exception as the check does not offer much value.

> TestSecurityUtil fails when run with JDK8 because of empty principal names
> --------------------------------------------------------------------------
>
>                 Key: HADOOP-11267
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11267
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: security, test
>    Affects Versions: 2.3.0
>            Reporter: Stephen Chu
>            Assignee: Stephen Chu
>            Priority: Minor
>         Attachments: HADOOP-11267.1.patch
>
>
> Running {{TestSecurityUtil}} on JDK8 will fail:
> {code}
> java.lang.IllegalArgumentException: Empty nameString not allowed
> 	at sun.security.krb5.PrincipalName.validateNameStrings(PrincipalName.java:171)
> 	at sun.security.krb5.PrincipalName.<init>(PrincipalName.java:393)
> 	at sun.security.krb5.PrincipalName.<init>(PrincipalName.java:460)
> 	at javax.security.auth.kerberos.KerberosPrincipal.<init>(KerberosPrincipal.java:120)
> 	at org.apache.hadoop.security.TestSecurityUtil.isOriginalTGTReturnsCorrectValues(TestSecurityUtil.java:57)
> {code}
> In JDK8, PrincipalName checks that its name is not empty and throws an IllegalArgumentException if it is empty. This didn't happen in JDK6/7.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)