aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/ru
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-07-11 12:25:03 +0300
committerGravatar Vitaly Takmazov2016-07-11 12:25:03 +0300
commitd6fb4288688294d2f76325f14410db3091fea0fa (patch)
treed2070a67794644c2602eaf5bcc41e10438c62f89 /juick-www/src/main/java/ru
parent3d0ec22f5262058a08e7f551eb5ac02e3636008a (diff)
logging
Diffstat (limited to 'juick-www/src/main/java/ru')
-rw-r--r--juick-www/src/main/java/ru/sape/SapeConnection.java17
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;