From 5ad5e21f77cb69707c610aef5fc62bdfd2e558c5 Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Wed, 4 Jul 2012 11:20:20 +0200 Subject: [PATCH] Fix violations --- .../sonar/plugins/core/DefaultResourceTypes.java | 12 +++++++----- .../java/org/sonar/core/resource/ResourceDto.java | 15 ++++++++++----- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DefaultResourceTypes.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DefaultResourceTypes.java index 78ff963e9e0..cbd4aa570f2 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DefaultResourceTypes.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DefaultResourceTypes.java @@ -30,18 +30,20 @@ import org.sonar.api.resources.ResourceTypeTree; @InstantiationStrategy(InstantiationStrategy.PER_BATCH) public final class DefaultResourceTypes extends ExtensionProvider implements BatchExtension, ServerExtension { + private static final String TRUE = "true"; + @Override public ResourceTypeTree provide() { return ResourceTypeTree.builder() .addType(ResourceType.builder(Qualifiers.PROJECT) - .setProperty("deletable", "true") - .setProperty("modifiable_history", "true") - .setProperty("hasRolePolicy", "true") - .setProperty("updatable_key", "true") + .setProperty("deletable", TRUE) + .setProperty("modifiable_history", TRUE) + .setProperty("hasRolePolicy", TRUE) + .setProperty("updatable_key", TRUE) .build()) .addType(ResourceType.builder(Qualifiers.MODULE) - .setProperty("updatable_key", "true") + .setProperty("updatable_key", TRUE) .build()) .addType(ResourceType.builder(Qualifiers.DIRECTORY).build()) .addType(ResourceType.builder(Qualifiers.PACKAGE).build()) diff --git a/sonar-core/src/main/java/org/sonar/core/resource/ResourceDto.java b/sonar-core/src/main/java/org/sonar/core/resource/ResourceDto.java index 193984ccbff..6eeeab179e1 100644 --- a/sonar-core/src/main/java/org/sonar/core/resource/ResourceDto.java +++ b/sonar-core/src/main/java/org/sonar/core/resource/ResourceDto.java @@ -102,18 +102,23 @@ public final class ResourceDto { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } ResourceDto other = (ResourceDto) obj; if (id == null) { - if (other.id != null) + if (other.id != null) { return false; - } else if (!id.equals(other.id)) + } + } else if (!id.equals(other.id)) { return false; + } return true; } -- 2.39.5