diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-02-23 11:12:44 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-02-23 11:12:44 +0100 |
commit | 3c5fec7277657389960231c8ee650256028a1d7a (patch) | |
tree | 07e8139b30dc7f258837cfb41f23eed6ae8d1806 /server/sonar-server | |
parent | 7efdaa4a6e4f2ce8cbcc024e74407ccb13a413d3 (diff) | |
download | sonarqube-3c5fec7277657389960231c8ee650256028a1d7a.tar.gz sonarqube-3c5fec7277657389960231c8ee650256028a1d7a.zip |
Add missing null check on equals
Diffstat (limited to 'server/sonar-server')
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/issue/Result.java | 8 | ||||
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/issue/RulesAggregation.java | 10 |
2 files changed, 10 insertions, 8 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/Result.java b/server/sonar-server/src/main/java/org/sonar/server/issue/Result.java index 330f60e74ab..45e32f9658a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/Result.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/Result.java @@ -120,13 +120,13 @@ public class Result<T> { } @Override - public boolean equals(Object o) { + public boolean equals(@Nullable Object o) { + if (o == null || this.getClass() != o.getClass()) { + return false; + } if (this == o) { return true; } - if (this.getClass() != o.getClass()) { - return false; - } Message message = (Message) o; if (l10nKey != null ? !l10nKey.equals(message.l10nKey) : message.l10nKey != null) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/RulesAggregation.java b/server/sonar-server/src/main/java/org/sonar/server/issue/RulesAggregation.java index 8567a40d295..ec2629f6828 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/RulesAggregation.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/RulesAggregation.java @@ -25,6 +25,8 @@ import com.google.common.collect.Multiset; import org.sonar.api.rule.RuleKey; import org.sonar.core.rule.RuleDto; +import javax.annotation.Nullable; + import java.util.Collection; public class RulesAggregation { @@ -67,13 +69,13 @@ public class RulesAggregation { } @Override - public boolean equals(Object o) { + public boolean equals(@Nullable Object o) { + if (o == null || this.getClass() != o.getClass()) { + return false; + } if (this == o) { return true; } - if (this.getClass() != o.getClass()) { - return false; - } Rule rule = (Rule) o; return ruleKey.equals(rule.ruleKey); |