aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-process/src
diff options
context:
space:
mode:
authorMatteo Mara <matteo.mara@sonarsource.com>2023-01-09 10:21:46 +0100
committersonartech <sonartech@sonarsource.com>2023-01-10 20:03:01 +0000
commit295a87208f8c9898fbdc733a438587dc03a16877 (patch)
tree9771ee3245ab6e978b20b9d8b800450947fc7199 /server/sonar-process/src
parent8868a5ff310c74f44f2c94e46ba31065017f50b4 (diff)
downloadsonarqube-295a87208f8c9898fbdc733a438587dc03a16877.tar.gz
sonarqube-295a87208f8c9898fbdc733a438587dc03a16877.zip
[NO-JIRA] Remove reported code smells about usage of instanceof
Diffstat (limited to 'server/sonar-process/src')
-rw-r--r--server/sonar-process/src/main/java/org/sonar/process/PluginFileWriteRule.java7
1 files changed, 2 insertions, 5 deletions
diff --git a/server/sonar-process/src/main/java/org/sonar/process/PluginFileWriteRule.java b/server/sonar-process/src/main/java/org/sonar/process/PluginFileWriteRule.java
index 1008f196d3d..18b055bb1d7 100644
--- a/server/sonar-process/src/main/java/org/sonar/process/PluginFileWriteRule.java
+++ b/server/sonar-process/src/main/java/org/sonar/process/PluginFileWriteRule.java
@@ -44,11 +44,8 @@ public class PluginFileWriteRule implements PluginPolicyRule {
@Override
public boolean implies(Permission permission) {
- if (permission instanceof FilePermission) {
- FilePermission requestPermission = (FilePermission) permission;
- if (blockedFilePermission.implies(requestPermission) && !tmpFilePermission.implies(requestPermission)) {
- return false;
- }
+ if (permission instanceof FilePermission requestPermission) {
+ return !blockedFilePermission.implies(requestPermission) || tmpFilePermission.implies(requestPermission);
}
return true;
}