diff options
author | Alexander Alexeev | 2016-11-30 15:10:15 +0700 |
---|---|---|
committer | Alexander Alexeev | 2016-11-30 15:10:15 +0700 |
commit | 1d837a835c04078ec66325e9fb9de21ac401874e (patch) | |
tree | 428217d2c617b9caf2eb6d42a7716789881d0937 /juick-www/src/main/java/com/juick/www/PageTemplates.java | |
parent | b45c000ed478f2407288aab1532425288f998689 (diff) |
prevent string concatenation for disabled loggers
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/PageTemplates.java')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/PageTemplates.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/juick-www/src/main/java/com/juick/www/PageTemplates.java b/juick-www/src/main/java/com/juick/www/PageTemplates.java index f0974e69..74b8b543 100644 --- a/juick-www/src/main/java/com/juick/www/PageTemplates.java +++ b/juick-www/src/main/java/com/juick/www/PageTemplates.java @@ -42,7 +42,6 @@ import java.util.List; import java.util.stream.Collectors; /** - * * @author Ugnich Anton */ public class PageTemplates { @@ -254,7 +253,7 @@ public class PageTemplates { ret = sdfFull.format(fulldate); } } catch (Exception e) { - logger.error("PARSE EXCEPTION: " + fulldate); + logger.error("PARSE EXCEPTION: {}, exception {}", fulldate, e); } } return ret; @@ -263,9 +262,9 @@ public class PageTemplates { public static String formatJSLocalTime(Date ts) { return "<script type=\"text/javascript\">" - + "var d=new Date(" + ts.getTime() + ");" - + "document.write((d.getDate()<10?'0':'')+d.getDate()+'.'+(d.getMonth()<9?'0':'')+(d.getMonth()+1)+'.'+d.getFullYear()+' '+(d.getHours()<10?'0':'')+d.getHours()+':'+(d.getMinutes()<10?'0':'')+d.getMinutes());" - + "</script>"; + + "var d=new Date(" + ts.getTime() + ");" + + "document.write((d.getDate()<10?'0':'')+d.getDate()+'.'+(d.getMonth()<9?'0':'')+(d.getMonth()+1)+'.'+d.getFullYear()+' '+(d.getHours()<10?'0':'')+d.getHours()+':'+(d.getMinutes()<10?'0':'')+d.getMinutes());" + + "</script>"; } public static String formatReplies(int replies) { @@ -326,10 +325,10 @@ public class PageTemplates { out.println(" @<a href=\"/" + msg.getUser().getName() + "/\">" + msg.getUser().getName() + "</a>:"); out.println(" <div class=\"msg-avatar\"><a href=\"/" + msg.getUser().getName() + "/\"><img src=\"//i.juick.com/a/" + msg.getUser().getUid() + ".png\" alt=\"" + msg.getUser().getName() + "\"/></a></div>"); out.println(" <div class=\"msg-ts\"><a href=\"/" + msg.getUser().getName() + "/" + msg.getMid() + "\"><time datetime=\"" + sdfSQL.format(msg.getDate()) + "Z\" title=\"" + sdfSQL.format(msg.getDate()) + " GMT\">" + formatDate(msg.TimeAgo, msg.getDate()) + "</time></a></div>"); - + out.println(" <div class=\"msg-tags\">" + tagsStr + "</div>"); out.println(" </header>"); - + if (msg.AttachmentType != null) { String fname = msg.getMid() + "." + msg.AttachmentType; out.println(" <p class=\"ir\"><a href=\"//i.juick.com/photos-512/" + fname + "\" data-fname=\"" + fname + "\"><img src=\"//i.juick.com/photos-512/" + fname + "\" alt=\"\"/></a></p>"); @@ -346,7 +345,7 @@ public class PageTemplates { out.print("<a href=\"/post?body=!+%23" + msg.getMid() + "\" class=\"a-like\">Мне нравится</a>"); } if (visitor.getUid() == 0 && !msg.ReadOnly) { - out.print("<a href=\"/"+ msg.getMid() + "\" class=\"a-login\">Комментировать</a> "); + out.print("<a href=\"/" + msg.getMid() + "\" class=\"a-login\">Комментировать</a> "); } else if (visitor.getUid() > 0 && (!msg.ReadOnly || visitor.getUid() == msg.getUser().getUid())) { out.print("<a class=\"a-comment\" href=\"/" + msg.getMid() + "\">Комментировать</a> "); } |