8187218: GSSCredential.getRemainingLifetime() returns negative value for TTL > 24 days

Co-authored-by: Weijun Wang <weijun.wang@oracle.com>
Reviewed-by: mullan
This commit is contained in:
Prasadrao Koppula 2018-03-20 11:16:10 +05:30
parent 22c9d34be1
commit b3e5409c1d
3 changed files with 77 additions and 31 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -234,14 +234,12 @@ public class Krb5InitCredential
* @exception GSSException may be thrown
*/
public int getInitLifetime() throws GSSException {
int retVal = 0;
Date d = getEndTime();
if (d == null) {
return 0;
}
retVal = (int)(d.getTime() - (new Date().getTime()));
return retVal/1000;
long retVal = d.getTime() - System.currentTimeMillis();
return (int)(retVal/1000);
}
/**