diff options
author | David Gageot <david@gageot.net> | 2012-07-16 10:55:06 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-07-16 10:55:23 +0200 |
commit | 20fdc6307577de2cce22d6c24ba64c9d382400ff (patch) | |
tree | 4df9ed8ba5d6525e48018767fb3db4b30c215a2c /sonar-plugin-api | |
parent | 8174c0b7e067391c3284d75eff2a396c56415f6f (diff) | |
download | sonarqube-20fdc6307577de2cce22d6c24ba64c9d382400ff.tar.gz sonarqube-20fdc6307577de2cce22d6c24ba64c9d382400ff.zip |
Don't use hardcoded charsets
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java | 6 |
1 files changed, 3 insertions, 3 deletions
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 94e7c80e26f..d46558fabe9 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 @@ -155,12 +155,12 @@ public class HttpDownloader extends UriReader.SchemeProcessor implements BatchCo } } - public String downloadPlainText(URI uri, String encoding) { + public String downloadPlainText(URI uri, Charset charset) { InputStream input = null; try { HttpURLConnection connection = newHttpConnection(uri); input = connection.getInputStream(); - return IOUtils.toString(input, encoding); + return IOUtils.toString(input, charset.name()); } catch (Exception e) { throw new SonarException("Fail to download the file: " + uri + " (" + getProxySynthesis(uri) + ")", e); @@ -182,7 +182,7 @@ public class HttpDownloader extends UriReader.SchemeProcessor implements BatchCo @Override String readString(URI uri, Charset charset) { - return downloadPlainText(uri, charset.name()); + return downloadPlainText(uri, charset); } private HttpURLConnection newHttpConnection(URI uri) throws IOException { |