changeset 8420:f9046a92fd12

8134297: NPE in GSSNameElement nameType check Reviewed-by: xuelei
author igerasim
date Fri, 27 Nov 2015 10:59:49 +0300
parents 3b8dad189d9f
children 2e520074f7da
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	Mon Jan 25 14:07:01 2016 +0000
+++ 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 {