Skip to content

Commit

Permalink
[BUG] 🐛 fix some sonar/compilation warnings
Browse files Browse the repository at this point in the history
Signed-off-by: CĂ©dric Couralet <[email protected]>
  • Loading branch information
Insee - Domaine Outils Transverses authored and Donatien26 committed Jul 21, 2021
1 parent 6695182 commit 14d0b6c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
echo -e "\n\n" >> changelog.tmp
cat CHANGELOG.md >> changelog.tmp
mv changelog.tmp CHANGELOG.md
mvn -B spotless:apply
git add .
git commit -sm "[REL] :rocket: release version ${{ github.event.inputs.version }}"
git push origin release-${{ github.event.inputs.version }} -f
Expand Down
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<apache.commons.csv.version>1.8</apache.commons.csv.version>
<wiremock-standalone.version>2.27.2</wiremock-standalone.version>
<freemarker.version>2.3.31</freemarker.version>
<git-commit-id-plugin.version>4.0.5</git-commit-id-plugin.version>
</properties>

<dependencies></dependencies>
Expand Down Expand Up @@ -339,6 +340,7 @@
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>${git-commit-id-plugin.version}</version>
<executions>
<execution>
<phase>validate</phase>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,18 @@
package fr.insee.sugoi.core.service.impl;

import fr.insee.sugoi.core.model.SugoiUser;
import fr.insee.sugoi.core.realm.RealmProvider;
import fr.insee.sugoi.core.service.PermissionService;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.apache.commons.lang.text.StrSubstitutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

Expand All @@ -48,9 +47,7 @@ public class PermissionServiceImpl implements PermissionService {
@Value("${fr.insee.sugoi.api.regexp.role.application.manager:}")
private List<String> applicationManagerRoleList;

@Autowired private RealmProvider realmProvider;

public static final Logger logger = LoggerFactory.getLogger(PermissionService.class);
public static final Logger logger = LoggerFactory.getLogger(PermissionServiceImpl.class);

@Override
public boolean isReader(SugoiUser sugoiUser, String realm, String userStorage) {
Expand Down Expand Up @@ -106,7 +103,7 @@ private boolean checkIfUserGetRoles(SugoiUser sugoiUser, List<String> rolesSearc
return true;
}
for (String role : roles) {
if (role.toUpperCase().matches(roleSearch.replaceAll("\\*", ".*").toUpperCase())) {
if (role.toUpperCase().matches(roleSearch.replace("*", ".*").toUpperCase())) {
return true;
}
}
Expand Down Expand Up @@ -181,7 +178,7 @@ private List<String> getUserRightList(SugoiUser sugoiUser, List<String> regexpLi
}
return null;
})
.filter(role -> role != null)
.filter(Objects::nonNull)
.collect(Collectors.toList());
return roles;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public WhoamiGlue(StepData stepData) {
public void expect_to_receive_his_rights() {
ObjectMapper mapper = new ObjectMapper();
try {
WhoamiView view = mapper.readValue(stepData.getLatestResponse().getBody(), WhoamiView.class);
mapper.readValue(stepData.getLatestResponse().getBody(), WhoamiView.class);
assertThat("Data receive is a whoamiView", true, is(true));
} catch (JsonProcessingException e) {
assertThat("Data receive is a whoamiView", false, is(true));
Expand Down

0 comments on commit 14d0b6c

Please sign in to comment.