diff options
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org/sonar')
11 files changed, 26 insertions, 25 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoader.java index ed0d6551fea..6ac10d73760 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoader.java @@ -30,7 +30,7 @@ import org.apache.commons.io.IOUtils; import org.sonar.api.utils.log.Loggers; import org.sonar.api.utils.log.Profiler; import org.sonar.scanner.bootstrap.ScannerWsClient; -import org.sonar.scanner.util.BatchUtils; +import org.sonar.scanner.util.ScannerUtils; public class DefaultServerLineHashesLoader implements ServerLineHashesLoader { private ScannerWsClient wsClient; @@ -50,7 +50,7 @@ public class DefaultServerLineHashesLoader implements ServerLineHashesLoader { .addContext("file", fileKey) .startDebug("Load line hashes"); - GetRequest getRequest = new GetRequest("/api/sources/hash?key=" + BatchUtils.encodeForUrl(fileKey)); + GetRequest getRequest = new GetRequest("/api/sources/hash?key=" + ScannerUtils.encodeForUrl(fileKey)); Reader reader = wsClient.call(getRequest).contentReader(); try { return IOUtils.toString(reader); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PhasesTimeProfiler.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PhasesTimeProfiler.java index a9783251372..db924b9f474 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PhasesTimeProfiler.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PhasesTimeProfiler.java @@ -26,7 +26,7 @@ import org.sonar.api.batch.events.SensorsPhaseHandler; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; import org.sonar.api.utils.log.Profiler; -import org.sonar.scanner.util.BatchUtils; +import org.sonar.scanner.util.ScannerUtils; public class PhasesTimeProfiler implements SensorExecutionHandler, SensorsPhaseHandler { @@ -44,7 +44,7 @@ public class PhasesTimeProfiler implements SensorExecutionHandler, SensorsPhaseH @Override public void onSensorExecution(SensorExecutionEvent event) { if (event.isStart()) { - profiler.startInfo("Sensor " + BatchUtils.describe(event.getSensor())); + profiler.startInfo("Sensor " + ScannerUtils.describe(event.getSensor())); } else { profiler.stopInfo(); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PostJobsExecutor.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PostJobsExecutor.java index ce5863ecc1b..23fe945516f 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PostJobsExecutor.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PostJobsExecutor.java @@ -30,7 +30,7 @@ import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; import org.sonar.scanner.bootstrap.ScannerExtensionDictionnary; import org.sonar.scanner.events.EventBus; -import org.sonar.scanner.util.BatchUtils; +import org.sonar.scanner.util.ScannerUtils; @ScannerSide public class PostJobsExecutor { @@ -58,7 +58,7 @@ public class PostJobsExecutor { logPostJobs(postJobs); for (PostJob postJob : postJobs) { - LOG.info("Executing post-job {}", BatchUtils.describe(postJob)); + LOG.info("Executing post-job {}", ScannerUtils.describe(postJob)); eventBus.fireEvent(new PostJobExecutionEvent(postJob, true)); postJob.executeOn(project, context); eventBus.fireEvent(new PostJobExecutionEvent(postJob, false)); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/profiling/PhasesSumUpTimeProfiler.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/profiling/PhasesSumUpTimeProfiler.java index 5ecfbbbfd37..8906535df07 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/profiling/PhasesSumUpTimeProfiler.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/profiling/PhasesSumUpTimeProfiler.java @@ -48,7 +48,7 @@ import org.sonar.api.utils.System2; import org.sonar.api.utils.TimeUtils; import org.sonar.scanner.bootstrap.GlobalProperties; import org.sonar.scanner.events.BatchStepHandler; -import org.sonar.scanner.util.BatchUtils; +import org.sonar.scanner.util.ScannerUtils; import static org.sonar.scanner.profiling.AbstractTimeProfiling.sortByDescendingTotalTime; import static org.sonar.scanner.profiling.AbstractTimeProfiling.truncate; @@ -113,7 +113,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx println(" -------- End of profiling of module " + module.getName() + " --------"); println(""); String fileName = module.getKey() + "-profiler.properties"; - dumpToFile(props, BatchUtils.cleanKeyForFilename(fileName)); + dumpToFile(props, ScannerUtils.cleanKeyForFilename(fileName)); totalProfiling.merge(currentModuleProfiling); if (module.isRoot() && !module.getModules().isEmpty()) { dumpTotalExecutionSummary(); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java index 2ccfb6c8a7f..578f3b61baf 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java @@ -32,7 +32,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.utils.MessageException; import org.sonar.scanner.bootstrap.ScannerWsClient; -import org.sonar.scanner.util.BatchUtils; +import org.sonar.scanner.util.ScannerUtils; import org.sonarqube.ws.WsBatch; import org.sonarqube.ws.WsBatch.WsProjectResponse; import org.sonarqube.ws.WsBatch.WsProjectResponse.FileDataByPath; @@ -70,7 +70,7 @@ public class DefaultProjectRepositoriesLoader implements ProjectRepositoriesLoad StringBuilder builder = new StringBuilder(); builder.append(BATCH_PROJECT_URL) - .append("?key=").append(BatchUtils.encodeForUrl(projectKey)); + .append("?key=").append(ScannerUtils.encodeForUrl(projectKey)); if (issuesMode) { builder.append("&issues_mode=true"); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java index 148f7ee0c82..d56cd5c4961 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java @@ -21,7 +21,7 @@ package org.sonar.scanner.repository; import org.sonar.api.utils.MessageException; import org.sonar.scanner.bootstrap.ScannerWsClient; -import org.sonar.scanner.util.BatchUtils; +import org.sonar.scanner.util.ScannerUtils; import org.sonarqube.ws.QualityProfiles.SearchWsResponse; import org.apache.commons.io.IOUtils; import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile; @@ -45,16 +45,16 @@ public class DefaultQualityProfileLoader implements QualityProfileLoader { public List<QualityProfile> loadDefault(@Nullable String profileName) { String url = WS_URL + "?defaults=true"; if (profileName != null) { - url += "&profileName=" + BatchUtils.encodeForUrl(profileName); + url += "&profileName=" + ScannerUtils.encodeForUrl(profileName); } return loadResource(url); } @Override public List<QualityProfile> load(String projectKey, @Nullable String profileName) { - String url = WS_URL + "?projectKey=" + BatchUtils.encodeForUrl(projectKey); + String url = WS_URL + "?projectKey=" + ScannerUtils.encodeForUrl(projectKey); if (profileName != null) { - url += "&profileName=" + BatchUtils.encodeForUrl(profileName); + url += "&profileName=" + ScannerUtils.encodeForUrl(profileName); } return loadResource(url); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultServerIssuesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultServerIssuesLoader.java index 02e8ff57a47..6c796eae544 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultServerIssuesLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultServerIssuesLoader.java @@ -25,7 +25,7 @@ import java.io.InputStream; import org.apache.commons.io.IOUtils; import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.protocol.input.ScannerInput.ServerIssue; -import org.sonar.scanner.util.BatchUtils; +import org.sonar.scanner.util.ScannerUtils; import org.sonarqube.ws.client.GetRequest; public class DefaultServerIssuesLoader implements ServerIssuesLoader { @@ -38,7 +38,7 @@ public class DefaultServerIssuesLoader implements ServerIssuesLoader { @Override public void load(String componentKey, Function<ServerIssue, Void> consumer) { - GetRequest getRequest = new GetRequest("/batch/issues.protobuf?key=" + BatchUtils.encodeForUrl(componentKey)); + GetRequest getRequest = new GetRequest("/batch/issues.protobuf?key=" + ScannerUtils.encodeForUrl(componentKey)); InputStream is = wsClient.call(getRequest).contentStream(); parseIssues(is, consumer); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/user/UserRepositoryLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/user/UserRepositoryLoader.java index 42d6fca9840..54dabf622ff 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/user/UserRepositoryLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/user/UserRepositoryLoader.java @@ -24,7 +24,7 @@ import com.google.common.collect.Lists; import com.google.common.base.Joiner; import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.protocol.input.ScannerInput; -import org.sonar.scanner.util.BatchUtils; +import org.sonar.scanner.util.ScannerUtils; import org.sonarqube.ws.client.GetRequest; import com.google.common.base.Function; import java.io.IOException; @@ -63,7 +63,7 @@ public class UserRepositoryLoader { private static class UserEncodingFunction implements Function<String, String> { @Override public String apply(String input) { - return BatchUtils.encodeForUrl(input); + return ScannerUtils.encodeForUrl(input); } } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java index 4a6db254ed9..2f8b518cb04 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java @@ -28,7 +28,7 @@ import java.util.Map; import org.apache.commons.io.IOUtils; import org.sonar.api.rule.RuleKey; import org.sonar.scanner.bootstrap.ScannerWsClient; -import org.sonar.scanner.util.BatchUtils; +import org.sonar.scanner.util.ScannerUtils; import org.sonarqube.ws.Rules; import org.sonarqube.ws.Rules.Active; import org.sonarqube.ws.Rules.Active.Param; @@ -72,7 +72,7 @@ public class DefaultActiveRulesLoader implements ActiveRulesLoader { private static String getUrl(String qualityProfileKey, int page, int pageSize) { StringBuilder builder = new StringBuilder(1024); builder.append(RULES_SEARCH_URL); - builder.append("&qprofile=").append(BatchUtils.encodeForUrl(qualityProfileKey)); + builder.append("&qprofile=").append(ScannerUtils.encodeForUrl(qualityProfileKey)); builder.append("&p=").append(page); builder.append("&ps=").append(pageSize); return builder.toString(); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorBuilder.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorBuilder.java index f3da9c37976..f87dfddd78e 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorBuilder.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorBuilder.java @@ -46,7 +46,7 @@ import org.sonar.api.utils.log.Loggers; import org.sonar.api.utils.log.Profiler; import org.sonar.scanner.analysis.AnalysisProperties; import org.sonar.scanner.bootstrap.DroppedPropertyChecker; -import org.sonar.scanner.util.BatchUtils; +import org.sonar.scanner.util.ScannerUtils; /** * Class that creates a project definition based on a set of properties. @@ -206,7 +206,7 @@ public class ProjectReactorBuilder { protected File initModuleWorkDir(File moduleBaseDir, Map<String, String> moduleProperties) { String workDir = moduleProperties.get(CoreProperties.WORKING_DIRECTORY); if (StringUtils.isBlank(workDir)) { - return new File(rootProjectWorkDir, BatchUtils.cleanKeyForFilename(moduleProperties.get(CoreProperties.PROJECT_KEY_PROPERTY))); + return new File(rootProjectWorkDir, ScannerUtils.cleanKeyForFilename(moduleProperties.get(CoreProperties.PROJECT_KEY_PROPERTY))); } File customWorkDir = new File(workDir); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/util/BatchUtils.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/util/ScannerUtils.java index 40813b9a028..12f959c0c91 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/util/BatchUtils.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/util/ScannerUtils.java @@ -25,9 +25,9 @@ import java.net.URLEncoder; import javax.annotation.Nullable; import org.apache.commons.lang.StringUtils; -public class BatchUtils { - private BatchUtils() { - // prevent instantiation +public class ScannerUtils { + + private ScannerUtils() { } /** @@ -62,4 +62,5 @@ public class BatchUtils { return o.getClass().getName(); } + } |