From 1acae829018ed8a78292e2cc3bb9c7c17c581c50 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Mon, 16 Jul 2012 11:31:48 +0200 Subject: [PATCH] Restore Api compatibility --- .../org/sonar/batch/bootstrap/ArtifactDownloader.java | 4 +--- .../src/main/java/org/sonar/api/utils/HttpDownloader.java | 8 ++++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ArtifactDownloader.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ArtifactDownloader.java index a35feabb679..158dac6bbca 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ArtifactDownloader.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ArtifactDownloader.java @@ -19,8 +19,6 @@ */ package org.sonar.batch.bootstrap; -import com.google.common.base.Charsets; - import com.google.common.collect.Lists; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.CharUtils; @@ -91,7 +89,7 @@ public class ArtifactDownloader implements BatchComponent { String url = baseUrl + "/deploy/plugins/index.txt"; try { LOG.debug("Downloading index of plugins"); - String indexContent = httpDownloader.downloadPlainText(new URI(url), Charsets.UTF_8); + String indexContent = httpDownloader.downloadPlainText(new URI(url), "UTF-8"); String[] rows = StringUtils.split(indexContent, CharUtils.LF); List remoteLocations = Lists.newArrayList(); for (String row : rows) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java index 6a2e6332ae5..f555cc72291 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java @@ -152,8 +152,12 @@ public class HttpDownloader extends UriReader.SchemeProcessor implements BatchCo } } - public String downloadPlainText(URI uri, Charset charset) { - return readString(uri, charset); + public byte[] download(URI uri) { + return readBytes(uri); + } + + public String downloadPlainText(URI uri, String encoding) { + return readString(uri, Charset.forName(encoding)); } public void download(URI uri, File toFile) { -- 2.39.5