diff options
Diffstat (limited to 'juick-www/src/main/java/ru')
-rw-r--r-- | juick-www/src/main/java/ru/sape/SapeConnection.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/juick-www/src/main/java/ru/sape/SapeConnection.java b/juick-www/src/main/java/ru/sape/SapeConnection.java index 8c794b08..dcaf629f 100644 --- a/juick-www/src/main/java/ru/sape/SapeConnection.java +++ b/juick-www/src/main/java/ru/sape/SapeConnection.java @@ -7,13 +7,12 @@ import java.io.Reader; import java.io.StringWriter; import java.net.HttpURLConnection; import java.net.URL; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.logging.Level; +import java.util.logging.Logger; public class SapeConnection { - + private static final Logger logger = Logger.getLogger(SapeConnection.class.getName()); private final String version = "1.0.3"; private final List<String> serverList = Arrays.asList("dispenser-01.sape.ru", "dispenser-02.sape.ru"); private final String dispenserPath; @@ -80,7 +79,7 @@ public class SapeConnection { } if (data.startsWith("FATAL ERROR:")) { - System.err.println("Sape responded with error: " + data); + logger.log(Level.SEVERE, "Sape responded with error: " + data); continue; } @@ -88,7 +87,7 @@ public class SapeConnection { try { cached = (Map<String, Object>) new SerializedPhpParser(data).parse(); } catch (Exception e) { - System.err.println("Can't parse Sape data: " + e); + logger.log(Level.SEVERE, "Can't parse Sape data", e); continue; } @@ -97,9 +96,9 @@ public class SapeConnection { return cached; } - System.err.println("Unable to fetch Sape data"); + logger.log(Level.SEVERE, "Unable to fetch Sape data"); - return new HashMap<String, Object>(); + return Collections.emptyMap(); } return cached; |