changeset 11553:a7439fc2e413

8134297: NPE in GSSNameElement nameType check Reviewed-by: xuelei
author igerasim
date Fri, 27 Nov 2015 10:59:49 +0300
parents 5571df7bf412
children af660750b2f4
files src/share/classes/sun/security/jgss/wrapper/GSSNameElement.java
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/security/jgss/wrapper/GSSNameElement.java	Wed Nov 18 12:18:51 2015 +0300
+++ b/src/share/classes/sun/security/jgss/wrapper/GSSNameElement.java	Fri Nov 27 10:59:49 2015 +0300
@@ -159,7 +159,9 @@
             int atPos = krbName.lastIndexOf('@');
             if (atPos != -1) {
                 String atRealm = krbName.substring(atPos);
-                if (nameType.equals(GSSUtil.NT_GSS_KRB5_PRINCIPAL)
+                // getNativeNameType() can modify NT_GSS_KRB5_PRINCIPAL to null
+                if ((nameType == null
+                            || nameType.equals(GSSUtil.NT_GSS_KRB5_PRINCIPAL))
                         && new String(nameBytes).endsWith(atRealm)) {
                     // Created from Kerberos name with realm, no need to check
                 } else {