RED-6686 - fixed PMD

This commit is contained in:
Timo Bejan 2023-06-14 16:42:55 +03:00
parent 47ca03db93
commit 7f178f6b45
5 changed files with 17 additions and 12 deletions

View File

@ -5,7 +5,7 @@ plugins {
id("org.springframework.boot") version "3.0.6"
id("io.spring.dependency-management") version "1.1.0"
id("org.sonarqube") version "4.0.0.2929"
// pmd
pmd
checkstyle
}
@ -15,13 +15,13 @@ configurations {
}
}
//tasks.pmdMain{
// pmd.ruleSetFiles = files("${projectDir}/config/pmd/pmd.xml")
//}
//
//tasks.pmdTest {
// pmd.ruleSetFiles = files("${projectDir}/config/pmd/test_pmd.xml")
//}
tasks.pmdMain{
pmd.ruleSetFiles = files("${projectDir}/config/pmd/pmd.xml")
}
tasks.pmdTest {
pmd.ruleSetFiles = files("${projectDir}/config/pmd/test_pmd.xml")
}

View File

@ -10,5 +10,6 @@
<exclude name="DataflowAnomalyAnalysis"/>
<exclude name="MissingSerialVersionUID"/>
<exclude name="AvoidDuplicateLiterals"/>
<exclude name="AvoidLiteralsInIfCondition"/>
</rule>
</ruleset>

View File

@ -10,5 +10,7 @@
<exclude name="DataflowAnomalyAnalysis"/>
<exclude name="MissingSerialVersionUID"/>
<exclude name="BeanMembersShouldSerialize"/>
<exclude name="AvoidDuplicateLiterals"/>
<exclude name="AvoidLiteralsInIfCondition"/>
</rule>
</ruleset>

View File

@ -35,18 +35,19 @@ public class GeneralConfigurationService {
var realm = realmService.realm(TenantContext.getTenantId()).toRepresentation();
var auxiliaryName = realm.getDisplayNameHtml();
String computedAuxiliaryName = null;
if (!tenantUserManagementProperties.getApplicationName().equals(auxiliaryName)) {
auxiliaryName = StringUtils.replaceOnce(auxiliaryName, tenantUserManagementProperties.getApplicationName(), "");
auxiliaryName = StringUtils.replaceOnce(auxiliaryName, " (", "");
auxiliaryName = StringUtils.reverse(StringUtils.replaceOnce(StringUtils.reverse(auxiliaryName), ")", ""));
} else {
auxiliaryName = null;
computedAuxiliaryName = auxiliaryName;
}
return GeneralConfigurationModel.builder()
.auxiliaryName(auxiliaryName)
.auxiliaryName(computedAuxiliaryName)
.displayName(realm.getDisplayNameHtml())
.forgotPasswordFunctionEnabled(realm.isResetPasswordAllowed() != null && realm.isResetPasswordAllowed())
.build();

View File

@ -3,6 +3,7 @@ package com.knecon.fforesight.tenantusermanagement.service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@ -39,7 +40,7 @@ public class UserListingService {
Map<String, Set<String>> usersByRole = new HashMap<>();
if (!allUsers.isEmpty()) {
var realmRoles = realm.roles().list().stream().map(r -> r.getName().toUpperCase()).collect(Collectors.toSet());
var realmRoles = realm.roles().list().stream().map(r -> r.getName().toUpperCase(Locale.ROOT)).collect(Collectors.toSet());
var allRoles = tenantUserManagementProperties.getKcRoleMapping().getAllRoles();
for (var role : allRoles) {
if (realmRoles.contains(role)) {