8163104: Unexpected NPE still possible on some Kerberos ticket calls
authorcoffeys
Wed, 10 Aug 2016 11:54:12 +0100
changeset 40255 0222e4232e7c
parent 40254 a68a0f6758df
child 40256 c5e03eaf7ba2
8163104: Unexpected NPE still possible on some Kerberos ticket calls Reviewed-by: weijun
jdk/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5InitCredential.java
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5InitCredential.java	Tue Aug 09 22:31:41 2016 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5InitCredential.java	Wed Aug 10 11:54:12 2016 +0100
@@ -235,8 +235,11 @@
      */
     public int getInitLifetime() throws GSSException {
         int retVal = 0;
-        retVal = (int)(getEndTime().getTime()
-                       - (new Date().getTime()));
+        Date d = getEndTime();
+        if (d == null) {
+            return 0;
+        }
+        retVal = (int)(d.getTime() - (new Date().getTime()));
 
         return retVal/1000;
     }