Commit 0c3f9a83 authored by Liang Ding's avatar Liang Ding

升级 Latke

parent f5b362b2
<?xml version="1.0" encoding="UTF-8"?>
<!--
Description: Solo POM.
Version: 3.18.3.16, Aug 27, 2018
Version: 3.18.3.17, Sep 2, 2018
Author: <a href="http://88250.b3log.org">Liang Ding</a>
Author: <a href="http://www.annpeter.cn">Ann Peter</a>
Author: <a href="http://vanessa.b3log.org">Vanessa</a>
......@@ -76,7 +76,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<org.b3log.latke.version>2.4.10</org.b3log.latke.version>
<org.b3log.latke.version>2.4.11</org.b3log.latke.version>
<servlet.version>3.1.0</servlet.version>
<slf4j.version>1.7.5</slf4j.version>
......
......@@ -17,6 +17,7 @@
*/
package org.b3log.solo.api.symphony;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.event.Event;
......@@ -31,7 +32,6 @@ import org.b3log.latke.servlet.HTTPRequestMethod;
import org.b3log.latke.servlet.annotation.RequestProcessing;
import org.b3log.latke.servlet.annotation.RequestProcessor;
import org.b3log.latke.servlet.renderer.JSONRenderer;
import org.b3log.latke.util.Strings;
import org.b3log.solo.event.EventTypes;
import org.b3log.solo.model.Article;
import org.b3log.solo.model.Comment;
......@@ -152,7 +152,7 @@ public class CommentReceiver {
final String keyOfSolo = preference.optString(Option.ID_C_KEY_OF_SOLO);
final String key = symphonyCmt.optString("userB3Key");
if (Strings.isEmptyOrNull(keyOfSolo) || !keyOfSolo.equals(key)) {
if (StringUtils.isBlank(keyOfSolo) || !keyOfSolo.equals(key)) {
ret.put(Keys.STATUS_CODE, HttpServletResponse.SC_FORBIDDEN);
ret.put(Keys.MSG, "Wrong key");
......@@ -204,7 +204,7 @@ public class CommentReceiver {
comment.put(Comment.COMMENT_DATE, date);
ret.put(Comment.COMMENT_DATE, DateFormatUtils.format(date, "yyyy-MM-dd HH:mm:ss"));
if (!Strings.isEmptyOrNull(originalCommentId)) {
if (StringUtils.isNotBlank(originalCommentId)) {
originalComment = commentRepository.get(originalCommentId);
if (null != originalComment) {
comment.put(Comment.COMMENT_ORIGINAL_COMMENT_ID, originalCommentId);
......
......@@ -17,6 +17,7 @@
*/
package org.b3log.solo.event.comment;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.event.AbstractEventListener;
......@@ -68,7 +69,7 @@ public final class ArticleCommentReplyNotifier extends AbstractEventListener<JSO
LOGGER.log(Level.DEBUG, "Processing an event[type={0}, data={1}] in listener[className={2}]",
event.getType(), eventData, ArticleCommentReplyNotifier.class.getName());
final String originalCommentId = comment.optString(Comment.COMMENT_ORIGINAL_COMMENT_ID);
if (Strings.isEmptyOrNull(originalCommentId)) {
if (StringUtils.isBlank(originalCommentId)) {
LOGGER.log(Level.DEBUG, "This comment[id={0}] is not a reply", comment.optString(Keys.OBJECT_ID));
return;
......
......@@ -17,6 +17,7 @@
*/
package org.b3log.solo.event.comment;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.event.AbstractEventListener;
......@@ -69,7 +70,7 @@ public final class PageCommentReplyNotifier extends AbstractEventListener<JSONOb
event.getType(), eventData, PageCommentReplyNotifier.class.getName());
final String originalCommentId = comment.optString(Comment.COMMENT_ORIGINAL_COMMENT_ID);
if (Strings.isEmptyOrNull(originalCommentId)) {
if (StringUtils.isBlank(originalCommentId)) {
LOGGER.log(Level.DEBUG, "This comment[id={0}] is not a reply", comment.optString(Keys.OBJECT_ID));
return;
}
......
......@@ -18,6 +18,7 @@
package org.b3log.solo.event.rhythm;
import jodd.http.HttpRequest;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.event.AbstractEventListener;
......@@ -84,7 +85,7 @@ public final class ArticleSender extends AbstractEventListener<JSONObject> {
throw new EventException("Not found preference");
}
if (!Strings.isEmptyOrNull(originalArticle.optString(Article.ARTICLE_VIEW_PWD))) {
if (StringUtils.isNotBlank(originalArticle.optString(Article.ARTICLE_VIEW_PWD))) {
return;
}
......
......@@ -18,6 +18,7 @@
package org.b3log.solo.event.rhythm;
import jodd.http.HttpRequest;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.event.AbstractEventListener;
......@@ -82,7 +83,7 @@ public final class ArticleUpdater extends AbstractEventListener<JSONObject> {
throw new EventException("Not found preference");
}
if (!Strings.isEmptyOrNull(originalArticle.optString(Article.ARTICLE_VIEW_PWD))) {
if (StringUtils.isNotBlank(originalArticle.optString(Article.ARTICLE_VIEW_PWD))) {
return;
}
......
......@@ -18,7 +18,7 @@
package org.b3log.solo.model.sitemap;
import org.apache.commons.lang.StringEscapeUtils;
import org.b3log.latke.util.Strings;
import org.apache.commons.lang.StringUtils;
/**
* Sitemap URL.
......@@ -115,7 +115,7 @@ public final class URL {
stringBuilder.append(StringEscapeUtils.escapeXml(loc));
stringBuilder.append(END_LOC_ELEMENT);
if (!Strings.isEmptyOrNull(lastMod)) {
if (StringUtils.isNotBlank(lastMod)) {
stringBuilder.append(START_LAST_MOD_ELEMENT);
stringBuilder.append(lastMod);
stringBuilder.append(END_LAST_MOD_ELEMENT);
......
......@@ -296,7 +296,7 @@ public class ArticleProcessor {
public void showArticlePwdForm(final HTTPRequestContext context,
final HttpServletRequest request, final HttpServletResponse response) throws Exception {
final String articleId = request.getParameter("articleId");
if (Strings.isEmptyOrNull(articleId)) {
if (StringUtils.isBlank(articleId)) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
......@@ -318,7 +318,7 @@ public class ArticleProcessor {
dataModel.put("articleAbstract", article.optString(Article.ARTICLE_ABSTRACT));
final String msg = request.getParameter(Keys.MSG);
if (!Strings.isEmptyOrNull(msg)) {
if (StringUtils.isNotBlank(msg)) {
dataModel.put(Keys.MSG, langPropsService.get("passwordNotMatchLabel"));
}
......@@ -442,7 +442,7 @@ public class ArticleProcessor {
final String requestURI = request.getRequestURI();
final String articleId = StringUtils.substringBetween(requestURI, "/article/id/", "/relevant/articles");
if (Strings.isEmptyOrNull(articleId)) {
if (StringUtils.isBlank(articleId)) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
......@@ -474,7 +474,7 @@ public class ArticleProcessor {
@RequestProcessing(value = "/get-article-content", method = HTTPRequestMethod.GET)
public void getArticleContent(final HTTPRequestContext context, final HttpServletRequest request) {
final String articleId = request.getParameter("id");
if (Strings.isEmptyOrNull(articleId)) {
if (StringUtils.isBlank(articleId)) {
return;
}
......@@ -999,7 +999,7 @@ public class ArticleProcessor {
article.put(Common.AUTHOR_ID, authorId);
article.put(Common.AUTHOR_ROLE, author.getString(User.USER_ROLE));
final String userAvatar = author.optString(UserExt.USER_AVATAR);
if (!Strings.isEmptyOrNull(userAvatar)) {
if (StringUtils.isNotBlank(userAvatar)) {
article.put(Common.AUTHOR_THUMBNAIL_URL, userAvatar);
} else {
final String thumbnailURL = Thumbnails.getGravatarURL(author.optString(User.USER_EMAIL), "128");
......@@ -1119,7 +1119,7 @@ public class ArticleProcessor {
dataModel.put(Common.AUTHOR_NAME, author.optString(User.USER_NAME));
final String userAvatar = author.optString(UserExt.USER_AVATAR);
if (!Strings.isEmptyOrNull(userAvatar)) {
if (StringUtils.isNotBlank(userAvatar)) {
dataModel.put(Common.AUTHOR_THUMBNAIL_URL, userAvatar);
} else {
final String thumbnailURL = Thumbnails.getGravatarURL(author.optString(User.USER_EMAIL), "128");
......
......@@ -19,6 +19,7 @@ package org.b3log.solo.processor;
import jodd.http.HttpRequest;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.inject.Inject;
......@@ -200,7 +201,7 @@ public class BlogProcessor {
public void getArticlesTags(final HTTPRequestContext context, final HttpServletRequest request, final HttpServletResponse response)
throws Exception {
final String pwd = request.getParameter("pwd");
if (Strings.isEmptyOrNull(pwd)) {
if (StringUtils.isBlank(pwd)) {
response.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
......@@ -253,7 +254,7 @@ public class BlogProcessor {
for (final String tag : tags) {
final String trim = tag.trim();
if (!Strings.isEmptyOrNull(trim)) {
if (StringUtils.isNotBlank(trim)) {
tagArray.put(tag);
}
}
......
......@@ -17,6 +17,7 @@
*/
package org.b3log.solo.processor;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.RandomUtils;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
......@@ -143,7 +144,7 @@ public class CaptchaProcessor {
return false;
}
if (Strings.isEmptyOrNull(captcha) || captcha.length() != CAPTCHA_LENGTH) {
if (StringUtils.isBlank(captcha) || captcha.length() != CAPTCHA_LENGTH) {
return true;
}
......
......@@ -17,6 +17,7 @@
*/
package org.b3log.solo.processor;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.inject.Inject;
......@@ -31,7 +32,6 @@ import org.b3log.latke.servlet.annotation.RequestProcessing;
import org.b3log.latke.servlet.annotation.RequestProcessor;
import org.b3log.latke.servlet.renderer.freemarker.AbstractFreeMarkerRenderer;
import org.b3log.latke.util.Requests;
import org.b3log.latke.util.Strings;
import org.b3log.solo.model.Article;
import org.b3log.solo.model.Category;
import org.b3log.solo.model.Common;
......@@ -116,7 +116,7 @@ public class CategoryProcessor {
* @return page number, returns {@code -1} if the specified request URI can not convert to an number
*/
private static int getCurrentPageNum(final String requestURI, final String categoryURI) {
if (Strings.isEmptyOrNull(categoryURI)) {
if (StringUtils.isBlank(categoryURI)) {
return -1;
}
......
......@@ -17,6 +17,7 @@
*/
package org.b3log.solo.processor;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.inject.Inject;
......@@ -31,7 +32,6 @@ import org.b3log.latke.servlet.annotation.RequestProcessor;
import org.b3log.latke.servlet.renderer.AtomRenderer;
import org.b3log.latke.servlet.renderer.RssRenderer;
import org.b3log.latke.util.Locales;
import org.b3log.latke.util.Strings;
import org.b3log.solo.SoloServletListener;
import org.b3log.solo.model.Article;
import org.b3log.solo.model.Option;
......@@ -219,7 +219,7 @@ public class FeedProcessor {
final HttpServletResponse response = context.getResponse();
final String tagId = request.getParameter(Keys.OBJECT_ID);
if (Strings.isEmptyOrNull(tagId)) {
if (StringUtils.isBlank(tagId)) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
......@@ -270,7 +270,7 @@ public class FeedProcessor {
final JSONObject article = articleRepository.get(articleId);
if (article.getBoolean(Article.ARTICLE_IS_PUBLISHED) // Skips the unpublished article
&& Strings.isEmptyOrNull(article.optString(Article.ARTICLE_VIEW_PWD))) { // Skips article with password
&& StringUtils.isBlank(article.optString(Article.ARTICLE_VIEW_PWD))) { // Skips article with password
articles.add(article);
}
}
......@@ -451,7 +451,7 @@ public class FeedProcessor {
context.setRenderer(renderer);
final String tagId = request.getParameter(Keys.OBJECT_ID);
if (Strings.isEmptyOrNull(tagId)) {
if (StringUtils.isBlank(tagId)) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
......@@ -507,7 +507,7 @@ public class FeedProcessor {
final JSONObject article = articleRepository.get(articleId);
if (article.getBoolean(Article.ARTICLE_IS_PUBLISHED) // Skips the unpublished article
&& Strings.isEmptyOrNull(article.optString(Article.ARTICLE_VIEW_PWD))) { // Skips article with password
&& StringUtils.isBlank(article.optString(Article.ARTICLE_VIEW_PWD))) { // Skips article with password
articles.add(article);
}
}
......
......@@ -17,6 +17,7 @@
*/
package org.b3log.solo.processor;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.inject.Inject;
......@@ -152,7 +153,7 @@ public class InitProcessor {
final String userEmail = requestJSONObject.optString(User.USER_EMAIL);
final String userPassword = requestJSONObject.optString(User.USER_PASSWORD);
if (Strings.isEmptyOrNull(userName) || Strings.isEmptyOrNull(userEmail) || Strings.isEmptyOrNull(userPassword)
if (StringUtils.isBlank(userName) || StringUtils.isBlank(userEmail) || StringUtils.isBlank(userPassword)
|| !Strings.isEmail(userEmail)) {
ret.put(Keys.MSG, "Init failed, please check your input");
......
......@@ -19,6 +19,7 @@ package org.b3log.solo.processor;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.inject.Inject;
......@@ -39,7 +40,6 @@ import org.b3log.latke.servlet.annotation.RequestProcessor;
import org.b3log.latke.servlet.renderer.JSONRenderer;
import org.b3log.latke.servlet.renderer.freemarker.AbstractFreeMarkerRenderer;
import org.b3log.latke.util.Sessions;
import org.b3log.latke.util.Strings;
import org.b3log.solo.SoloServletListener;
import org.b3log.solo.model.Common;
import org.b3log.solo.model.Option;
......@@ -139,7 +139,7 @@ public class LoginProcessor {
final HttpServletRequest request = context.getRequest();
String destinationURL = request.getParameter(Common.GOTO);
if (Strings.isEmptyOrNull(destinationURL)) {
if (StringUtils.isBlank(destinationURL)) {
destinationURL = Latkes.getServePath() + Common.ADMIN_INDEX_URI;
} else if (!isInternalLinks(destinationURL)) {
destinationURL = "/";
......@@ -191,7 +191,7 @@ public class LoginProcessor {
final String userEmail = requestJSONObject.getString(User.USER_EMAIL);
final String userPwd = requestJSONObject.getString(User.USER_PASSWORD);
if (Strings.isEmptyOrNull(userEmail) || Strings.isEmptyOrNull(userPwd)) {
if (StringUtils.isBlank(userEmail) || StringUtils.isBlank(userPwd)) {
return;
}
......@@ -238,7 +238,7 @@ public class LoginProcessor {
Sessions.logout(httpServletRequest, context.getResponse());
String destinationURL = httpServletRequest.getParameter(Common.GOTO);
if (Strings.isEmptyOrNull(destinationURL) || !isInternalLinks(destinationURL)) {
if (StringUtils.isBlank(destinationURL) || !isInternalLinks(destinationURL)) {
destinationURL = "/";
}
......@@ -256,7 +256,7 @@ public class LoginProcessor {
final HttpServletRequest request = context.getRequest();
String destinationURL = request.getParameter(Common.GOTO);
if (Strings.isEmptyOrNull(destinationURL)) {
if (StringUtils.isBlank(destinationURL)) {
destinationURL = Latkes.getServePath() + Common.ADMIN_INDEX_URI;
} else if (!isInternalLinks(destinationURL)) {
destinationURL = "/";
......@@ -293,7 +293,7 @@ public class LoginProcessor {
final String userEmail = requestJSONObject.getString(User.USER_EMAIL);
if (Strings.isEmptyOrNull(userEmail)) {
if (StringUtils.isBlank(userEmail)) {
LOGGER.log(Level.WARN, "Why user's email is empty");
return;
}
......
......@@ -17,6 +17,7 @@
*/
package org.b3log.solo.processor;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.inject.Inject;
......@@ -32,7 +33,6 @@ import org.b3log.latke.servlet.annotation.RequestProcessor;
import org.b3log.latke.servlet.renderer.freemarker.AbstractFreeMarkerRenderer;
import org.b3log.latke.util.Paginator;
import org.b3log.latke.util.Requests;
import org.b3log.latke.util.Strings;
import org.b3log.solo.model.Article;
import org.b3log.solo.model.Common;
import org.b3log.solo.model.Option;
......@@ -263,7 +263,7 @@ public class TagProcessor {
* @return page number, returns {@code -1} if the specified request URI can not convert to an number
*/
private static int getCurrentPageNum(final String requestURI, final String tagTitle) {
if (Strings.isEmptyOrNull(tagTitle)) {
if (StringUtils.isBlank(tagTitle)) {
return -1;
}
......
......@@ -162,7 +162,7 @@ public class AdminConsole {
final String email = currentUser.optString(User.USER_EMAIL);
final String userAvatar = currentUser.optString(UserExt.USER_AVATAR);
if (!Strings.isEmptyOrNull(userAvatar)) {
if (StringUtils.isNotBlank(userAvatar)) {
dataModel.put(Common.GRAVATAR, userAvatar);
} else {
final String gravatar = Thumbnails.getGravatarURL(email, "128");
......@@ -536,8 +536,8 @@ public class AdminConsole {
data.setViewName(hostTemplateName);
data.setDataModel(dataModel);
eventManager.fireEventSynchronously(new Event<ViewLoadEventData>(Keys.FREEMARKER_ACTION, data));
if (Strings.isEmptyOrNull((String) dataModel.get(Plugin.PLUGINS))) {
eventManager.fireEventSynchronously(new Event<>(Keys.FREEMARKER_ACTION, data));
if (StringUtils.isBlank((String) dataModel.get(Plugin.PLUGINS))) {
// There is no plugin for this template, fill ${plugins} with blank.
dataModel.put(Plugin.PLUGINS, "");
}
......
......@@ -165,7 +165,7 @@ public class ArticleConsole {
result.put(Keys.STATUS_CODE, true);
final String markdownText = request.getParameter("markdownText");
if (Strings.isEmptyOrNull(markdownText)) {
if (StringUtils.isBlank(markdownText)) {
result.put("html", "");
return;
......
......@@ -18,6 +18,7 @@
package org.b3log.solo.processor.util;
import freemarker.template.Template;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
......@@ -35,7 +36,10 @@ import org.b3log.latke.repository.*;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.util.*;
import org.b3log.latke.util.Dates;
import org.b3log.latke.util.Locales;
import org.b3log.latke.util.Paginator;
import org.b3log.latke.util.Stopwatchs;
import org.b3log.latke.util.freemarker.Templates;
import org.b3log.solo.SoloServletListener;
import org.b3log.solo.model.*;
......@@ -548,7 +552,7 @@ public class Filler {
final String email = comment.optString(Comment.COMMENT_EMAIL);
final String thumbnailURL = comment.optString(Comment.COMMENT_THUMBNAIL_URL);
if (Strings.isEmptyOrNull(thumbnailURL)) {
if (StringUtils.isBlank(thumbnailURL)) {
comment.put(Comment.COMMENT_THUMBNAIL_URL, Thumbnails.getGravatarURL(email, "128"));
}
}
......@@ -602,7 +606,7 @@ public class Filler {
final JSONObject currentUser = userQueryService.getCurrentUser(request);
if (null != currentUser) {
final String userAvatar = currentUser.optString(UserExt.USER_AVATAR);
if (!Strings.isEmptyOrNull(userAvatar)) {
if (StringUtils.isNotBlank(userAvatar)) {
dataModel.put(Common.GRAVATAR, userAvatar);
} else {
final String email = currentUser.optString(User.USER_EMAIL);
......@@ -620,7 +624,7 @@ public class Filler {
data.setViewName("footer.ftl");
data.setDataModel(dataModel);
eventManager.fireEventSynchronously(new Event<ViewLoadEventData>(Keys.FREEMARKER_ACTION, data));
if (Strings.isEmptyOrNull((String) dataModel.get(Plugin.PLUGINS))) {
if (StringUtils.isBlank((String) dataModel.get(Plugin.PLUGINS))) {
// There is no plugin for this template, fill ${plugins} with blank.
dataModel.put(Plugin.PLUGINS, "");
}
......@@ -665,13 +669,13 @@ public class Filler {
dataModel.put(Option.ID_C_HTML_HEAD, preference.getString(Option.ID_C_HTML_HEAD));
String metaKeywords = preference.getString(Option.ID_C_META_KEYWORDS);
if (Strings.isEmptyOrNull(metaKeywords)) {
if (StringUtils.isBlank(metaKeywords)) {
metaKeywords = "";
}
dataModel.put(Option.ID_C_META_KEYWORDS, metaKeywords);
String metaDescription = preference.getString(Option.ID_C_META_DESCRIPTION);
if (Strings.isEmptyOrNull(metaDescription)) {
if (StringUtils.isBlank(metaDescription)) {
metaDescription = "";
}
dataModel.put(Option.ID_C_META_DESCRIPTION, metaDescription);
......@@ -922,7 +926,7 @@ public class Filler {
article.put(Common.AUTHOR_ID, authorId);
final String userAvatar = author.optString(UserExt.USER_AVATAR);
if (!Strings.isEmptyOrNull(userAvatar)) {
if (StringUtils.isNotBlank(userAvatar)) {
article.put(Common.AUTHOR_THUMBNAIL_URL, userAvatar);
} else {
final String thumbnailURL = Thumbnails.getGravatarURL(author.optString(User.USER_EMAIL), "128");
......@@ -982,7 +986,7 @@ public class Filler {
article.put(Common.AUTHOR_ID, authorId);
final String userAvatar = author.optString(UserExt.USER_AVATAR);
if (!Strings.isEmptyOrNull(userAvatar)) {
if (StringUtils.isNotBlank(userAvatar)) {
article.put(Common.AUTHOR_THUMBNAIL_URL, userAvatar);
} else {
final String thumbnailURL = Thumbnails.getGravatarURL(author.optString(User.USER_EMAIL), "128");
......
......@@ -34,7 +34,6 @@ import org.b3log.latke.service.ServiceException;
import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.util.CollectionUtils;
import org.b3log.latke.util.Ids;
import org.b3log.latke.util.Strings;
import org.b3log.solo.event.EventTypes;
import org.b3log.solo.model.*;
import org.b3log.solo.repository.*;
......@@ -468,7 +467,7 @@ public class ArticleMgmtService {
public String addArticleInternal(final JSONObject article) throws ServiceException {
String ret = article.optString(Keys.OBJECT_ID);
if (Strings.isEmptyOrNull(ret)) {
if (StringUtils.isBlank(ret)) {
ret = Ids.genTimeMillisId();
article.put(Keys.OBJECT_ID, ret);
}
......@@ -771,10 +770,10 @@ public class ArticleMgmtService {
comment.put(Comment.COMMENT_SHARP_URL, sharpURL);
if (Strings.isEmptyOrNull(comment.optString(Comment.COMMENT_ORIGINAL_COMMENT_ID))) {
if (StringUtils.isBlank(comment.optString(Comment.COMMENT_ORIGINAL_COMMENT_ID))) {
comment.put(Comment.COMMENT_ORIGINAL_COMMENT_ID, "");
}
if (Strings.isEmptyOrNull(comment.optString(Comment.COMMENT_ORIGINAL_COMMENT_NAME))) {
if (StringUtils.isBlank(comment.optString(Comment.COMMENT_ORIGINAL_COMMENT_NAME))) {
comment.put(Comment.COMMENT_ORIGINAL_COMMENT_NAME, "");
}
......@@ -1117,7 +1116,7 @@ public class ArticleMgmtService {
String ret = article.optString(Article.ARTICLE_PERMALINK);
if (Strings.isEmptyOrNull(ret)) {
if (StringUtils.isBlank(ret)) {
ret = "/articles/" + DateFormatUtils.format(date, "yyyy/MM/dd") + "/" + article.optString(Keys.OBJECT_ID) + ".html";
}
......@@ -1153,7 +1152,7 @@ public class ArticleMgmtService {
final String oldPermalink = oldArticle.getString(ARTICLE_PERMALINK);
if (!oldPermalink.equals(ret)) {
if (Strings.isEmptyOrNull(ret)) {
if (StringUtils.isBlank(ret)) {
ret = "/articles/" + DateFormatUtils.format(createDate, "yyyy/MM/dd") + "/" + articleId + ".html";
}
......
......@@ -32,7 +32,6 @@ import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.util.CollectionUtils;
import org.b3log.latke.util.Paginator;
import org.b3log.latke.util.Stopwatchs;
import org.b3log.latke.util.Strings;
import org.b3log.solo.model.*;
import org.b3log.solo.repository.*;
import org.b3log.solo.util.Emotions;
......@@ -262,7 +261,7 @@ public class ArticleQueryService {
* @throws Exception exception
*/
public boolean canAccessArticle(final String articleId, final HttpServletRequest request) throws Exception {
if (Strings.isEmptyOrNull(articleId)) {
if (StringUtils.isBlank(articleId)) {
return false;
}
......@@ -292,7 +291,7 @@ public class ArticleQueryService {
public boolean needViewPwd(final HttpServletRequest request, final JSONObject article) {
final String articleViewPwd = article.optString(Article.ARTICLE_VIEW_PWD);
if (Strings.isEmptyOrNull(articleViewPwd)) {
if (StringUtils.isBlank(articleViewPwd)) {
return false;
}
......@@ -1030,7 +1029,7 @@ public class ArticleQueryService {
* @throws ServiceException service exception
*/
public String getArticleContent(final HttpServletRequest request, final String articleId) throws ServiceException {
if (Strings.isEmptyOrNull(articleId)) {
if (StringUtils.isBlank(articleId)) {
return null;
}
......@@ -1094,7 +1093,7 @@ public class ArticleQueryService {
String abstractContent = article.optString(ARTICLE_ABSTRACT);
if (!Strings.isEmptyOrNull(abstractContent)) {
if (StringUtils.isNotBlank(abstractContent)) {
Stopwatchs.start("Abstract");
abstractContent = Emotions.convert(abstractContent);
abstractContent = Markdowns.toHTML(abstractContent);
......
......@@ -207,7 +207,7 @@ public class CommentMgmtService {
final String blogTitle = preference.getString(Option.ID_C_BLOG_TITLE);
boolean isArticle = true;
String title = articleOrPage.optString(Article.ARTICLE_TITLE);
if (Strings.isEmptyOrNull(title)) {
if (StringUtils.isBlank(title)) {
title = articleOrPage.getString(Page.PAGE_TITLE);
isArticle = false;
}
......@@ -433,7 +433,7 @@ public class CommentMgmtService {
ret.put(Common.COMMENTABLE, preference.getBoolean(Option.ID_C_COMMENTABLE) && page.getBoolean(Page.PAGE_COMMENTABLE));
ret.put(Common.PERMALINK, page.getString(Page.PAGE_PERMALINK));
if (!Strings.isEmptyOrNull(originalCommentId)) {
if (StringUtils.isNotBlank(originalCommentId)) {
originalComment = commentRepository.get(originalCommentId);
if (null != originalComment) {
comment.put(Comment.COMMENT_ORIGINAL_COMMENT_ID, originalCommentId);
......@@ -576,7 +576,7 @@ public class CommentMgmtService {
ret.put(Comment.COMMENT_CONTENT, cmtContent);
ret.put(Comment.COMMENT_URL, commentURL);
if (!Strings.isEmptyOrNull(originalCommentId)) {
if (StringUtils.isNotBlank(originalCommentId)) {
originalComment = commentRepository.get(originalCommentId);
if (null != originalComment) {
comment.put(Comment.COMMENT_ORIGINAL_COMMENT_ID, originalCommentId);
......@@ -773,7 +773,7 @@ public class CommentMgmtService {
final JSONObject user = userRepository.getByEmail(commentEmail);
if (null != user) {
final String avatar = user.optString(UserExt.USER_AVATAR);
if (!Strings.isEmptyOrNull(avatar)) {
if (StringUtils.isNotBlank(avatar)) {
comment.put(Comment.COMMENT_THUMBNAIL_URL, avatar);
return;
......
......@@ -29,7 +29,6 @@ import org.b3log.latke.repository.SortDirection;
import org.b3log.latke.service.ServiceException;
import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.util.Paginator;
import org.b3log.latke.util.Strings;
import org.b3log.solo.model.Article;
import org.b3log.solo.model.Comment;
import org.b3log.solo.model.Common;
......@@ -98,7 +97,7 @@ public class CommentQueryService {
* @throws Exception exception
*/
public boolean canAccessComment(final String commentId, final HttpServletRequest request) throws Exception {
if (Strings.isEmptyOrNull(commentId)) {
if (StringUtils.isBlank(commentId)) {
return false;
}
......@@ -246,11 +245,11 @@ public class CommentQueryService {
final String email = comment.optString(Comment.COMMENT_EMAIL);
final String thumbnailURL = comment.optString(Comment.COMMENT_THUMBNAIL_URL);
if (Strings.isEmptyOrNull(thumbnailURL)) {
if (StringUtils.isBlank(thumbnailURL)) {
comment.put(Comment.COMMENT_THUMBNAIL_URL, Thumbnails.getGravatarURL(email, "128"));
}
if (!Strings.isEmptyOrNull(comment.optString(Comment.COMMENT_ORIGINAL_COMMENT_ID))) {
if (StringUtils.isNotBlank(comment.optString(Comment.COMMENT_ORIGINAL_COMMENT_ID))) {
// This comment is a reply
comment.put(Common.IS_REPLY, true);
}
......
......@@ -18,12 +18,12 @@
package org.b3log.solo.service;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.inject.Inject;
import org.b3log.latke.repository.Transaction;
import org.b3log.latke.service.ServiceException;
import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.util.Strings;
import org.b3log.solo.model.Option;
import org.b3log.solo.repository.OptionRepository;
import org.json.JSONObject;
......@@ -58,7 +58,7 @@ public class OptionMgmtService {
try {
String id = option.optString(Keys.OBJECT_ID);
if (Strings.isEmptyOrNull(id)) {
if (StringUtils.isBlank(id)) {
id = optionRepository.add(option);
} else {
final JSONObject old = optionRepository.get(id);
......
......@@ -17,6 +17,7 @@
*/
package org.b3log.solo.service;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.ioc.inject.Inject;
import org.b3log.latke.logging.Level;
......@@ -27,7 +28,6 @@ import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException;
import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.util.Ids;
import org.b3log.latke.util.Strings;
import org.b3log.solo.model.Comment;
import org.b3log.solo.model.Option;
import org.b3log.solo.model.Page;
......@@ -134,7 +134,7 @@ public class PageMgmtService {
final String oldPermalink = oldPage.getString(Page.PAGE_PERMALINK);
if (!oldPermalink.equals(permalink)) {
if (Strings.isEmptyOrNull(permalink)) {
if (StringUtils.isBlank(permalink)) {
permalink = "/pages/" + pageId + ".html";
}
......@@ -247,7 +247,7 @@ public class PageMgmtService {
page.put(Page.PAGE_ORDER, maxOrder + 1);
String permalink = page.optString(Page.PAGE_PERMALINK);
if (Strings.isEmptyOrNull(permalink)) {
if (StringUtils.isBlank(permalink)) {
permalink = "/pages/" + Ids.genTimeMillisId() + ".html";
}
......@@ -397,10 +397,10 @@ public class PageMgmtService {
comment.put(Comment.COMMENT_SHARP_URL, sharpURL);
if (Strings.isEmptyOrNull(comment.optString(Comment.COMMENT_ORIGINAL_COMMENT_ID))) {
if (StringUtils.isBlank(comment.optString(Comment.COMMENT_ORIGINAL_COMMENT_ID))) {
comment.put(Comment.COMMENT_ORIGINAL_COMMENT_ID, "");
}
if (Strings.isEmptyOrNull(comment.optString(Comment.COMMENT_ORIGINAL_COMMENT_NAME))) {
if (StringUtils.isBlank(comment.optString(Comment.COMMENT_ORIGINAL_COMMENT_NAME))) {
comment.put(Comment.COMMENT_ORIGINAL_COMMENT_NAME, "");
}
......
......@@ -17,6 +17,7 @@
*/
package org.b3log.solo.service;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.inject.Inject;
import org.b3log.latke.logging.Level;
......@@ -114,7 +115,7 @@ public class PermalinkQueryService {
* @return {@code true} if invalid, returns {@code false} otherwise
*/
public static boolean invalidArticlePermalinkFormat(final String permalink) {
if (Strings.isEmptyOrNull(permalink)) {
if (StringUtils.isBlank(permalink)) {
return true;
}
......@@ -132,7 +133,7 @@ public class PermalinkQueryService {
* @return {@code true} if invalid, returns {@code false} otherwise
*/
public static boolean invalidPagePermalinkFormat(final String permalink) {
if (Strings.isEmptyOrNull(permalink)) {
if (StringUtils.isBlank(permalink)) {
return true;
}
......@@ -150,7 +151,7 @@ public class PermalinkQueryService {
* @return {@code true} if invalid, returns {@code false} otherwise
*/
private static boolean invalidUserDefinedPermalinkFormat(final String permalink) {
if (Strings.isEmptyOrNull(permalink)) {
if (StringUtils.isBlank(permalink)) {
return true;
}
......
......@@ -102,7 +102,7 @@ public class UserMgmtService {
final JSONObject cookieJSONObject = new JSONObject(value);
final String userId = cookieJSONObject.optString(Keys.OBJECT_ID);
if (Strings.isEmptyOrNull(userId)) {
if (StringUtils.isBlank(userId)) {
break;
}
......@@ -193,12 +193,12 @@ public class UserMgmtService {
}
final String userRole = requestJSONObject.optString(User.USER_ROLE);
if (!Strings.isEmptyOrNull(userRole)) {
if (StringUtils.isNotBlank(userRole)) {
oldUser.put(User.USER_ROLE, userRole);
}
final String userURL = requestJSONObject.optString(User.USER_URL);
if (!Strings.isEmptyOrNull(userURL)) {
if (StringUtils.isNotBlank(userURL)) {
oldUser.put(User.USER_URL, userURL);
}
......@@ -303,7 +303,7 @@ public class UserMgmtService {
user.put(User.USER_PASSWORD, DigestUtils.md5Hex(userPassword));
String userURL = requestJSONObject.optString(User.USER_URL);
if (Strings.isEmptyOrNull(userURL)) {
if (StringUtils.isBlank(userURL)) {
userURL = Latkes.getServePath();
}
......@@ -320,7 +320,7 @@ public class UserMgmtService {
user.put(UserExt.USER_PUBLISHED_ARTICLE_COUNT, 0);
String userAvatar = requestJSONObject.optString(UserExt.USER_AVATAR);
if (Strings.isEmptyOrNull(userAvatar)) {
if (StringUtils.isBlank(userAvatar)) {
userAvatar = Thumbnails.getGravatarURL(userEmail, "128");
}
user.put(UserExt.USER_AVATAR, userAvatar);
......
......@@ -34,7 +34,6 @@ import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.LangPropsServiceImpl;
import org.b3log.latke.util.Callstacks;
import org.b3log.latke.util.Stopwatchs;
import org.b3log.latke.util.Strings;
import org.json.JSONObject;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
......@@ -154,7 +153,7 @@ public final class Markdowns {
* 'markdownErrorLabel' if exception
*/
public static String toHTML(final String markdownText) {
if (Strings.isEmptyOrNull(markdownText)) {
if (StringUtils.isBlank(markdownText)) {
return "";
}
......
......@@ -18,6 +18,7 @@
package org.b3log.solo.util;
import freemarker.template.TemplateExceptionHandler;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.LatkeBeanManager;
......@@ -30,7 +31,6 @@ import org.b3log.latke.service.ServiceException;
import org.b3log.latke.util.Locales;
import org.b3log.latke.util.Requests;
import org.b3log.latke.util.Stopwatchs;
import org.b3log.latke.util.Strings;
import org.b3log.latke.util.freemarker.Templates;
import org.b3log.solo.SoloServletListener;
import org.b3log.solo.model.Skin;
......@@ -192,7 +192,7 @@ public final class Skins {
return "default";
}
if (!Strings.isEmptyOrNull(specifiedSkin)) {
if (StringUtils.isNotBlank(specifiedSkin)) {
final Set<String> skinDirNames = Skins.getSkinDirNames();
if (skinDirNames.contains(specifiedSkin)) {
return specifiedSkin;
......
Subproject commit b2fa8216a0a233e29677c9cb0617982c60dc4825
Subproject commit 8865ba8c87f18aa87dbaa669ecaac5a4c3821ec6
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment