diff options
author | Klaudio Sinani <klaudio.sinani@sonarsource.com> | 2022-10-26 15:16:57 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-10-28 20:03:23 +0000 |
commit | ce409098feab4f5f5ca8168cd995775e1fa32cbb (patch) | |
tree | a04c7bf89c2b7792dbed6895b6f3db0fd3171cb1 /server/sonar-webserver-core | |
parent | 84dfd8b586f0c458d324e815f8b09ce3b395c044 (diff) | |
download | sonarqube-ce409098feab4f5f5ca8168cd995775e1fa32cbb.tar.gz sonarqube-ce409098feab4f5f5ca8168cd995775e1fa32cbb.zip |
[NO-JIRA] Fix reported code smells & bugs
Diffstat (limited to 'server/sonar-webserver-core')
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); |