aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ServerClient.java
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-10-09 17:04:20 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2014-10-14 11:59:06 +0200
commit19f80967d511bfff7399290ccbb6c98304e6e2b2 (patch)
tree0169665598eae9be207c87ec5d7f2b0273b68e11 /sonar-batch/src/main/java/org/sonar/batch/bootstrap/ServerClient.java
parentbcd54407f2a6ca42c80961303fe1567e7b33621a (diff)
downloadsonarqube-19f80967d511bfff7399290ccbb6c98304e6e2b2.tar.gz
sonarqube-19f80967d511bfff7399290ccbb6c98304e6e2b2.zip
SONAR-5715 Fix preview mode when source file contains space in its path
Diffstat (limited to 'sonar-batch/src/main/java/org/sonar/batch/bootstrap/ServerClient.java')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/ServerClient.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ServerClient.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ServerClient.java
index d43ef8e0e71..0fcc09bcf3d 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ServerClient.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ServerClient.java
@@ -36,7 +36,9 @@ import javax.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
import java.net.URI;
+import java.net.URLEncoder;
/**
* Replace the deprecated org.sonar.batch.ServerMetadata
@@ -135,4 +137,13 @@ public class ServerClient implements BatchComponent {
private String getPassword() {
return props.property(CoreProperties.PASSWORD);
}
+
+ public static String encodeForUrl(String url) {
+ try {
+ return URLEncoder.encode(url, "UTF-8");
+
+ } catch (UnsupportedEncodingException e) {
+ throw new IllegalStateException("Encoding not supported", e);
+ }
+ }
}