From f6e1a6ff327d550debe9361630b41b19ed99aa9b Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 5 Feb 2014 12:28:39 +0100 Subject: [PATCH] SONAR-926 deterministic error message (order of parameters) --- .../batch/index/ResourceKeyMigration.java | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java b/sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java index 0fe99a889ad..bb3e2a60d3a 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java @@ -19,30 +19,23 @@ */ package org.sonar.batch.index; -import org.sonar.api.scan.filesystem.InputFile; - import com.google.common.annotations.VisibleForTesting; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.sonar.api.BatchComponent; import org.sonar.api.database.DatabaseSession; import org.sonar.api.database.model.ResourceModel; -import org.sonar.api.resources.Directory; -import org.sonar.api.resources.File; -import org.sonar.api.resources.Java; -import org.sonar.api.resources.JavaFile; -import org.sonar.api.resources.Project; -import org.sonar.api.resources.Qualifiers; -import org.sonar.api.resources.Resource; -import org.sonar.api.resources.Scopes; +import org.sonar.api.resources.*; +import org.sonar.api.scan.filesystem.InputFile; import org.sonar.api.scan.filesystem.internal.DefaultInputFile; import org.sonar.api.utils.PathUtils; -import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.TreeMap; -public class ResourceKeyMigration { +public class ResourceKeyMigration implements BatchComponent { private final Logger logger; private final DatabaseSession session; @@ -70,9 +63,9 @@ public class ResourceKeyMigration { public void migrateIfNeeded(Project module, Iterable inputFiles) { if (migrationNeeded) { logger.info("Starting migration of resource keys"); - Map deprecatedFileKeyMapper = new HashMap(); - Map deprecatedTestKeyMapper = new HashMap(); - Map deprecatedDirectoryKeyMapper = new HashMap(); + Map deprecatedFileKeyMapper = new TreeMap(); + Map deprecatedTestKeyMapper = new TreeMap(); + Map deprecatedDirectoryKeyMapper = new TreeMap(); for (InputFile inputFile : inputFiles) { String deprecatedKey = inputFile.attribute(DefaultInputFile.ATTRIBUTE_COMPONENT_DEPRECATED_KEY); if (deprecatedKey != null) { -- 2.39.5