From 3859c9616d0a7a04e68427d173b863161b818140 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 20 Dec 2016 14:28:00 +0300 Subject: StringUtils.EMPTY --- .../com/juick/configuration/DataConfiguration.java | 5 ++-- .../juick/configuration/SearchConfiguration.java | 5 ++-- .../java/com/juick/server/CrosspostQueries.java | 5 ++-- .../java/com/juick/server/MessagesQueries.java | 4 +-- .../main/java/com/juick/server/UserQueries.java | 4 +-- .../com/juick/server/protocol/JuickProtocol.java | 3 ++- .../server/protocol/annotation/UserCommand.java | 6 +++-- .../juick/server/util/HttpBadRequestException.java | 3 ++- .../juick/server/util/HttpForbiddenException.java | 3 ++- .../juick/server/util/HttpNotFoundException.java | 3 ++- .../main/java/com/juick/server/util/HttpUtils.java | 3 ++- .../com/juick/service/CrosspostServiceImpl.java | 5 ++-- .../com/juick/service/MessagesServiceImpl.java | 30 +++++++++++----------- .../com/juick/service/SubscriptionServiceImpl.java | 3 ++- .../java/com/juick/service/UserServiceImpl.java | 4 +-- .../service/search/SphinxSearchServiceImpl.java | 4 +-- .../CookieSimpleHashRememberMeServices.java | 2 +- .../src/main/java/com/juick/util/TagUtils.java | 3 ++- 18 files changed, 54 insertions(+), 41 deletions(-) (limited to 'juick-server/src/main/java') diff --git a/juick-server/src/main/java/com/juick/configuration/DataConfiguration.java b/juick-server/src/main/java/com/juick/configuration/DataConfiguration.java index efee4731..4258703d 100644 --- a/juick-server/src/main/java/com/juick/configuration/DataConfiguration.java +++ b/juick-server/src/main/java/com/juick/configuration/DataConfiguration.java @@ -3,6 +3,7 @@ package com.juick.configuration; import com.juick.database.MySqlUpdater; import com.juick.service.search.SearchService; import org.apache.commons.dbcp2.BasicDataSource; +import org.apache.commons.lang3.StringUtils; import org.springframework.context.annotation.*; import org.springframework.core.env.Environment; import org.springframework.jdbc.core.JdbcTemplate; @@ -34,8 +35,8 @@ public class DataConfiguration implements TransactionManagementConfigurer { dataSource.setDriverClassName(env.getProperty("datasource_driver", "com.mysql.jdbc.Driver")); dataSource.setUrl(env.getProperty("datasource_url")); - dataSource.setUsername(env.getProperty("datasource_user", "")); - dataSource.setPassword(env.getProperty("datasource_password", "")); + dataSource.setUsername(env.getProperty("datasource_user", StringUtils.EMPTY)); + dataSource.setPassword(env.getProperty("datasource_password", StringUtils.EMPTY)); dataSource.setValidationQuery("select 1"); diff --git a/juick-server/src/main/java/com/juick/configuration/SearchConfiguration.java b/juick-server/src/main/java/com/juick/configuration/SearchConfiguration.java index 5f04ea4e..e6b446b6 100644 --- a/juick-server/src/main/java/com/juick/configuration/SearchConfiguration.java +++ b/juick-server/src/main/java/com/juick/configuration/SearchConfiguration.java @@ -3,6 +3,7 @@ package com.juick.configuration; import com.juick.service.search.SearchService; import com.juick.service.search.SphinxSearchServiceImpl; import org.apache.commons.dbcp2.BasicDataSource; +import org.apache.commons.lang3.StringUtils; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.DependsOn; @@ -28,8 +29,8 @@ public class SearchConfiguration { dataSource.setDriverClassName(env.getProperty("sphinx_driver", "com.mysql.jdbc.Driver")); dataSource.setUrl(env.getProperty("sphinx_url")); - dataSource.setUsername(env.getProperty("sphinx_user", "")); - dataSource.setPassword(env.getProperty("sphinx_password", "")); + dataSource.setUsername(env.getProperty("sphinx_user", StringUtils.EMPTY)); + dataSource.setPassword(env.getProperty("sphinx_password", StringUtils.EMPTY)); return dataSource; } diff --git a/juick-server/src/main/java/com/juick/server/CrosspostQueries.java b/juick-server/src/main/java/com/juick/server/CrosspostQueries.java index 827dad09..9d0b5f4c 100644 --- a/juick-server/src/main/java/com/juick/server/CrosspostQueries.java +++ b/juick-server/src/main/java/com/juick/server/CrosspostQueries.java @@ -18,6 +18,7 @@ package com.juick.server; import com.juick.server.helpers.ApplicationStatus; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; @@ -64,7 +65,7 @@ public class CrosspostQueries { try { return sql.queryForObject("SELECT uname FROM twitter WHERE user_id=?", String.class, uid); } catch (EmptyResultDataAccessException e) { - return ""; + return StringUtils.EMPTY; } } @@ -72,7 +73,7 @@ public class CrosspostQueries { try { return sql.queryForObject("SELECT tg_name FROM telegram WHERE user_id=?", String.class, uid); } catch (EmptyResultDataAccessException e) { - return ""; + return StringUtils.EMPTY; } } diff --git a/juick-server/src/main/java/com/juick/server/MessagesQueries.java b/juick-server/src/main/java/com/juick/server/MessagesQueries.java index cac36979..f3de1f9b 100644 --- a/juick-server/src/main/java/com/juick/server/MessagesQueries.java +++ b/juick-server/src/main/java/com/juick/server/MessagesQueries.java @@ -101,8 +101,8 @@ public class MessagesQueries { if (mid > 0) { - String tagsNames = ""; - String tagsIDs = ""; + String tagsNames = org.apache.commons.lang3.StringUtils.EMPTY; + String tagsIDs = org.apache.commons.lang3.StringUtils.EMPTY; for (int i = 0; i < tags.size(); i++) { if (i > 0) { diff --git a/juick-server/src/main/java/com/juick/server/UserQueries.java b/juick-server/src/main/java/com/juick/server/UserQueries.java index e91cb6b3..7a669230 100644 --- a/juick-server/src/main/java/com/juick/server/UserQueries.java +++ b/juick-server/src/main/java/com/juick/server/UserQueries.java @@ -241,7 +241,7 @@ public class UserQueries { if (sql.update("INSERT INTO mail(user_id,hash) VALUES (?,?) ON DUPLICATE KEY UPDATE hash=?", user.getUid(), newHash, newHash) > 0) { return newHash; } - return ""; + return org.apache.commons.lang3.StringUtils.EMPTY; } public static int getUserOptionInt(JdbcTemplate sql, int uid, String option, int defaultValue) { @@ -481,7 +481,7 @@ public class UserQueries { return sql.queryForObject("SELECT hash FROM mail WHERE user_id=?", String.class, user.getUid()) + "@mail.juick.com"; } catch (EmptyResultDataAccessException e) { - return ""; + return org.apache.commons.lang3.StringUtils.EMPTY; } } } diff --git a/juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java b/juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java index a024a0eb..cd7a4bc1 100644 --- a/juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java +++ b/juick-server/src/main/java/com/juick/server/protocol/JuickProtocol.java @@ -8,6 +8,7 @@ import com.juick.server.helpers.TagStats; import com.juick.server.protocol.annotation.UserCommand; import com.juick.service.*; import com.juick.util.TagUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import javax.inject.Inject; @@ -110,7 +111,7 @@ public class JuickProtocol { bltags = tagService.getUserBLTags(user_from.getUid()); - String txt = ""; + String txt = StringUtils.EMPTY; if (bltags.size() > 0) { for (String bltag : bltags) { txt += "*" + bltag + "\n"; diff --git a/juick-server/src/main/java/com/juick/server/protocol/annotation/UserCommand.java b/juick-server/src/main/java/com/juick/server/protocol/annotation/UserCommand.java index af7c4924..42a9bb59 100644 --- a/juick-server/src/main/java/com/juick/server/protocol/annotation/UserCommand.java +++ b/juick-server/src/main/java/com/juick/server/protocol/annotation/UserCommand.java @@ -1,5 +1,7 @@ package com.juick.server.protocol.annotation; +import org.apache.commons.lang3.StringUtils; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -15,7 +17,7 @@ public @interface UserCommand { * * @return a command pattern */ - String pattern() default ""; + String pattern() default StringUtils.EMPTY; /** * @@ -27,5 +29,5 @@ public @interface UserCommand { * * @return a string used in HELP command output. Basically, only 1 string */ - String help() default ""; + String help() default StringUtils.EMPTY; } diff --git a/juick-server/src/main/java/com/juick/server/util/HttpBadRequestException.java b/juick-server/src/main/java/com/juick/server/util/HttpBadRequestException.java index 5c0593ec..1ba1aecb 100644 --- a/juick-server/src/main/java/com/juick/server/util/HttpBadRequestException.java +++ b/juick-server/src/main/java/com/juick/server/util/HttpBadRequestException.java @@ -1,5 +1,6 @@ package com.juick.server.util; +import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @@ -9,6 +10,6 @@ import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(value = HttpStatus.BAD_REQUEST) public class HttpBadRequestException extends RuntimeException { public HttpBadRequestException() { - super("", null, false, false); + super(StringUtils.EMPTY, null, false, false); } } diff --git a/juick-server/src/main/java/com/juick/server/util/HttpForbiddenException.java b/juick-server/src/main/java/com/juick/server/util/HttpForbiddenException.java index a1004b41..733453ba 100644 --- a/juick-server/src/main/java/com/juick/server/util/HttpForbiddenException.java +++ b/juick-server/src/main/java/com/juick/server/util/HttpForbiddenException.java @@ -1,5 +1,6 @@ package com.juick.server.util; +import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @@ -9,7 +10,7 @@ import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(value = HttpStatus.FORBIDDEN) public class HttpForbiddenException extends RuntimeException { public HttpForbiddenException() { - super("", null, false, false); + super(StringUtils.EMPTY, null, false, false); } } diff --git a/juick-server/src/main/java/com/juick/server/util/HttpNotFoundException.java b/juick-server/src/main/java/com/juick/server/util/HttpNotFoundException.java index fd0f1cb0..942d90e2 100644 --- a/juick-server/src/main/java/com/juick/server/util/HttpNotFoundException.java +++ b/juick-server/src/main/java/com/juick/server/util/HttpNotFoundException.java @@ -1,5 +1,6 @@ package com.juick.server.util; +import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @@ -9,6 +10,6 @@ import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(value = HttpStatus.NOT_FOUND) public class HttpNotFoundException extends RuntimeException { public HttpNotFoundException() { - super("", null, false, false); + super(StringUtils.EMPTY, null, false, false); } } diff --git a/juick-server/src/main/java/com/juick/server/util/HttpUtils.java b/juick-server/src/main/java/com/juick/server/util/HttpUtils.java index fa0b2ec2..e54bef87 100644 --- a/juick-server/src/main/java/com/juick/server/util/HttpUtils.java +++ b/juick-server/src/main/java/com/juick/server/util/HttpUtils.java @@ -18,6 +18,7 @@ package com.juick.server.util; import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.multipart.MultipartFile; @@ -58,7 +59,7 @@ public class HttpUtils { } } } - return ""; + return StringUtils.EMPTY; } public static String downloadImage(URL url) throws Exception { String attachmentFName = null; diff --git a/juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java b/juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java index 0f043292..df748526 100644 --- a/juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/CrosspostServiceImpl.java @@ -1,6 +1,7 @@ package com.juick.service; import com.juick.server.helpers.ApplicationStatus; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Repository; @@ -96,7 +97,7 @@ public class CrosspostServiceImpl extends BaseJdbcService implements CrosspostSe uid); return list.isEmpty() ? - "" : list.get(0); + StringUtils.EMPTY : list.get(0); } @Transactional(readOnly = true) @@ -108,7 +109,7 @@ public class CrosspostServiceImpl extends BaseJdbcService implements CrosspostSe uid); return list.isEmpty() ? - "" : list.get(0); + StringUtils.EMPTY : list.get(0); } @Transactional(readOnly = true) diff --git a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java index 88167be8..1ad29d00 100644 --- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -107,7 +107,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ int mid = holder.getKey().intValue(); if (mid > 0) { - String tagsNames = ""; + String tagsNames = StringUtils.EMPTY; if (CollectionUtils.isNotEmpty(tags)) { StringBuilder tasNamesBuilder = new StringBuilder(); @@ -364,7 +364,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ return getNamedParameterJdbcTemplate().queryForList( "SELECT m.message_id FROM messages m WHERE " + (before > 0 ? - " m.message_id < :before AND " : "") + + " m.message_id < :before AND " : StringUtils.EMPTY) + " m.hidden = 0 AND (m.privacy > 0" + (visitorUid > 1 ? " OR m.user_id = :visitorUid) AND NOT EXISTS (" + @@ -389,7 +389,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ "ON ((tags.synonym_id = :tid OR tags.tag_id = :tid) AND tags.tag_id = messages_tags.tag_id)) " + "INNER JOIN messages USING(message_id) WHERE " + (before > 0 ? - " messages.message_id < :before AND " : "") + + " messages.message_id < :before AND " : StringUtils.EMPTY) + "(messages.privacy > 0 OR messages.user_id = :visitorUid) ORDER BY message_id DESC LIMIT :cnt", sqlParameterSource, Integer.class); @@ -407,7 +407,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ "SELECT messages.message_id FROM messages_tags " + "INNER JOIN messages USING(message_id) WHERE messages_tags.tag_id IN (" + tids + ") " + (before > 0 ? - " AND messages.message_id < :before " : "") + + " AND messages.message_id < :before " : StringUtils.EMPTY) + " AND (messages.privacy > 0 OR messages.user_id = :visitorUid) " + "ORDER BY messages.message_id DESC LIMIT :cnt", sqlParameterSource, @@ -425,7 +425,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ return getNamedParameterJdbcTemplate().queryForList( "SELECT message_id FROM messages WHERE place_id = :placeId " + (before > 0 ? - " AND message_id < :before " : "") + + " AND message_id < :before " : StringUtils.EMPTY) + " AND (privacy > 0 OR user_id = :visitorUid) ORDER BY message_id DESC LIMIT 20", sqlParameterSource, Integer.class); @@ -443,13 +443,13 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ " INNER JOIN subscr_users ON (subscr_users.suser_id = :uid AND subscr_users.user_id = messages.user_id) " + " WHERE " + (before > 0 ? - " message_id < :before AND " : "") + + " message_id < :before AND " : StringUtils.EMPTY) + " (privacy >= 0 OR (privacy >= -2 AND privacy <= -1" + " AND EXISTS (SELECT 1 FROM wl_users w WHERE w.wl_user_id = :uid and w.user_id = messages.user_id)))) " + " UNION " + " (SELECT message_id FROM messages WHERE user_id=:uid " + (before > 0 ? - " AND message_id < :before " : "") + + " AND message_id < :before " : StringUtils.EMPTY) + ") ORDER BY message_id DESC LIMIT 20", sqlParameterSource, Integer.class); @@ -467,7 +467,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ return getNamedParameterJdbcTemplate().queryForList ("SELECT message_id FROM messages WHERE user_id = :uid AND privacy < 0" + (before > 0 ? - " AND message_id < :before " : "") + + " AND message_id < :before " : StringUtils.EMPTY) + "ORDER BY message_id DESC LIMIT 20", sqlParameterSource, Integer.class); @@ -500,7 +500,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ "SELECT f.message_id FROM favorites f WHERE " + "EXISTS (SELECT 1 FROM subscr_users s WHERE s.suser_id = :uid and f.user_id = s.user_id)" + (before > 0 ? - " AND f.message_id < :before " : "") + + " AND f.message_id < :before " : StringUtils.EMPTY) + "ORDER BY f.message_id DESC LIMIT 20", sqlParameterSource, Integer.class); @@ -516,7 +516,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ return getNamedParameterJdbcTemplate().queryForList( "SELECT m.message_id FROM messages m WHERE m.privacy > 0 " + (before > 0 ? - " AND m.message_id < :before " : "") + + " AND m.message_id < :before " : StringUtils.EMPTY) + " AND m.popular > 0 AND NOT EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :vid and b.bl_user_id = m.user_id) " + " ORDER BY m.message_id DESC LIMIT 20", sqlParameterSource, @@ -533,7 +533,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ return getNamedParameterJdbcTemplate().queryForList( "SELECT m.message_id FROM messages m WHERE (m.privacy > 0 OR m.user_id = :vid) " + (before > 0 ? - " AND m.message_id < :before " : "") + + " AND m.message_id < :before " : StringUtils.EMPTY) + " AND m.attach IS NOT NULL " + " AND NOT EXISTS (SELECT 1 from users u WHERE u.banned = 1 and u.id = m.user_id) " + " AND NOT EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :vid and b.bl_user_id = m.user_id) " + @@ -566,7 +566,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ return getNamedParameterJdbcTemplate().queryForList( "SELECT message_id FROM messages WHERE user_id = :uid" + (before > 0 ? - " AND message_id < :before" : "") + + " AND message_id < :before" : StringUtils.EMPTY) + " AND privacy >= :privacy ORDER BY message_id DESC LIMIT 20", sqlParameterSource, Integer.class); @@ -585,7 +585,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ "SELECT messages.message_id FROM messages_tags INNER JOIN messages " + " USING (message_id) WHERE messages.user_id = :uid AND messages_tags.tag_id = :tid " + (before > 0 ? - " AND messages.message_id < :before " : "") + + " AND messages.message_id < :before " : StringUtils.EMPTY) + " AND messages.privacy >= :privacy ORDER BY messages.message_id DESC LIMIT 20", sqlParameterSource, Integer.class); @@ -602,7 +602,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ "SELECT message_id FROM favorites " + " WHERE user_id = :uid " + (before > 0 ? - " AND message_id < :before " : "") + + " AND message_id < :before " : StringUtils.EMPTY) + " ORDER BY message_id DESC LIMIT 20", sqlParameterSource, Integer.class); @@ -619,7 +619,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ return getNamedParameterJdbcTemplate().queryForList( "SELECT message_id FROM messages WHERE user_id = :uid " + (before > 0 ? - " AND message_id < :before " : "") + + " AND message_id < :before " : StringUtils.EMPTY) + " AND privacy >= :privacy AND attach IS NOT NULL ORDER BY message_id DESC LIMIT 20", sqlParameterSource, Integer.class); diff --git a/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java index decfe59d..4082e1ef 100644 --- a/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java @@ -3,6 +3,7 @@ package com.juick.service; import com.juick.Tag; import com.juick.User; import com.juick.server.helpers.NotifyOpts; +import org.apache.commons.lang3.StringUtils; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.stereotype.Repository; @@ -47,7 +48,7 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip "SELECT jids.jid FROM subscr_users INNER JOIN jids " + "ON (subscr_users.user_id = :uid AND subscr_users.suser_id = jids.user_id) WHERE jids.active = 1 " + (friendsonly ? - " AND EXISTS (SELECT 1 FROM wl_users w WHERE w.user_id = :uid and jids.user_id = w.wl_user_id)" : ""), + " AND EXISTS (SELECT 1 FROM wl_users w WHERE w.user_id = :uid and jids.user_id = w.wl_user_id)" : StringUtils.EMPTY), new MapSqlParameterSource("uid", uid), String.class); } diff --git a/juick-server/src/main/java/com/juick/service/UserServiceImpl.java b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java index b3430254..f226b402 100644 --- a/juick-server/src/main/java/com/juick/service/UserServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/UserServiceImpl.java @@ -357,7 +357,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { if (ret > 0) return newHash; } - return ""; + return StringUtils.EMPTY; } @Transactional(readOnly = true) @@ -649,7 +649,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { "SELECT hash FROM mail WHERE user_id = ?", String.class, user.getUid()); - return list.isEmpty() ? "" : list.get(0) + "@mail.juick.com"; + return list.isEmpty() ? StringUtils.EMPTY : list.get(0) + "@mail.juick.com"; } @Transactional diff --git a/juick-server/src/main/java/com/juick/service/search/SphinxSearchServiceImpl.java b/juick-server/src/main/java/com/juick/service/search/SphinxSearchServiceImpl.java index de0a101f..161e0fb2 100644 --- a/juick-server/src/main/java/com/juick/service/search/SphinxSearchServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/search/SphinxSearchServiceImpl.java @@ -49,7 +49,7 @@ public class SphinxSearchServiceImpl implements SearchService { return namedParameterSearchJdbcTemplate.queryForList( "SELECT id AS message_id FROM messages WHERE MATCH(:search) " + (messageIdBefore > 0 ? - " AND id < :before " : "") + + " AND id < :before " : StringUtils.EMPTY) + " ORDER BY id DESC LIMIT :limit", sqlParameterSource, Integer.class); @@ -69,7 +69,7 @@ public class SphinxSearchServiceImpl implements SearchService { return namedParameterSearchJdbcTemplate.queryForList( "SELECT id AS message_id FROM messages WHERE user_id = :userId AND MATCH(:search) " + (messageIdBefore > 0 ? - " AND id < :before " : "") + + " AND id < :before " : StringUtils.EMPTY) + " ORDER BY id DESC LIMIT :limit", sqlParameterSource, Integer.class); diff --git a/juick-server/src/main/java/com/juick/service/security/deprecated/CookieSimpleHashRememberMeServices.java b/juick-server/src/main/java/com/juick/service/security/deprecated/CookieSimpleHashRememberMeServices.java index ec44baa0..1fb2c6a3 100644 --- a/juick-server/src/main/java/com/juick/service/security/deprecated/CookieSimpleHashRememberMeServices.java +++ b/juick-server/src/main/java/com/juick/service/security/deprecated/CookieSimpleHashRememberMeServices.java @@ -104,6 +104,6 @@ public class CookieSimpleHashRememberMeServices extends AbstractRememberMeServic @Override protected String encodeCookie(String[] cookieTokens) { - return cookieTokens != null && cookieTokens.length > 0 ? cookieTokens[0] : ""; + return cookieTokens != null && cookieTokens.length > 0 ? cookieTokens[0] : StringUtils.EMPTY; } } diff --git a/juick-server/src/main/java/com/juick/util/TagUtils.java b/juick-server/src/main/java/com/juick/util/TagUtils.java index 157522ab..fec59f29 100644 --- a/juick-server/src/main/java/com/juick/util/TagUtils.java +++ b/juick-server/src/main/java/com/juick/util/TagUtils.java @@ -2,6 +2,7 @@ package com.juick.util; import com.juick.Tag; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import java.util.List; import java.util.stream.Collectors; @@ -16,7 +17,7 @@ public class TagUtils { public static String toString(final List tags) { if (CollectionUtils.isEmpty(tags)) - return ""; + return StringUtils.EMPTY; return tags.stream().map(t -> " *" + t.getName()) .collect(Collectors.joining()); -- cgit v1.2.3