From 3fbd9c9e1431371aa3ec4e5a2cbf45ea7d733a25 Mon Sep 17 00:00:00 2001 From: denes Date: Mon, 13 Sep 2021 17:04:39 +0200 Subject: [PATCH] NIFI-9201 NullPointerException in AbstractKerberosUser if the tgt is not renewable (#5383) --- .../apache/nifi/security/krb/AbstractKerberosUser.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nifi-commons/nifi-security-kerberos/src/main/java/org/apache/nifi/security/krb/AbstractKerberosUser.java b/nifi-commons/nifi-security-kerberos/src/main/java/org/apache/nifi/security/krb/AbstractKerberosUser.java index 6fe46b69f3..cc443c4b54 100644 --- a/nifi-commons/nifi-security-kerberos/src/main/java/org/apache/nifi/security/krb/AbstractKerberosUser.java +++ b/nifi-commons/nifi-security-kerberos/src/main/java/org/apache/nifi/security/krb/AbstractKerberosUser.java @@ -263,16 +263,18 @@ public abstract class AbstractKerberosUser implements KerberosUser { private long getRefreshTime(final KerberosTicket tgt) { final long start = tgt.getStartTime().getTime(); final long end = tgt.getEndTime().getTime(); - final long renewUntil = tgt.getRenewTill().getTime(); if (LOGGER.isTraceEnabled()) { final SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); final String startDate = dateFormat.format(new Date(start)); final String endDate = dateFormat.format(new Date(end)); - final String renewUntilDate = dateFormat.format(new Date(renewUntil)); LOGGER.trace("TGT for {} is valid starting at [{}]", principal, startDate); LOGGER.trace("TGT for {} expires at [{}]", principal, endDate); - LOGGER.trace("TGT for {} renews until [{}]", principal, renewUntilDate); + if (tgt.getRenewTill() == null) { + LOGGER.trace("TGT for {} is non-renewable", principal); + } else { + LOGGER.trace("TGT for {} renews until [{}]", principal, dateFormat.format(tgt.getRenewTill())); + } } return start + (long) ((end - start) * TICKET_RENEW_WINDOW);