aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-core
diff options
context:
space:
mode:
authorKlaudio Sinani <klaudio.sinani@sonarsource.com>2022-10-26 15:16:57 +0200
committersonartech <sonartech@sonarsource.com>2022-10-28 20:03:23 +0000
commitce409098feab4f5f5ca8168cd995775e1fa32cbb (patch)
treea04c7bf89c2b7792dbed6895b6f3db0fd3171cb1 /server/sonar-webserver-core
parent84dfd8b586f0c458d324e815f8b09ce3b395c044 (diff)
downloadsonarqube-ce409098feab4f5f5ca8168cd995775e1fa32cbb.tar.gz
sonarqube-ce409098feab4f5f5ca8168cd995775e1fa32cbb.zip
[NO-JIRA] Fix reported code smells & bugs
Diffstat (limited to 'server/sonar-webserver-core')
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/rule/SingleDeprecatedRuleKey.java2
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/rule/SingleDeprecatedRuleKeyTest.java1
2 files changed, 2 insertions, 1 deletions
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/SingleDeprecatedRuleKey.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/SingleDeprecatedRuleKey.java
index 56dcc37dfe6..e5655148c00 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/SingleDeprecatedRuleKey.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/SingleDeprecatedRuleKey.java
@@ -106,7 +106,7 @@ class SingleDeprecatedRuleKey {
if (this == o) {
return true;
}
- if (!(o instanceof SingleDeprecatedRuleKey)) {
+ if (o == null || getClass() != o.getClass()) {
return false;
}
SingleDeprecatedRuleKey that = (SingleDeprecatedRuleKey) o;
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/SingleDeprecatedRuleKeyTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/SingleDeprecatedRuleKeyTest.java
index 587c88b35cc..182b52d273e 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/SingleDeprecatedRuleKeyTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/SingleDeprecatedRuleKeyTest.java
@@ -119,6 +119,7 @@ public class SingleDeprecatedRuleKeyTest {
assertThat(singleDeprecatedRuleKey1)
.isNotNull()
.isNotEqualTo("")
+ .isNotEqualTo(null)
.isNotEqualTo(singleDeprecatedRuleKey2);
assertThat(singleDeprecatedRuleKey2).isNotEqualTo(singleDeprecatedRuleKey1);