diff options
9 files changed, 17 insertions, 14 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtRulesXMLImporter.java b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtRulesXMLImporter.java index 06f34ae159d..a2a379d9ac5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtRulesXMLImporter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtRulesXMLImporter.java @@ -103,7 +103,7 @@ public class DebtRulesXMLImporter { return new SMInputFactory(xmlFactory); } - private void process(List<RuleDebt> ruleDebts, + private static void process(List<RuleDebt> ruleDebts, ValidationMessages validationMessages, SMInputCursor chcCursor) throws XMLStreamException { SMInputCursor cursor = chcCursor.childElementCursor(); while (cursor.getNext() != null) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionFinder.java b/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionFinder.java index 00189234ee1..554e24a0d7d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionFinder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionFinder.java @@ -82,7 +82,7 @@ public class PermissionFinder { } } - private List<GroupWithPermissionDto> toGroupQueryResult(List<GroupWithPermissionDto> dtos, PermissionQuery query) { + private static List<GroupWithPermissionDto> toGroupQueryResult(List<GroupWithPermissionDto> dtos, PermissionQuery query) { addAnyoneGroup(dtos, query); List<GroupWithPermissionDto> filteredDtos = filterMembership(dtos, query); diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ClassLoaderUtils.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ClassLoaderUtils.java index 4568d967d25..4a067f9d248 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/ClassLoaderUtils.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/ClassLoaderUtils.java @@ -105,7 +105,7 @@ class ClassLoaderUtils { rootDirectory = StringUtils.substringBeforeLast(rootPath, "/"); } //strip out only the JAR file - jarPath = root.getPath().substring(5, root.getPath().indexOf("!")); + jarPath = root.getPath().substring(5, root.getPath().indexOf('!')); jar = new JarFile(URLDecoder.decode(jarPath, CharEncoding.UTF_8)); Enumeration<JarEntry> entries = jar.entries(); while (entries.hasMoreElements()) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/DeprecatedRulesDefinitionLoader.java b/server/sonar-server/src/main/java/org/sonar/server/rule/DeprecatedRulesDefinitionLoader.java index e1f4369bd96..6def1c1b28a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/DeprecatedRulesDefinitionLoader.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/DeprecatedRulesDefinitionLoader.java @@ -110,7 +110,7 @@ public class DeprecatedRulesDefinitionLoader { } } - private void updateRuleDebtDefinitions(RulesDefinition.NewRule newRule, String repoKey, String ruleKey, List<RuleDebt> ruleDebts) { + private static void updateRuleDebtDefinitions(RulesDefinition.NewRule newRule, String repoKey, String ruleKey, List<RuleDebt> ruleDebts) { RuleDebt ruleDebt = findRequirement(ruleDebts, repoKey, ruleKey); if (ruleDebt != null) { newRule.setDebtRemediationFunction(remediationFunction(DebtRemediationFunction.Type.valueOf(ruleDebt.function()), diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java b/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java index 5c70eab6521..7aaadb5d603 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java @@ -356,25 +356,25 @@ public class RuleIndex extends BaseIndex { Collection<String> languages = query.getLanguages(); aggregations.put(FACET_LANGUAGES, stickyFacetBuilder.buildStickyFacet(FIELD_RULE_LANGUAGE, FACET_LANGUAGES, - (languages == null) ? new String[0] : languages.toArray())); + (languages == null) ? (new String[0]) : languages.toArray())); } if (options.getFacets().contains(FACET_TAGS) || options.getFacets().contains(FACET_OLD_DEFAULT)) { Collection<String> tags = query.getTags(); aggregations.put(FACET_TAGS, stickyFacetBuilder.buildStickyFacet(FIELD_RULE_ALL_TAGS, FACET_TAGS, - (tags == null) ? new String[0] : tags.toArray())); + (tags == null) ? (new String[0]) : tags.toArray())); } if (options.getFacets().contains(FACET_TYPES)) { Collection<RuleType> types = query.getTypes(); aggregations.put(FACET_TYPES, stickyFacetBuilder.buildStickyFacet(FIELD_RULE_TYPE, FACET_TYPES, - (types == null) ? new String[0] : types.toArray())); + (types == null) ? (new String[0]) : types.toArray())); } if (options.getFacets().contains("repositories") || options.getFacets().contains(FACET_OLD_DEFAULT)) { Collection<String> repositories = query.getRepositories(); aggregations.put(FACET_REPOSITORIES, stickyFacetBuilder.buildStickyFacet(FIELD_RULE_REPOSITORY, FACET_REPOSITORIES, - (repositories == null) ? new String[0] : repositories.toArray())); + (repositories == null) ? (new String[0]) : repositories.toArray())); } } diff --git a/sonar-db/src/main/java/org/sonar/db/version/v51/AddNewCharacteristics.java b/sonar-db/src/main/java/org/sonar/db/version/v51/AddNewCharacteristics.java index 934bcf146c4..8efe892f79d 100644 --- a/sonar-db/src/main/java/org/sonar/db/version/v51/AddNewCharacteristics.java +++ b/sonar-db/src/main/java/org/sonar/db/version/v51/AddNewCharacteristics.java @@ -117,7 +117,7 @@ public class AddNewCharacteristics extends BaseDataChange { return usabilityOder; } - private void createOrUpdateUsabilityCharacteristicAndItsSubCharacteristic(CharacteristicsContext characteristicsContext, int newUsabilityOrder) + private static void createOrUpdateUsabilityCharacteristicAndItsSubCharacteristic(CharacteristicsContext characteristicsContext, int newUsabilityOrder) throws SQLException { String usabilityKey = USABILITY_KEY; Characteristic usability = characteristicsContext.findCharacteristicByKey(usabilityKey); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java index 699024f3852..729c0c01ba6 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java @@ -2283,7 +2283,8 @@ public final class CoreMetrics { /** * @since 5.5 */ - public static final Metric<Long> RELIABILITY_REMEDIATION_EFFORT = new Metric.Builder(RELIABILITY_REMEDIATION_EFFORT_KEY, "Reliability remediation effort", Metric.ValueType.WORK_DUR) + public static final Metric<Long> RELIABILITY_REMEDIATION_EFFORT = new Metric.Builder(RELIABILITY_REMEDIATION_EFFORT_KEY, "Reliability remediation effort", + Metric.ValueType.WORK_DUR) .setDomain(DOMAIN_RELIABILITY) .setDirection(Metric.DIRECTION_WORST) .setOptimizedBestValue(true) @@ -2299,7 +2300,8 @@ public final class CoreMetrics { /** * @since 5.5 */ - public static final Metric<Long> NEW_RELIABILITY_REMEDIATION_EFFORT = new Metric.Builder(NEW_RELIABILITY_REMEDIATION_EFFORT_KEY, "Reliability remediation effort on new code", Metric.ValueType.WORK_DUR) + public static final Metric<Long> NEW_RELIABILITY_REMEDIATION_EFFORT = new Metric.Builder(NEW_RELIABILITY_REMEDIATION_EFFORT_KEY, "Reliability remediation effort on new code", + Metric.ValueType.WORK_DUR) .setDescription("Reliability remediation effort of new code") .setDomain(DOMAIN_RELIABILITY) .setDirection(Metric.DIRECTION_WORST) @@ -2339,7 +2341,8 @@ public final class CoreMetrics { /** * @since 5.5 */ - public static final Metric<Long> NEW_SECURITY_REMEDIATION_EFFORT = new Metric.Builder(NEW_SECURITY_REMEDIATION_EFFORT_KEY, "Security remediation effort on new code", Metric.ValueType.WORK_DUR) + public static final Metric<Long> NEW_SECURITY_REMEDIATION_EFFORT = new Metric.Builder(NEW_SECURITY_REMEDIATION_EFFORT_KEY, "Security remediation effort on new code", + Metric.ValueType.WORK_DUR) .setDescription("Security remediation effort of new code") .setDomain(DOMAIN_SECURITY) .setDirection(Metric.DIRECTION_WORST) diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rule/RuleKey.java b/sonar-plugin-api/src/main/java/org/sonar/api/rule/RuleKey.java index 56517648f19..668fd8fcef0 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rule/RuleKey.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rule/RuleKey.java @@ -56,7 +56,7 @@ public class RuleKey implements Serializable, Comparable<RuleKey> { * if the format is not valid. */ public static RuleKey parse(String s) { - int semiColonPos = s.indexOf(":"); + int semiColonPos = s.indexOf(':'); Preconditions.checkArgument(semiColonPos > 0, "Invalid rule key: " + s); String key = s.substring(0, semiColonPos); String repo = s.substring(semiColonPos + 1); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/Display.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/Display.java index 6931e723169..59f95065648 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/Display.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/Display.java @@ -100,7 +100,7 @@ public final class Display { private void validateBackgroundColor() { checkArgument(isNotBlank(backgroundColor), "Background color must not be blank"); - checkArgument(backgroundColor.length() == 7 && backgroundColor.startsWith("#"), + checkArgument(backgroundColor.length() == 7 && backgroundColor.indexOf('#') == 0, "Background color must begin with a sharp followed by 6 characters"); } } |