aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2021-04-17 08:39:21 +0300
committerGravatar Vitaly Takmazov2021-04-17 08:39:21 +0300
commit7203299e6ec544d36f4889e02b946bb9b6061f09 (patch)
treec816307ba3c0b48475fdb32b93ceb91d862c924b /src
parent7412ab820803908297db14ec8f9c8e9e1d339003 (diff)
Cleanup deprecated usage of third-party libraries
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/config/HttpClientConfig.java1
-rw-r--r--src/main/java/com/juick/service/MessagesServiceImpl.java18
-rw-r--r--src/main/java/com/juick/service/UserServiceImpl.java4
-rw-r--r--src/main/java/com/juick/www/api/Messages.java18
4 files changed, 19 insertions, 22 deletions
diff --git a/src/main/java/com/juick/config/HttpClientConfig.java b/src/main/java/com/juick/config/HttpClientConfig.java
index 0b23ca15..22c06ecb 100644
--- a/src/main/java/com/juick/config/HttpClientConfig.java
+++ b/src/main/java/com/juick/config/HttpClientConfig.java
@@ -19,7 +19,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
/**
diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java
index b3b51bcc..eee40512 100644
--- a/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2020, Juick
+ * Copyright (C) 2008-2021, Juick
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -334,8 +334,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
public boolean isReadOnly(final int mid) {
List<Integer> list = getJdbcTemplate().queryForList(
"SELECT readonly FROM messages WHERE message_id = ?",
- new Object[]{mid},
- Integer.class);
+ Integer.class,
+ mid);
return !list.isEmpty() && list.get(0) == 1;
}
@@ -345,8 +345,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
public boolean isSubscribed(final int uid, final int mid) {
List<Integer> list = getJdbcTemplate().queryForList(
"SELECT 1 FROM subscr_messages WHERE suser_id = ? AND message_id = ?",
- new Object[]{uid, mid},
- Integer.class);
+ Integer.class,
+ uid, mid);
return !list.isEmpty() && list.get(0) == 1;
}
@@ -356,8 +356,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
public int getMessagePrivacy(final int mid) {
List<Integer> list = getJdbcTemplate().queryForList(
"SELECT privacy FROM messages WHERE message_id = ?",
- new Object[]{mid},
- Integer.class);
+ Integer.class,
+ mid);
return list.isEmpty() ? -4 : list.get(0);
}
@@ -473,13 +473,13 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
List<User> list = getJdbcTemplate().query(
"SELECT messages.user_id, users.nick "
+ "FROM messages INNER JOIN users ON messages.user_id = users.id WHERE messages.message_id = ?",
- new Object[]{mid},
(rs, num) -> {
User res = new User();
res.setUid(rs.getInt(1));
res.setName(rs.getString(2));
return res;
- });
+ },
+ mid);
return list.isEmpty() ?
null : list.get(0);
diff --git a/src/main/java/com/juick/service/UserServiceImpl.java b/src/main/java/com/juick/service/UserServiceImpl.java
index a86b22a6..7d215260 100644
--- a/src/main/java/com/juick/service/UserServiceImpl.java
+++ b/src/main/java/com/juick/service/UserServiceImpl.java
@@ -428,9 +428,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService {
List<Integer> list = getJdbcTemplate().queryForList(
"SELECT 1 FROM bl_users WHERE (user_id = ? AND bl_user_id = ?) "
+ "OR (user_id = ? AND bl_user_id = ?)",
- new Object[]{uid, uid2, uid2, uid},
- Integer.class);
-
+ Integer.class, uid, uid2, uid2, uid);
return !list.isEmpty() && list.get(0) == 1;
}
diff --git a/src/main/java/com/juick/www/api/Messages.java b/src/main/java/com/juick/www/api/Messages.java
index b7e9cb0b..395d00d8 100644
--- a/src/main/java/com/juick/www/api/Messages.java
+++ b/src/main/java/com/juick/www/api/Messages.java
@@ -102,23 +102,23 @@ public class Messages {
@RequestParam(required = false) String media,
@RequestParam(required = false) String tag) {
List<Integer> mids;
- if (!StringUtils.isEmpty(uname)) {
+ if (StringUtils.hasText(uname)) {
User user = userService.getUserByName(uname);
if (!user.isAnonymous() && !user.isBanned()) {
- if (!StringUtils.isEmpty(media)) {
+ if (StringUtils.hasText(media)) {
mids = messagesService.getUserPhotos(user.getUid(), 0, before);
- } else if (!StringUtils.isEmpty(tag)) {
+ } else if (StringUtils.hasText(tag)) {
Tag tagObject = tagService.getTag(tag, false);
if (tagObject != null) {
mids = messagesService.getUserTag(user.getUid(), tagObject.TID, 0, before);
} else {
return NOT_FOUND;
}
- } else if (!StringUtils.isEmpty(withrecommended)) {
+ } else if (StringUtils.hasText(withrecommended)) {
mids = messagesService.getUserBlogWithRecommendations(user.getUid(), 0, before);
} else if (daysback > 0) {
mids = messagesService.getUserBlogAtDay(user.getUid(), 0, daysback);
- } else if (!StringUtils.isEmpty(search)) {
+ } else if (StringUtils.hasText(search)) {
mids = messagesService.getUserSearch(visitor, user.getUid(), WebUtils.encodeSphinx(search), 0, page);
} else {
mids = messagesService.getUserBlog(user.getUid(), 0, before);
@@ -127,18 +127,18 @@ public class Messages {
return NOT_FOUND;
}
} else {
- if (!StringUtils.isEmpty(popular)) {
+ if (StringUtils.hasText(popular)) {
mids = messagesService.getPopular(visitor.getUid(), before);
- } else if (!StringUtils.isEmpty(media)) {
+ } else if (StringUtils.hasText(media)) {
mids = messagesService.getPhotos(visitor.getUid(), before);
- } else if (!StringUtils.isEmpty(tag)) {
+ } else if (StringUtils.hasText(tag)) {
Tag tagObject = tagService.getTag(tag, false);
if (tagObject != null) {
mids = messagesService.getTag(tagObject.TID, visitor.getUid(), before, 20);
} else {
return NOT_FOUND;
}
- } else if (!StringUtils.isEmpty(search)) {
+ } else if (StringUtils.hasText(search)) {
mids = messagesService.getSearch(visitor, WebUtils.encodeSphinx(search), page);
} else {
mids = messagesService.getAll(visitor.getUid(), before);