aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/www/VKontakteLogin.java
diff options
context:
space:
mode:
authorGravatar Alexander Alexeev2016-11-10 04:50:07 +0700
committerGravatar Vitaly Takmazov2016-11-10 21:41:14 +0300
commit09221ab5695e99b2df1130ea923c39625ec85429 (patch)
tree58c775188d25239a1e32a83f8007e5f1679d49ee /juick-www/src/main/java/com/juick/www/VKontakteLogin.java
parent705d4f87c97dfa20eb6daa88b93ff124fa401b92 (diff)
using slf4j + logback for logging
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/VKontakteLogin.java')
-rw-r--r--juick-www/src/main/java/com/juick/www/VKontakteLogin.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/juick-www/src/main/java/com/juick/www/VKontakteLogin.java b/juick-www/src/main/java/com/juick/www/VKontakteLogin.java
index 7d718c9b..f0010ac8 100644
--- a/juick-www/src/main/java/com/juick/www/VKontakteLogin.java
+++ b/juick-www/src/main/java/com/juick/www/VKontakteLogin.java
@@ -20,6 +20,8 @@ package com.juick.www;
import com.juick.server.UserQueries;
import org.json.JSONException;
import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -30,15 +32,13 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.UUID;
-import java.util.logging.Level;
-import java.util.logging.Logger;
/**
*
* @author Ugnich Anton
*/
public class VKontakteLogin {
- private static final Logger logger = Logger.getLogger(VKontakteLogin.class.getName());
+ private static final Logger logger = LoggerFactory.getLogger(VKontakteLogin.class);
private static final String VK_APPID = "3544101";
private static final String VK_SECRET = "z2afNI8jA5lIpZ2jsTm1";
private static final String VK_REDIRECT = "http://juick.com/_vklogin";
@@ -54,7 +54,7 @@ public class VKontakteLogin {
String tokenjson = Utils.fetchURL("https://oauth.vk.com/access_token?client_id=" + VK_APPID + "&redirect_uri=" + URLEncoder.encode(VK_REDIRECT, "utf-8") + "&client_secret=" + VK_SECRET + "&code=" + URLEncoder.encode(code, "utf-8"));
if (tokenjson == null || tokenjson.isEmpty()) {
- logger.log(Level.SEVERE, "VK TOKEN EMPTY");
+ logger.error("VK TOKEN EMPTY");
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}
@@ -65,12 +65,12 @@ public class VKontakteLogin {
token = json.getString("access_token");
vkID = json.getLong("user_id");
} catch (JSONException e) {
- logger.log(Level.SEVERE, "VK TOKEN EXCEPTION: ", e);
+ logger.error("VK TOKEN EXCEPTION: ", e);
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}
if (token == null || vkID == 0) {
- logger.log(Level.SEVERE, "VK TOKEN EMPTY: " + tokenjson);
+ logger.error("VK TOKEN EMPTY: " + tokenjson);
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}
@@ -79,7 +79,7 @@ public class VKontakteLogin {
String graph = Utils.fetchURL("https://api.vk.com/method/users.get?uids=" + vkID + "&fields=screen_name&access_token=" + token);
if (graph == null || graph.isEmpty()) {
- logger.log(Level.SEVERE, "VK GRAPH ERROR");
+ logger.error("VK GRAPH ERROR");
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}
@@ -109,7 +109,7 @@ public class VKontakteLogin {
response.setHeader("Location", "/signup?type=vk&hash=" + loginhash);
}
} catch (Exception e) {
- logger.log(Level.SEVERE, "JSON ERROR", e);
+ logger.error("JSON ERROR", e);
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
}