From 2fda6291ef2869d4f5f29afa92737d8f0f527a0e Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 21 Mar 2018 15:18:54 +0300 Subject: xmpp: restore full tests --- .../src/main/java/com/juick/service/SubscriptionServiceImpl.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'juick-server-jdbc/src/main/java/com/juick/service') diff --git a/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java index 77735b0c..0273c1c3 100644 --- a/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java +++ b/juick-server-jdbc/src/main/java/com/juick/service/SubscriptionServiceImpl.java @@ -187,8 +187,13 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip @Transactional @Override public boolean subscribeTag(final User user, final Tag toTag) { - return getJdbcTemplate().update( - "INSERT IGNORE INTO subscr_tags(tag_id,suser_id) VALUES (?,?)", toTag.TID, user.getUid()) == 1; + try { + + return getJdbcTemplate().update( + "INSERT INTO subscr_tags(tag_id,suser_id) VALUES (?,?)", toTag.TID, user.getUid()) == 1; + } catch (DuplicateKeyException e) { + return true; + } } @Transactional -- cgit v1.2.3