diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-03-13 22:37:55 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-03-13 22:43:16 +0100 |
commit | 7c8e31c4a69e96199305c6bf1e43fa2cd5a552be (patch) | |
tree | 134122d77b6c3afe7ed1f1787f333902e3b55b49 /server/sonar-process-monitor | |
parent | 36286b60566501d35e7143d150d2ae8c150a98bd (diff) | |
download | sonarqube-7c8e31c4a69e96199305c6bf1e43fa2cd5a552be.tar.gz sonarqube-7c8e31c4a69e96199305c6bf1e43fa2cd5a552be.zip |
Fix Quality flaws
Diffstat (limited to 'server/sonar-process-monitor')
2 files changed, 32 insertions, 10 deletions
diff --git a/server/sonar-process-monitor/src/main/java/org/sonar/application/cluster/ClusterProcess.java b/server/sonar-process-monitor/src/main/java/org/sonar/application/cluster/ClusterProcess.java index dbd823b971f..b9b33402444 100644 --- a/server/sonar-process-monitor/src/main/java/org/sonar/application/cluster/ClusterProcess.java +++ b/server/sonar-process-monitor/src/main/java/org/sonar/application/cluster/ClusterProcess.java @@ -21,16 +21,17 @@ package org.sonar.application.cluster; import java.io.Serializable; -import javax.annotation.Nonnull; import org.sonar.process.ProcessId; +import static java.util.Objects.requireNonNull; + public class ClusterProcess implements Serializable { private final ProcessId processId; private final String nodeUuid; - public ClusterProcess(@Nonnull String nodeUuid, @Nonnull ProcessId processId) { - this.processId = processId; - this.nodeUuid = nodeUuid; + public ClusterProcess(String nodeUuid, ProcessId processId) { + this.processId = requireNonNull(processId); + this.nodeUuid = requireNonNull(nodeUuid); } public ProcessId getProcessId() { @@ -46,22 +47,20 @@ public class ClusterProcess implements Serializable { if (this == o) { return true; } - if (!(o instanceof ClusterProcess)) { + if (o == null || getClass() != o.getClass()) { return false; } - ClusterProcess that = (ClusterProcess) o; - if (processId != that.processId) { return false; } - return nodeUuid != null ? nodeUuid.equals(that.nodeUuid) : that.nodeUuid == null; + return nodeUuid.equals(that.nodeUuid); } @Override public int hashCode() { - int result = processId != null ? processId.hashCode() : 0; - result = 31 * result + (nodeUuid != null ? nodeUuid.hashCode() : 0); + int result = processId.hashCode(); + result = 31 * result + nodeUuid.hashCode(); return result; } } diff --git a/server/sonar-process-monitor/src/main/java/org/sonar/application/config/package-info.java b/server/sonar-process-monitor/src/main/java/org/sonar/application/config/package-info.java new file mode 100644 index 00000000000..192ba670e01 --- /dev/null +++ b/server/sonar-process-monitor/src/main/java/org/sonar/application/config/package-info.java @@ -0,0 +1,23 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +@ParametersAreNonnullByDefault +package org.sonar.application.config; + +import javax.annotation.ParametersAreNonnullByDefault; |