aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-05-22 11:03:48 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2015-05-22 11:04:21 +0200
commit850d73923682ad77069c8c4251ca3674ff90c86e (patch)
treefbf9f8952a2d0ae8f57a1f7bf846b27bfa2e2787
parent79f034b7b10b801f82060a28c39f4595c185575e (diff)
downloadsonarqube-850d73923682ad77069c8c4251ca3674ff90c86e.tar.gz
sonarqube-850d73923682ad77069c8c4251ca3674ff90c86e.zip
Add project name in URL when publishing report
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java b/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java
index ab2c9c9da2f..64dc492ef5e 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java
@@ -21,12 +21,17 @@ package org.sonar.batch.report;
import com.github.kevinsawicki.http.HttpRequest;
import com.google.common.annotations.VisibleForTesting;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
import org.apache.commons.io.FileUtils;
import org.picocontainer.Startable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.batch.BatchSide;
import org.sonar.api.CoreProperties;
+import org.sonar.api.batch.BatchSide;
+import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.batch.bootstrap.ProjectReactor;
import org.sonar.api.config.Settings;
import org.sonar.api.platform.Server;
@@ -36,11 +41,6 @@ import org.sonar.batch.bootstrap.DefaultAnalysisMode;
import org.sonar.batch.bootstrap.ServerClient;
import org.sonar.batch.protocol.output.BatchReportWriter;
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-
@BatchSide
public class ReportPublisher implements Startable {
@@ -130,8 +130,9 @@ public class ReportPublisher implements Startable {
long startTime = System.currentTimeMillis();
URL url;
try {
- String effectiveKey = projectReactor.getRoot().getKeyWithBranch();
- url = new URL(serverClient.getURL() + "/api/computation/submit_report?projectKey=" + effectiveKey);
+ ProjectDefinition projectDefinition = projectReactor.getRoot();
+ String effectiveKey = projectDefinition.getKeyWithBranch();
+ url = new URL(serverClient.getURL() + "/api/computation/submit_report?projectKey=" + effectiveKey + "&projectName=" + ServerClient.encodeForUrl(projectDefinition.getName()));
} catch (MalformedURLException e) {
throw new IllegalArgumentException("Invalid URL", e);
}