Skip to content

Commit 3163980

Browse files
author
Vladimir Kotal
committed
fix warnings reported by IDEA
1 parent f7f40d7 commit 3163980

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

plugins/src/main/java/opengrok/auth/plugin/LdapAttrPlugin.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class LdapAttrPlugin extends AbstractLdapPlugin {
5656
static final String FILE_PARAM = "file";
5757
static final String INSTANCE_PARAM = "instance";
5858

59-
static final String SESSION_ALLOWED_PREFIX = "opengrok-ldap-attr-plugin-allowed";
59+
private static final String SESSION_ALLOWED_PREFIX = "opengrok-ldap-attr-plugin-allowed";
6060
private String sessionAllowed = SESSION_ALLOWED_PREFIX;
6161

6262
/**
@@ -69,7 +69,6 @@ public class LdapAttrPlugin extends AbstractLdapPlugin {
6969
*/
7070
private String ldapAttr;
7171
private final Set<String> whitelist = new TreeSet<>();
72-
private String filePath;
7372
private Integer ldapUserInstance;
7473

7574
public LdapAttrPlugin() {
@@ -90,11 +89,12 @@ public void load(Map<String, Object> parameters) {
9089
init(parameters);
9190
}
9291

93-
void init(Map<String, Object> parameters) {
92+
private void init(Map<String, Object> parameters) {
9493
if ((ldapAttr = (String) parameters.get(ATTR_PARAM)) == null) {
9594
throw new NullPointerException("Missing param [" + ATTR_PARAM + "] in the setup");
9695
}
9796

97+
String filePath;
9898
if ((filePath = (String) parameters.get(FILE_PARAM)) == null) {
9999
throw new NullPointerException("Missing param [" + FILE_PARAM + "] in the setup");
100100
}
@@ -128,10 +128,9 @@ String getSessionAllowedAttrName() {
128128
return sessionAllowed;
129129
}
130130

131-
@SuppressWarnings("unchecked")
132131
@Override
133132
public void fillSession(HttpServletRequest req, User user) {
134-
Boolean sessionAllowed;
133+
boolean sessionAllowed;
135134
LdapUser ldapUser;
136135
Map<String, Set<String>> records = null;
137136
Set<String> attributeValues;
@@ -147,7 +146,7 @@ public void fillSession(HttpServletRequest req, User user) {
147146
// (and if found, cache the result in the LDAP user object).
148147
attributeValues = ldapUser.getAttribute(ldapAttr);
149148
if (attributeValues != null) {
150-
sessionAllowed = attributeValues.stream().anyMatch((t) -> whitelist.contains(t));
149+
sessionAllowed = attributeValues.stream().anyMatch(whitelist::contains);
151150
} else {
152151
try {
153152
String dn = ldapUser.getDn();
@@ -175,7 +174,7 @@ public void fillSession(HttpServletRequest req, User user) {
175174
}
176175

177176
ldapUser.setAttribute(ldapAttr, attributeValues);
178-
sessionAllowed = attributeValues.stream().anyMatch((t) -> whitelist.contains(t));
177+
sessionAllowed = attributeValues.stream().anyMatch(whitelist::contains);
179178
}
180179

181180
updateSession(req, sessionAllowed);
@@ -187,7 +186,7 @@ public void fillSession(HttpServletRequest req, User user) {
187186
* @param req the request
188187
* @param allowed the new value
189188
*/
190-
protected void updateSession(HttpServletRequest req, boolean allowed) {
189+
private void updateSession(HttpServletRequest req, boolean allowed) {
191190
req.getSession().setAttribute(sessionAllowed, allowed);
192191
}
193192

0 commit comments

Comments
 (0)