Browse files

Controlled exception when an error occurs while getting the IPv6 ENCU…

…ESTAME-453
  • Loading branch information...
1 parent af06965 commit b41cc3aa12fc2e09423e7545ffbacef032c7aa00 @dianmorales dianmorales committed Jun 13, 2012
Showing with 14 additions and 8 deletions.
  1. +14 −8 encuestame-mvc/src/main/java/org/encuestame/mvc/controller/HashTagController.java
View
22 encuestame-mvc/src/main/java/org/encuestame/mvc/controller/HashTagController.java
@@ -86,20 +86,26 @@ public String hashTagController(ModelMap model, HttpServletRequest request,
public String tagController(ModelMap model, HttpServletRequest request,
HttpServletResponse response, @PathVariable String name) {
name = filterValue(name);
- final String IP = getIpClient(request);
+
final HashTag tag;
try {
+
tag = getFrontService().getHashTagItem(name);
if (tag == null) {
return "pageNotFound";
} else {
- log.debug("tagController tag =>"+tag);
- boolean hashTagVisite = getFrontService().checkPreviousHit(IP, tag.getHashTagId(), TypeSearchResult.HASHTAG);
- // TODO: Check that previous hash Tag hit has been visited the same day.
- log.debug("hashTagVisite =>"+hashTagVisite);
- if (!hashTagVisite) {
- getFrontService().registerHit(null, null, null, tag, IP, HitCategory.VISIT);
- }
+ try {
+ log.debug("tagController tag =>"+tag);
+ final String IP = getIpClient(request);
+ boolean hashTagVisite = getFrontService().checkPreviousHit(IP, tag.getHashTagId(), TypeSearchResult.HASHTAG);
+ // TODO: Check that previous hash Tag hit has been visited the same day.
+ log.debug("hashTagVisite =>"+hashTagVisite);
+ if (!hashTagVisite) {
+ getFrontService().registerHit(null, null, null, tag, IP, HitCategory.VISIT);
+ }
+ } catch (Exception e) {
+ log.warn("Imposible register vote " + "tag id: " + tag.getHashTagId());
+ }
final List<HomeBean> lastPublications = getFrontService()
.searchLastPublicationsbyHashTag(tag, null, this.INIT_RESULTS,
LIMIT_HASHTAG, "hashtag", request);

0 comments on commit b41cc3a

Please sign in to comment.