From 39680546a8a098c635efdfffeee236109cb426cf Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Mon, 11 Jul 2022 23:54:53 +0200 Subject: [PATCH] Move trailing comments Sonarcloud does not like these, move them. Change-Id: I6f6b6b4498b36cd6a80baff36131780bd5837779 Signed-off-by: Robert Varga --- .../opendaylight/aaa/api/StoreBuilder.java | 24 +++++++++---------- .../aaa/web/jetty/JettyWebServer.java | 6 +++-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/aaa-authn-api/src/main/java/org/opendaylight/aaa/api/StoreBuilder.java b/aaa-authn-api/src/main/java/org/opendaylight/aaa/api/StoreBuilder.java index 2e5436e78..5fef7f47d 100644 --- a/aaa-authn-api/src/main/java/org/opendaylight/aaa/api/StoreBuilder.java +++ b/aaa-authn-api/src/main/java/org/opendaylight/aaa/api/StoreBuilder.java @@ -51,7 +51,7 @@ public class StoreBuilder { private final IIDMStore store; - public StoreBuilder(IIDMStore store) { + public StoreBuilder(final IIDMStore store) { this.store = store; } @@ -63,13 +63,12 @@ public class StoreBuilder { * @return ID of the just newly created Domain, or null if no new one had to be created * @throws IDMStoreException for issues coming from the IIDMStore */ - public String initDomainAndRolesWithoutUsers(String domainID) throws IDMStoreException { + public String initDomainAndRolesWithoutUsers(final String domainID) throws IDMStoreException { LOG.info("Checking if default entries must be created in IDM store"); // Check whether the default domain exists. If it exists, then do not // create default data in the store. - // TODO Address the fact that someone may delete the sdn domain, or make - // sdn mandatory. + // FIXME: Address the fact that someone may delete the sdn domain, or make sdn mandatory. Domain defaultDomain = store.readDomain(domainID); if (defaultDomain != null) { LOG.info("Found default domain in IDM store, skipping insertion of default data"); @@ -110,14 +109,14 @@ public class StoreBuilder { * @param domainID ID (same as name) of the "authentication domain" * @throws IDMStoreException for issues coming from the IIDMStore */ - public void initWithDefaultUsers(String domainID) throws IDMStoreException { + public void initWithDefaultUsers(final String domainID) throws IDMStoreException { String newDomainID = initDomainAndRolesWithoutUsers(domainID); if (newDomainID != null) { createUser(newDomainID, "admin", "admin", true); } } - public List getRoleIDs(String domainID, List roleNames) throws IDMStoreException { + public List getRoleIDs(final String domainID, final List roleNames) throws IDMStoreException { Map roleNameToID = new HashMap<>(); List roles = store.getRoles().getRoles(); for (Role role : roles) { @@ -149,8 +148,8 @@ public class StoreBuilder { * @return ID of the just newly created user, useful to reference it e.g. in grants * @throws IDMStoreException for issues coming from the IIDMStore */ - public String createUser(String domainID, String userName, String password, List roleIDs) - throws IDMStoreException { + public String createUser(final String domainID, final String userName, final String password, + final List roleIDs) throws IDMStoreException { User newUser = new User(); newUser.setEnabled(true); newUser.setDomainid(domainID); @@ -168,7 +167,7 @@ public class StoreBuilder { return newUserID; } - public String createUser(String domainID, String userName, String password, boolean isAdmin) + public String createUser(final String domainID, final String userName, final String password, final boolean isAdmin) throws IDMStoreException { List roleIDs; if (isAdmin) { @@ -179,16 +178,17 @@ public class StoreBuilder { return createUser(domainID, userName, password, roleIDs); } - public boolean deleteUser(String domainID, String userName) throws IDMStoreException { + public boolean deleteUser(final String domainID, final String userName) throws IDMStoreException { String userID = IDMStoreUtil.createUserid(userName, domainID); - Grants grants = store.getGrants(userID); // NOT store.getGrants(domainID, userName) + // NOT store.getGrants(domainID, userName) ! + Grants grants = store.getGrants(userID); for (Grant grant : grants.getGrants()) { store.deleteGrant(grant.getGrantid()); } return store.deleteUser(userID) != null; } - private void createGrant(String domainID, String userID, String roleID) throws IDMStoreException { + private void createGrant(final String domainID, final String userID, final String roleID) throws IDMStoreException { Grant grant = new Grant(); grant.setDomainid(domainID); grant.setUserid(userID); diff --git a/web/impl-jetty/src/main/java/org/opendaylight/aaa/web/jetty/JettyWebServer.java b/web/impl-jetty/src/main/java/org/opendaylight/aaa/web/jetty/JettyWebServer.java index 35837c568..137855c87 100644 --- a/web/impl-jetty/src/main/java/org/opendaylight/aaa/web/jetty/JettyWebServer.java +++ b/web/impl-jetty/src/main/java/org/opendaylight/aaa/web/jetty/JettyWebServer.java @@ -46,7 +46,8 @@ public class JettyWebServer implements WebServer { private final ContextHandlerCollection contextHandlerCollection; public JettyWebServer() { - this(0); // automatically choose free port + // automatically choose free port + this(0); } public JettyWebServer(final int httpPort) { @@ -120,7 +121,8 @@ public class JettyWebServer implements WebServer { ServletHolder servletHolder = new ServletHolder(servlet.name(), servlet.servlet()); servletHolder.setInitParameters(servlet.initParams()); servletHolder.setAsyncSupported(servlet.getAsyncSupported()); - servletHolder.setInitOrder(1); // AKA 1 + // AKA 1 + servletHolder.setInitOrder(1); servlet.urlPatterns().forEach( urlPattern -> handler.addServlet(servletHolder, urlPattern) ); -- 2.36.6