8163104: Unexpected NPE still possible on some Kerberos ticket calls
Reviewed-by: weijun
--- 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;
}