New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] MINOR: Use named class for ExpiringCredential to improve principalLogText()
output
#12587
base: trunk
Are you sure you want to change the base?
Conversation
if (log.isDebugEnabled()) | ||
log.debug("[Principal={}]: It is an expiring credential after re-login as expected", | ||
principalLogText()); | ||
} | ||
} | ||
} | ||
|
||
private String principalLogText() { | ||
return expiringCredential == null ? principalName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rondagostino Do you recall why we had this code? I don't understand how we'd have no expiring credential and a non-null principal name. It seems like the latter would always be set from the expiring credential? Or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, given the way the code is written it is not possible to have both expiringCredential == null
and principalName != null
. I can't remember specifically why the code was written this way, but it was probably just being defensive in case the above constraint is ever violated. But the constraint is an intuitive one and the code will almost certainly not evolve in such a way as to violate it, so I think it may just cause the question to be raised and add to confusion.
principalLogText()
outputprincipalLogText()
output
c2f1893
to
e4064bd
Compare
Ok, I looked at this again, and I think there was a mistake combined with a poorly named variable that was causing confusion. The The reason this variable exists is because of the potential for this case to occur when trying to invoke
The bug is the line
Apologies for this morass -- two mistakes compounded into something quite confusing. |
ExpiringCredentialRefreshingLogin.principalLogText()
outputs the expiring credentialsimple class name, which is empty for anonymous classes.
I also took the change to remove effectively dead code given that some of
the checks would always have the same result.
Committer Checklist (excluded from commit message)