aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/http/www/Discover.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-01-14 12:16:49 +0300
committerGravatar Vitaly Takmazov2016-01-14 12:16:49 +0300
commitc492429b25c1ef711620a4f509975c7edc3ffa4a (patch)
tree5bc6b5746381d970760cd6ae5c5561e66a1f95e7 /src/main/java/com/juick/http/www/Discover.java
parent7e93e142b6dd75c22c057962447eec014c4e15b4 (diff)
Update libraries and refactoring
Diffstat (limited to 'src/main/java/com/juick/http/www/Discover.java')
-rw-r--r--src/main/java/com/juick/http/www/Discover.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main/java/com/juick/http/www/Discover.java b/src/main/java/com/juick/http/www/Discover.java
index 201139c4..e7d85d8a 100644
--- a/src/main/java/com/juick/http/www/Discover.java
+++ b/src/main/java/com/juick/http/www/Discover.java
@@ -26,6 +26,7 @@ import java.net.URLDecoder;
import java.net.URLEncoder;
import java.sql.Connection;
import java.util.ArrayList;
+import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -70,14 +71,13 @@ public class Discover {
}
}
- int visitor_uid = visitor != null ? visitor.UID : 0;
+ int visitor_uid = visitor != null ? visitor.getUID() : 0;
String title = "*" + Utils.encodeHTML(paramTag.Name);
- ArrayList<Integer> mids = MessagesQueries.getTag(sql, paramTag.TID, visitor_uid, paramBefore, (visitor == null) ? 40 : 20);
+ List<Integer> mids = MessagesQueries.getTag(sql, paramTag.TID, visitor_uid, paramBefore, (visitor == null) ? 40 : 20);
response.setContentType("text/html; charset=UTF-8");
- PrintWriter out = response.getWriter();
- try {
+ try (PrintWriter out = response.getWriter()) {
String head = "";
if (TagQueries.getTagNoIndex(sql, paramTag.TID)) {
head = "<meta name=\"robots\" content=\"noindex,nofollow\"/>";
@@ -91,7 +91,7 @@ public class Discover {
out.println("<section id=\"content\">");
if (mids.size() > 0) {
- int vuid = visitor != null ? visitor.UID : 0;
+ int vuid = visitor != null ? visitor.getUID() : 0;
int ad_mid = AdsQueries.getAdMID(sql, vuid);
if (ad_mid > 0 && mids.indexOf(ad_mid) == -1) {
mids.add(0, ad_mid);
@@ -113,8 +113,6 @@ public class Discover {
PageTemplates.pageFooter(request, out, visitor, true);
PageTemplates.pageEnd(out);
- } finally {
- out.close();
}
}
}