aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/http/www/RSS.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-07-07 11:25:23 +0300
committerGravatar Vitaly Takmazov2016-07-07 11:25:23 +0300
commita93c85c5ea1bf6683f604bef2608053957577ff0 (patch)
treef80998a4cf339a2b85cd5f095f4386de9d46597b /src/main/java/com/juick/http/www/RSS.java
parent3e48ba7c9cae9027b0a045aa25ae40b533518865 (diff)
parent857a930d31c425185c9b9405f5a7820e6cec9491 (diff)
merge rebase_all
Diffstat (limited to 'src/main/java/com/juick/http/www/RSS.java')
-rw-r--r--src/main/java/com/juick/http/www/RSS.java24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/main/java/com/juick/http/www/RSS.java b/src/main/java/com/juick/http/www/RSS.java
index 72893915..349743b5 100644
--- a/src/main/java/com/juick/http/www/RSS.java
+++ b/src/main/java/com/juick/http/www/RSS.java
@@ -19,16 +19,16 @@ package com.juick.http.www;
import com.juick.Message;
import com.juick.server.MessagesQueries;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
-import java.sql.Connection;
import java.text.SimpleDateFormat;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
/**
*
@@ -36,10 +36,9 @@ import javax.servlet.http.HttpServletResponse;
*/
public class RSS {
- private static final SimpleDateFormat sdfSQL = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static final SimpleDateFormat sdfRSS = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
- protected void doGet(Connection sql, HttpServletRequest request, HttpServletResponse response, int uid, String uname) throws ServletException, IOException {
+ protected void doGet(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response, int uid, String uname) throws ServletException, IOException {
List<Integer> mids = MessagesQueries.getUserBlog(sql, uid, 0, 0);
if (mids.isEmpty()) {
response.sendError(404);
@@ -73,14 +72,9 @@ public class RSS {
out.println("]]></title>");
out.println("<description><![CDATA[" + PageTemplates.formatMessage(msg.getText()) + "]]></description>");
- synchronized (sdfSQL) {
- try {
- Date date = sdfSQL.parse(msg.TimestampString);
- out.println("<pubDate>" + sdfRSS.format(date) + "</pubDate>");
- } catch (Exception e) {
- System.err.println("PARSE EXCEPTION: " + msg.TimestampString);
- }
- }
+ Date date = msg.getDate();
+ out.println("<pubDate>" + sdfRSS.format(date) + "</pubDate>");
+
out.println("<comments>http://juick.com/" + msg.getUser().getUName() + "/" + msg.getMID() + "</comments>");
if (!msg.Tags.isEmpty()) {