diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2014-10-09 17:04:20 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2014-10-14 11:59:06 +0200 |
commit | 19f80967d511bfff7399290ccbb6c98304e6e2b2 (patch) | |
tree | 0169665598eae9be207c87ec5d7f2b0273b68e11 /sonar-batch/src/main/java/org/sonar/batch/bootstrap/ServerClient.java | |
parent | bcd54407f2a6ca42c80961303fe1567e7b33621a (diff) | |
download | sonarqube-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.java | 11 |
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); + } + } } |