From 0eae375088361228504000339556fb54b5a995be Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 16 Jul 2012 10:16:39 +0200 Subject: [PATCH] Fix compatibility with java 5 --- .../org/sonar/server/plugins/UpdateCenterClient.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java b/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java index 7e99d0c044e..ee1673f9e1b 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java @@ -31,8 +31,7 @@ import org.sonar.api.utils.UriReader; import org.sonar.updatecenter.common.UpdateCenter; import org.sonar.updatecenter.common.UpdateCenterDeserializer; -import java.io.Reader; -import java.io.StringReader; +import java.io.InputStream; import java.net.URI; import java.net.URISyntaxException; import java.util.Date; @@ -97,12 +96,12 @@ public class UpdateCenterClient implements ServerComponent { } private UpdateCenter init() { - Reader reader = null; + InputStream input = null; try { String content = uriReader.readString(uri, Charsets.UTF_8); java.util.Properties properties = new java.util.Properties(); - reader = new StringReader(content); - properties.load(reader); + input = IOUtils.toInputStream(content, Charsets.UTF_8.name()); + properties.load(input); return UpdateCenterDeserializer.fromProperties(properties); @@ -111,7 +110,7 @@ public class UpdateCenterClient implements ServerComponent { return null; } finally { - IOUtils.closeQuietly(reader); + IOUtils.closeQuietly(input); } } } -- 2.39.5