changeset 17388:92c31ec731eb

8163104: Unexpected NPE still possible on some Kerberos ticket calls Reviewed-by: weijun
author coffeys
date Wed, 10 Aug 2016 11:54:12 +0100
parents 94b271f4da23
children 7b894239a5c2
files src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5InitCredential.java
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5InitCredential.java	Tue Aug 09 22:31:41 2016 -0700
+++ b/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;
     }