Skip to content
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

Change logging in normalizeDn() to debug to avoid noisy warnings #2599

Merged
merged 3 commits into from
Aug 3, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ private String normalizedDn(String dn) {
try {
return new Dn(dn).getNormName();
} catch (LdapInvalidDnException e) {
LOG.warn("Invalid DN", e);
LOG.debug("Invalid DN", e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm totally for this change but I fear that the handling inside the catch block will leave people clueless why stuff didn't work.

The caller of this method has basically no idea whether he really got back a normalized DN or an invalid DN. 😞

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea how to solve this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the method is not named correctly. We want to use this to:

  1. normalize DN strings if the passed value is a DN
  2. if it's not a DN we do not have to normalize it and just return the original

We need this because in the following case the member attribute might be a DN string or a regular string like just the username.

LOG.trace("DN {} == {} member?", dn, member.getString());
if (dn.equalsIgnoreCase(normalizedDn(member.getString()))) {
    groups.add(groupId);
} else {

We do not really care if it's a DN or not. The important part is that if the value is a DN it should be normalized.

Copy link
Contributor

@joschi joschi Aug 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. Could you please add a short Javadoc comment to the normalizeDn() method which says exactly this?

This way future me at least won't scratch his head about it. 😉

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aye, done! 😄

return dn;
}
}
Expand Down