Commit d53f194c authored by Liang Ding's avatar Liang Ding

🎨 Format code

parent c665ffbd
...@@ -85,7 +85,7 @@ public final class Server extends BaseServer { ...@@ -85,7 +85,7 @@ public final class Server extends BaseServer {
public static class TailStringWriter extends StringWriter { public static class TailStringWriter extends StringWriter {
private AtomicInteger count = new AtomicInteger(); private final AtomicInteger count = new AtomicInteger();
@Override @Override
public void flush() { public void flush() {
...@@ -153,13 +153,11 @@ public final class Server extends BaseServer { ...@@ -153,13 +153,11 @@ public final class Server extends BaseServer {
commandLine = commandLineParser.parse(options, args); commandLine = commandLineParser.parse(options, args);
} catch (final ParseException e) { } catch (final ParseException e) {
helpFormatter.printHelp(cmdSyntax, header, options, footer, true); helpFormatter.printHelp(cmdSyntax, header, options, footer, true);
return; return;
} }
if (commandLine.hasOption("h")) { if (commandLine.hasOption("h")) {
helpFormatter.printHelp(cmdSyntax, header, options, footer, true); helpFormatter.printHelp(cmdSyntax, header, options, footer, true);
return; return;
} }
......
...@@ -73,19 +73,16 @@ public class B3ArticleSender extends AbstractEventListener<JSONObject> { ...@@ -73,19 +73,16 @@ public class B3ArticleSender extends AbstractEventListener<JSONObject> {
final String title = originalArticle.getString(Article.ARTICLE_TITLE); final String title = originalArticle.getString(Article.ARTICLE_TITLE);
if (Article.ARTICLE_STATUS_C_PUBLISHED != originalArticle.optInt(Article.ARTICLE_STATUS)) { if (Article.ARTICLE_STATUS_C_PUBLISHED != originalArticle.optInt(Article.ARTICLE_STATUS)) {
LOGGER.log(Level.INFO, "Ignored push a draft [title={}] to Rhy", title); LOGGER.log(Level.INFO, "Ignored push a draft [title={}] to Rhy", title);
return; return;
} }
if (StringUtils.isNotBlank(originalArticle.optString(Article.ARTICLE_VIEW_PWD))) { if (StringUtils.isNotBlank(originalArticle.optString(Article.ARTICLE_VIEW_PWD))) {
LOGGER.log(Level.INFO, "Article [title={}] is a password article, ignored push to Rhy", title); LOGGER.log(Level.INFO, "Article [title={}] is a password article, ignored push to Rhy", title);
return; return;
} }
if (!originalArticle.optBoolean(Common.POST_TO_COMMUNITY)) { if (!originalArticle.optBoolean(Common.POST_TO_COMMUNITY)) {
LOGGER.log(Level.INFO, "Article [title={}] push flag [postToCommunity] is [false], ignored push to Rhy", title); LOGGER.log(Level.INFO, "Article [title={}] push flag [postToCommunity] is [false], ignored push to Rhy", title);
return; return;
} }
......
...@@ -153,7 +153,7 @@ public final class Entry { ...@@ -153,7 +153,7 @@ public final class Entry {
/** /**
* Categories. * Categories.
*/ */
private Set<Category> categories = new HashSet<Category>(); private final Set<Category> categories = new HashSet<Category>();
/** /**
* Gets the URI. * Gets the URI.
......
...@@ -157,7 +157,7 @@ public final class Feed { ...@@ -157,7 +157,7 @@ public final class Feed {
/** /**
* Entries. * Entries.
*/ */
private List<Entry> entries = new ArrayList<>(); private final List<Entry> entries = new ArrayList<>();
/** /**
* Gets the id. * Gets the id.
......
...@@ -153,7 +153,7 @@ public final class Channel { ...@@ -153,7 +153,7 @@ public final class Channel {
/** /**
* Items. * Items.
*/ */
private List<Item> items = new ArrayList<>(); private final List<Item> items = new ArrayList<>();
/** /**
* Gets the atom link. * Gets the atom link.
......
...@@ -71,7 +71,7 @@ public final class Item { ...@@ -71,7 +71,7 @@ public final class Item {
/** /**
* Categories. * Categories.
*/ */
private Set<Category> categories = new HashSet<>(); private final Set<Category> categories = new HashSet<>();
/** /**
* Start guid element. * Start guid element.
......
...@@ -49,7 +49,7 @@ public final class Sitemap { ...@@ -49,7 +49,7 @@ public final class Sitemap {
/** /**
* URLs. * URLs.
*/ */
private List<URL> urls = new ArrayList<>(); private final List<URL> urls = new ArrayList<>();
/** /**
* Adds the specified url. * Adds the specified url.
......
...@@ -41,7 +41,7 @@ import java.util.Map; ...@@ -41,7 +41,7 @@ import java.util.Map;
*/ */
public class ToCPlugin extends NotInteractivePlugin { public class ToCPlugin extends NotInteractivePlugin {
private ToCEventHandler handler = new ToCEventHandler(); private final ToCEventHandler handler = new ToCEventHandler();
@Override @Override
public void changeStatus() { public void changeStatus() {
......
...@@ -143,14 +143,12 @@ public class ArticleProcessor { ...@@ -143,14 +143,12 @@ public class ArticleProcessor {
final String markdownText = context.requestJSON().optString("markdownText"); final String markdownText = context.requestJSON().optString("markdownText");
if (StringUtils.isBlank(markdownText)) { if (StringUtils.isBlank(markdownText)) {
result.put(Common.DATA, ""); result.put(Common.DATA, "");
return; return;
} }
if (!Solos.isLoggedIn(context)) { if (!Solos.isLoggedIn(context)) {
result.put(Keys.CODE, -1); result.put(Keys.CODE, -1);
result.put(Keys.MSG, langPropsService.get("getFailLabel")); result.put(Keys.MSG, langPropsService.get("getFailLabel"));
return; return;
} }
...@@ -173,14 +171,12 @@ public class ArticleProcessor { ...@@ -173,14 +171,12 @@ public class ArticleProcessor {
final String articleId = context.param("articleId"); final String articleId = context.param("articleId");
if (StringUtils.isBlank(articleId)) { if (StringUtils.isBlank(articleId)) {
context.sendError(404); context.sendError(404);
return; return;
} }
final JSONObject article = articleQueryService.getArticleById(articleId); final JSONObject article = articleQueryService.getArticleById(articleId);
if (null == article) { if (null == article) {
context.sendError(404); context.sendError(404);
return; return;
} }
...@@ -238,7 +234,6 @@ public class ArticleProcessor { ...@@ -238,7 +234,6 @@ public class ArticleProcessor {
} }
context.sendRedirect(Latkes.getServePath() + article.getString(Article.ARTICLE_PERMALINK)); context.sendRedirect(Latkes.getServePath() + article.getString(Article.ARTICLE_PERMALINK));
return; return;
} }
...@@ -266,7 +261,6 @@ public class ArticleProcessor { ...@@ -266,7 +261,6 @@ public class ArticleProcessor {
final JsonRenderer renderer = new JsonRenderer(); final JsonRenderer renderer = new JsonRenderer();
context.setRenderer(renderer); context.setRenderer(renderer);
renderer.setJSONObject(jsonObject); renderer.setJSONObject(jsonObject);
return; return;
} }
...@@ -299,7 +293,6 @@ public class ArticleProcessor { ...@@ -299,7 +293,6 @@ public class ArticleProcessor {
final JsonRenderer renderer = new JsonRenderer(); final JsonRenderer renderer = new JsonRenderer();
context.setRenderer(renderer); context.setRenderer(renderer);
renderer.setJSONObject(jsonObject); renderer.setJSONObject(jsonObject);
return; return;
} }
...@@ -308,14 +301,12 @@ public class ArticleProcessor { ...@@ -308,14 +301,12 @@ public class ArticleProcessor {
final String articleId = context.pathVar("id"); final String articleId = context.pathVar("id");
if (StringUtils.isBlank(articleId)) { if (StringUtils.isBlank(articleId)) {
context.sendError(404); context.sendError(404);
return; return;
} }
final JSONObject article = articleQueryService.getArticleById(articleId); final JSONObject article = articleQueryService.getArticleById(articleId);
if (null == article) { if (null == article) {
context.sendError(404); context.sendError(404);
return; return;
} }
...@@ -524,7 +515,6 @@ public class ArticleProcessor { ...@@ -524,7 +515,6 @@ public class ArticleProcessor {
final JSONObject authorRet = userQueryService.getUser(authorId); final JSONObject authorRet = userQueryService.getUser(authorId);
if (null == authorRet) { if (null == authorRet) {
context.sendError(404); context.sendError(404);
return; return;
} }
...@@ -568,7 +558,6 @@ public class ArticleProcessor { ...@@ -568,7 +558,6 @@ public class ArticleProcessor {
final JSONObject preference = optionQueryService.getPreference(); final JSONObject preference = optionQueryService.getPreference();
if (null == preference) { if (null == preference) {
context.sendError(404); context.sendError(404);
return; return;
} }
...@@ -578,14 +567,12 @@ public class ArticleProcessor { ...@@ -578,14 +567,12 @@ public class ArticleProcessor {
final JSONObject result = userQueryService.getUser(authorId); final JSONObject result = userQueryService.getUser(authorId);
if (null == result) { if (null == result) {
context.sendError(404); context.sendError(404);
return; return;
} }
final JSONObject articlesResult = articleQueryService.getArticlesByAuthorId(authorId, currentPageNum, pageSize); final JSONObject articlesResult = articleQueryService.getArticlesByAuthorId(authorId, currentPageNum, pageSize);
if (null == articlesResult) { if (null == articlesResult) {
context.sendError(404); context.sendError(404);
return; return;
} }
...@@ -626,7 +613,6 @@ public class ArticleProcessor { ...@@ -626,7 +613,6 @@ public class ArticleProcessor {
if (null == result) { if (null == result) {
LOGGER.log(Level.DEBUG, "Can not find articles for the specified archive date[string={}]", archiveDateString); LOGGER.log(Level.DEBUG, "Can not find articles for the specified archive date[string={}]", archiveDateString);
context.sendError(404); context.sendError(404);
return; return;
} }
...@@ -642,7 +628,6 @@ public class ArticleProcessor { ...@@ -642,7 +628,6 @@ public class ArticleProcessor {
final List<JSONObject> articles = articleQueryService.getArticlesByArchiveDate(archiveDateId, currentPageNum, pageSize); final List<JSONObject> articles = articleQueryService.getArticlesByArchiveDate(archiveDateId, currentPageNum, pageSize);
if (articles.isEmpty()) { if (articles.isEmpty()) {
context.sendError(404); context.sendError(404);
return; return;
} }
...@@ -671,7 +656,6 @@ public class ArticleProcessor { ...@@ -671,7 +656,6 @@ public class ArticleProcessor {
final JSONObject article = (JSONObject) context.attr(Article.ARTICLE); final JSONObject article = (JSONObject) context.attr(Article.ARTICLE);
if (null == article) { if (null == article) {
context.sendError(404); context.sendError(404);
return; return;
} }
......
...@@ -139,7 +139,6 @@ public class B3Receiver { ...@@ -139,7 +139,6 @@ public class B3Receiver {
final String msg = "Not found client"; final String msg = "Not found client";
ret.put(Keys.MSG, msg); ret.put(Keys.MSG, msg);
LOGGER.log(Level.WARN, msg); LOGGER.log(Level.WARN, msg);
return; return;
} }
...@@ -151,7 +150,6 @@ public class B3Receiver { ...@@ -151,7 +150,6 @@ public class B3Receiver {
final String msg = "Not found user [" + articleAuthorName + "]"; final String msg = "Not found user [" + articleAuthorName + "]";
ret.put(Keys.MSG, msg); ret.put(Keys.MSG, msg);
LOGGER.log(Level.WARN, msg); LOGGER.log(Level.WARN, msg);
return; return;
} }
...@@ -162,7 +160,6 @@ public class B3Receiver { ...@@ -162,7 +160,6 @@ public class B3Receiver {
final String msg = "Wrong key"; final String msg = "Wrong key";
ret.put(Keys.MSG, msg); ret.put(Keys.MSG, msg);
LOGGER.log(Level.WARN, msg); LOGGER.log(Level.WARN, msg);
return; return;
} }
...@@ -172,7 +169,6 @@ public class B3Receiver { ...@@ -172,7 +169,6 @@ public class B3Receiver {
final String msg = "Not found article"; final String msg = "Not found article";
ret.put(Keys.MSG, msg); ret.put(Keys.MSG, msg);
LOGGER.log(Level.WARN, msg); LOGGER.log(Level.WARN, msg);
return; return;
} }
...@@ -197,7 +193,6 @@ public class B3Receiver { ...@@ -197,7 +193,6 @@ public class B3Receiver {
final JSONObject addRequest = new JSONObject().put(Article.ARTICLE, article); final JSONObject addRequest = new JSONObject().put(Article.ARTICLE, article);
articleMgmtService.addArticle(addRequest); articleMgmtService.addArticle(addRequest);
LOGGER.log(Level.INFO, "Added an article [" + title + "] via Sym"); LOGGER.log(Level.INFO, "Added an article [" + title + "] via Sym");
return; return;
} }
......
...@@ -36,7 +36,6 @@ public class BeforeRequestHandler implements Handler { ...@@ -36,7 +36,6 @@ public class BeforeRequestHandler implements Handler {
context.setHeader("Retry-After", "600"); context.setHeader("Retry-After", "600");
context.sendString("Too Many Requests"); context.sendString("Too Many Requests");
context.abort(); context.abort();
return; return;
} }
......
...@@ -106,7 +106,6 @@ public class CategoryProcessor { ...@@ -106,7 +106,6 @@ public class CategoryProcessor {
final JSONObject category = categoryQueryService.getByURI(categoryURI); final JSONObject category = categoryQueryService.getByURI(categoryURI);
if (null == category) { if (null == category) {
context.sendError(404); context.sendError(404);
return; return;
} }
...@@ -155,7 +154,6 @@ public class CategoryProcessor { ...@@ -155,7 +154,6 @@ public class CategoryProcessor {
final JSONObject category = categoryQueryService.getByURI(categoryURI); final JSONObject category = categoryQueryService.getByURI(categoryURI);
if (null == category) { if (null == category) {
context.sendError(404); context.sendError(404);
return; return;
} }
...@@ -171,7 +169,6 @@ public class CategoryProcessor { ...@@ -171,7 +169,6 @@ public class CategoryProcessor {
final int pageCount = result.optJSONObject(Pagination.PAGINATION).optInt(Pagination.PAGINATION_PAGE_COUNT); final int pageCount = result.optJSONObject(Pagination.PAGINATION).optInt(Pagination.PAGINATION_PAGE_COUNT);
if (0 == pageCount) { if (0 == pageCount) {
context.sendError(404); context.sendError(404);
return; return;
} }
......
...@@ -136,7 +136,6 @@ public class CommentProcessor { ...@@ -136,7 +136,6 @@ public class CommentProcessor {
if (!Solos.isLoggedIn(context)) { if (!Solos.isLoggedIn(context)) {
jsonObject.put(Keys.STATUS_CODE, false); jsonObject.put(Keys.STATUS_CODE, false);
jsonObject.put(Keys.MSG, "Need login"); jsonObject.put(Keys.MSG, "Need login");
return; return;
} }
......
...@@ -167,7 +167,6 @@ public class FeedProcessor { ...@@ -167,7 +167,6 @@ public class FeedProcessor {
final JSONObject preference = optionQueryService.getPreference(); final JSONObject preference = optionQueryService.getPreference();
if (null == preference) { if (null == preference) {
context.sendError(404); context.sendError(404);
return; return;
} }
......
...@@ -72,7 +72,6 @@ public class FetchUploadProcessor { ...@@ -72,7 +72,6 @@ public class FetchUploadProcessor {
final String msg = "Gets upload token failed"; final String msg = "Gets upload token failed";
LOGGER.log(Level.ERROR, msg); LOGGER.log(Level.ERROR, msg);
result.put(Keys.MSG, msg); result.put(Keys.MSG, msg);
return; return;
} }
...@@ -93,7 +92,6 @@ public class FetchUploadProcessor { ...@@ -93,7 +92,6 @@ public class FetchUploadProcessor {
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, "Fetch file [url=" + originalURL + "] failed", e); LOGGER.log(Level.ERROR, "Fetch file [url=" + originalURL + "] failed", e);
result.put(Keys.MSG, "Fetch file [url=" + originalURL + "] failed"); result.put(Keys.MSG, "Fetch file [url=" + originalURL + "] failed");
return; return;
} }
...@@ -124,7 +122,6 @@ public class FetchUploadProcessor { ...@@ -124,7 +122,6 @@ public class FetchUploadProcessor {
final String msg = "Upload file to community OSS [url=" + originalURL + "] failed"; final String msg = "Upload file to community OSS [url=" + originalURL + "] failed";
LOGGER.log(Level.ERROR, msg, e); LOGGER.log(Level.ERROR, msg, e);
result.put(Keys.MSG, msg); result.put(Keys.MSG, msg);
return; return;
} }
......
...@@ -126,7 +126,6 @@ public class IndexProcessor { ...@@ -126,7 +126,6 @@ public class IndexProcessor {
public void showStart(final RequestContext context) { public void showStart(final RequestContext context) {
if (initService.isInited() && null != Solos.getCurrentUser(context)) { if (initService.isInited() && null != Solos.getCurrentUser(context)) {
context.sendRedirect(Latkes.getServePath()); context.sendRedirect(Latkes.getServePath());
return; return;
} }
......
...@@ -50,7 +50,6 @@ public class InitCheckHandler implements Handler { ...@@ -50,7 +50,6 @@ public class InitCheckHandler implements Handler {
// 禁止直接获取 robots.txt https://github.com/b3log/solo/issues/12543 // 禁止直接获取 robots.txt https://github.com/b3log/solo/issues/12543
if (requestURI.startsWith("/robots.txt") && !isSpiderBot) { if (requestURI.startsWith("/robots.txt") && !isSpiderBot) {
context.sendError(403); context.sendError(403);
return; return;
} }
...@@ -58,14 +57,12 @@ public class InitCheckHandler implements Handler { ...@@ -58,14 +57,12 @@ public class InitCheckHandler implements Handler {
final InitService initService = beanManager.getReference(InitService.class); final InitService initService = beanManager.getReference(InitService.class);
if (initService.isInited()) { if (initService.isInited()) {
context.handle(); context.handle();
return; return;
} }
if (StringUtils.startsWith(requestURI, Latkes.getContextPath() + "/login/")) { if (StringUtils.startsWith(requestURI, Latkes.getContextPath() + "/login/")) {
// Do initialization // Do initialization
context.handle(); context.handle();
return; return;
} }
......
...@@ -124,7 +124,6 @@ public class OAuthProcessor { ...@@ -124,7 +124,6 @@ public class OAuthProcessor {
final String referer = STATES.get(state); final String referer = STATES.get(state);
if (null == referer) { if (null == referer) {
context.sendError(400); context.sendError(400);
return; return;
} }
STATES.remove(state); STATES.remove(state);
...@@ -158,7 +157,6 @@ public class OAuthProcessor { ...@@ -158,7 +157,6 @@ public class OAuthProcessor {
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, "Registers via oauth failed", e); LOGGER.log(Level.ERROR, "Registers via oauth failed", e);
context.sendError(500); context.sendError(500);
return; return;
} }
} else { } else {
...@@ -169,7 +167,6 @@ public class OAuthProcessor { ...@@ -169,7 +167,6 @@ public class OAuthProcessor {
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, "Updates user GitHub id failed", e); LOGGER.log(Level.ERROR, "Updates user GitHub id failed", e);
context.sendError(500); context.sendError(500);
return; return;
} }
} }
...@@ -182,7 +179,6 @@ public class OAuthProcessor { ...@@ -182,7 +179,6 @@ public class OAuthProcessor {
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, "Updates user name failed", e); LOGGER.log(Level.ERROR, "Updates user name failed", e);
context.sendError(500); context.sendError(500);
return; return;
} }
} }
...@@ -191,7 +187,6 @@ public class OAuthProcessor { ...@@ -191,7 +187,6 @@ public class OAuthProcessor {
if (null == user) { if (null == user) {
LOGGER.log(Level.WARN, "Can't get user by name [" + userName + "]"); LOGGER.log(Level.WARN, "Can't get user by name [" + userName + "]");
context.sendError(404); context.sendError(404);
return; return;
} }
......
...@@ -59,7 +59,6 @@ public class PermalinkHandler implements Handler { ...@@ -59,7 +59,6 @@ public class PermalinkHandler implements Handler {
final InitService initService = beanManager.getReference(InitService.class); final InitService initService = beanManager.getReference(InitService.class);
if (!initService.isInited()) { if (!initService.isInited()) {
context.handle(); context.handle();
return; return;
} }
...@@ -69,7 +68,6 @@ public class PermalinkHandler implements Handler { ...@@ -69,7 +68,6 @@ public class PermalinkHandler implements Handler {
if (PermalinkQueryService.invalidPermalinkFormat(permalink)) { if (PermalinkQueryService.invalidPermalinkFormat(permalink)) {
LOGGER.log(Level.DEBUG, "Skip permalink handling request [URI={}]", permalink); LOGGER.log(Level.DEBUG, "Skip permalink handling request [URI={}]", permalink);
context.handle(); context.handle();
return; return;
} }
...@@ -78,13 +76,11 @@ public class PermalinkHandler implements Handler { ...@@ -78,13 +76,11 @@ public class PermalinkHandler implements Handler {
if (null == article) { if (null == article) {
LOGGER.log(Level.DEBUG, "Not found article with permalink [{}]", permalink); LOGGER.log(Level.DEBUG, "Not found article with permalink [{}]", permalink);
context.handle(); context.handle();
return; return;
} }
} catch (final RepositoryException e) { } catch (final RepositoryException e) {
LOGGER.log(Level.ERROR, "Processes article permalink handler failed", e); LOGGER.log(Level.ERROR, "Processes article permalink handler failed", e);
context.sendError(404); context.sendError(404);
return; return;
} }
...@@ -92,11 +88,9 @@ public class PermalinkHandler implements Handler { ...@@ -92,11 +88,9 @@ public class PermalinkHandler implements Handler {
if (Solos.needViewPwd(context, article)) { if (Solos.needViewPwd(context, article)) {
try { try {
context.sendRedirect(Latkes.getServePath() + "/console/article-pwd?articleId=" + article.optString(Keys.OBJECT_ID)); context.sendRedirect(Latkes.getServePath() + "/console/article-pwd?articleId=" + article.optString(Keys.OBJECT_ID));
return; return;
} catch (final Exception e) { } catch (final Exception e) {
context.sendError(404); context.sendError(404);
return; return;
} }
} }
...@@ -106,7 +100,6 @@ public class PermalinkHandler implements Handler { ...@@ -106,7 +100,6 @@ public class PermalinkHandler implements Handler {
final boolean allowVisitDraftViaPermalink = preference.getBoolean(Option.ID_C_ALLOW_VISIT_DRAFT_VIA_PERMALINK); final boolean allowVisitDraftViaPermalink = preference.getBoolean(Option.ID_C_ALLOW_VISIT_DRAFT_VIA_PERMALINK);
if (Article.ARTICLE_STATUS_C_PUBLISHED != article.optInt(Article.ARTICLE_STATUS) && !allowVisitDraftViaPermalink) { if (Article.ARTICLE_STATUS_C_PUBLISHED != article.optInt(Article.ARTICLE_STATUS) && !allowVisitDraftViaPermalink) {
context.sendError(404); context.sendError(404);
return; return;
} }
......
...@@ -36,7 +36,6 @@ public class StaticMidware { ...@@ -36,7 +36,6 @@ public class StaticMidware {
final String html = Statics.get(context); final String html = Statics.get(context);
if (null == html) { if (null == html) {
context.handle(); context.handle();
return; return;
} }
......
...@@ -101,7 +101,6 @@ public class TagProcessor { ...@@ -101,7 +101,6 @@ public class TagProcessor {
final JSONObject result = tagQueryService.getTagByTitle(tagTitle); final JSONObject result = tagQueryService.getTagByTitle(tagTitle);
if (null == result) { if (null == result) {
context.sendError(404); context.sendError(404);
return; return;
} }
...@@ -116,7 +115,6 @@ public class TagProcessor { ...@@ -116,7 +115,6 @@ public class TagProcessor {
final JSONObject tagArticleResult = articleQueryService.getArticlesByTag(tagId, currentPageNum, pageSize); final JSONObject tagArticleResult = articleQueryService.getArticlesByTag(tagId, currentPageNum, pageSize);
if (null == tagArticleResult) { if (null == tagArticleResult) {
context.sendError(404); context.sendError(404);
return; return;
} }
......
...@@ -93,7 +93,6 @@ public class UserTemplateProcessor { ...@@ -93,7 +93,6 @@ public class UserTemplateProcessor {
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, "Renders CHANGE_LOGS failed", e); LOGGER.log(Level.ERROR, "Renders CHANGE_LOGS failed", e);
} }
return; return;
} }
...@@ -107,7 +106,6 @@ public class UserTemplateProcessor { ...@@ -107,7 +106,6 @@ public class UserTemplateProcessor {
final Template template = Skins.getSkinTemplate(context, templateName); final Template template = Skins.getSkinTemplate(context, templateName);
if (null == template) { if (null == template) {
context.sendError(404); context.sendError(404);
return; return;
} }
......
...@@ -230,7 +230,6 @@ public class AdminConsole { ...@@ -230,7 +230,6 @@ public class AdminConsole {
if (!Solos.isAdminLoggedIn(context)) { if (!Solos.isAdminLoggedIn(context)) {
context.sendError(401); context.sendError(401);
return; return;
} }
...@@ -243,7 +242,6 @@ public class AdminConsole { ...@@ -243,7 +242,6 @@ public class AdminConsole {
final byte[] zipData = exportService.exportSQL(); final byte[] zipData = exportService.exportSQL();
if (null == zipData) { if (null == zipData) {
context.sendError(500); context.sendError(500);
return; return;
} }
...@@ -263,7 +261,6 @@ public class AdminConsole { ...@@ -263,7 +261,6 @@ public class AdminConsole {
final Response response = context.getResponse(); final Response response = context.getResponse();
if (!Solos.isAdminLoggedIn(context)) { if (!Solos.isAdminLoggedIn(context)) {
context.sendError(401); context.sendError(401);
return; return;
} }
...@@ -297,7 +294,6 @@ public class AdminConsole { ...@@ -297,7 +294,6 @@ public class AdminConsole {
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, "Export failed", e); LOGGER.log(Level.ERROR, "Export failed", e);
context.renderJSON().renderMsg("Export failed, please check log"); context.renderJSON().renderMsg("Export failed, please check log");
return; return;
} }
} }
...@@ -311,7 +307,6 @@ public class AdminConsole { ...@@ -311,7 +307,6 @@ public class AdminConsole {
final Response response = context.getResponse(); final Response response = context.getResponse();
if (!Solos.isAdminLoggedIn(context)) { if (!Solos.isAdminLoggedIn(context)) {
context.sendError(401); context.sendError(401);
return; return;
} }
...@@ -363,7 +358,6 @@ public class AdminConsole { ...@@ -363,7 +358,6 @@ public class AdminConsole {
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, "Export failed", e); LOGGER.log(Level.ERROR, "Export failed", e);
context.renderJSON().renderMsg("Export failed, please check log"); context.renderJSON().renderMsg("Export failed, please check log");
return; return;
} }
} }
......
...@@ -180,7 +180,6 @@ public class ArticleConsole { ...@@ -180,7 +180,6 @@ public class ArticleConsole {
renderer.setJSONObject(ret); renderer.setJSONObject(ret);
ret.put(Keys.STATUS_CODE, false); ret.put(Keys.STATUS_CODE, false);
ret.put(Keys.MSG, langPropsService.get("forbiddenLabel")); ret.put(Keys.MSG, langPropsService.get("forbiddenLabel"));
return; return;
} }
...@@ -298,7 +297,6 @@ public class ArticleConsole { ...@@ -298,7 +297,6 @@ public class ArticleConsole {
if (!articleQueryService.canAccessArticle(articleId, currentUser)) { if (!articleQueryService.canAccessArticle(articleId, currentUser)) {
ret.put(Keys.STATUS_CODE, false); ret.put(Keys.STATUS_CODE, false);
ret.put(Keys.MSG, langPropsService.get("forbiddenLabel")); ret.put(Keys.MSG, langPropsService.get("forbiddenLabel"));
return; return;
} }
...@@ -342,7 +340,6 @@ public class ArticleConsole { ...@@ -342,7 +340,6 @@ public class ArticleConsole {
if (!articleQueryService.canAccessArticle(articleId, currentUser)) { if (!articleQueryService.canAccessArticle(articleId, currentUser)) {
ret.put(Keys.STATUS_CODE, false); ret.put(Keys.STATUS_CODE, false);
ret.put(Keys.MSG, langPropsService.get("forbiddenLabel")); ret.put(Keys.MSG, langPropsService.get("forbiddenLabel"));
return; return;
} }
...@@ -382,7 +379,6 @@ public class ArticleConsole { ...@@ -382,7 +379,6 @@ public class ArticleConsole {
if (!Solos.isAdminLoggedIn(context)) { if (!Solos.isAdminLoggedIn(context)) {
ret.put(Keys.MSG, langPropsService.get("forbiddenLabel")); ret.put(Keys.MSG, langPropsService.get("forbiddenLabel"));
ret.put(Keys.STATUS_CODE, false); ret.put(Keys.STATUS_CODE, false);
return; return;
} }
...@@ -423,7 +419,6 @@ public class ArticleConsole { ...@@ -423,7 +419,6 @@ public class ArticleConsole {
if (!Solos.isAdminLoggedIn(context)) { if (!Solos.isAdminLoggedIn(context)) {
ret.put(Keys.MSG, langPropsService.get("forbiddenLabel")); ret.put(Keys.MSG, langPropsService.get("forbiddenLabel"));
ret.put(Keys.STATUS_CODE, false); ret.put(Keys.STATUS_CODE, false);
return; return;
} }
...@@ -490,7 +485,6 @@ public class ArticleConsole { ...@@ -490,7 +485,6 @@ public class ArticleConsole {
if (!articleQueryService.canAccessArticle(articleId, currentUser)) { if (!articleQueryService.canAccessArticle(articleId, currentUser)) {
ret.put(Keys.MSG, langPropsService.get("forbiddenLabel")); ret.put(Keys.MSG, langPropsService.get("forbiddenLabel"));
ret.put(Keys.STATUS_CODE, false); ret.put(Keys.STATUS_CODE, false);
return; return;
} }
......
...@@ -156,7 +156,6 @@ public class CategoryConsole { ...@@ -156,7 +156,6 @@ public class CategoryConsole {
final JSONObject result = categoryQueryService.getCategory(categoryId); final JSONObject result = categoryQueryService.getCategory(categoryId);
if (null == result) { if (null == result) {
renderer.setJSONObject(new JSONObject().put(Keys.STATUS_CODE, false)); renderer.setJSONObject(new JSONObject().put(Keys.STATUS_CODE, false));
return; return;
} }
...@@ -273,7 +272,6 @@ public class CategoryConsole { ...@@ -273,7 +272,6 @@ public class CategoryConsole {
final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false); final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false);
renderer.setJSONObject(jsonObject); renderer.setJSONObject(jsonObject);
jsonObject.put(Keys.MSG, addArticleWithTagFirstLabel); jsonObject.put(Keys.MSG, addArticleWithTagFirstLabel);
return; return;
} }
...@@ -292,7 +290,6 @@ public class CategoryConsole { ...@@ -292,7 +290,6 @@ public class CategoryConsole {
final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false); final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false);
renderer.setJSONObject(jsonObject); renderer.setJSONObject(jsonObject);
jsonObject.put(Keys.MSG, langPropsService.get("duplicatedCategoryLabel")); jsonObject.put(Keys.MSG, langPropsService.get("duplicatedCategoryLabel"));
return; return;
} }
...@@ -301,7 +298,6 @@ public class CategoryConsole { ...@@ -301,7 +298,6 @@ public class CategoryConsole {
final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false); final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false);
renderer.setJSONObject(jsonObject); renderer.setJSONObject(jsonObject);
jsonObject.put(Keys.MSG, langPropsService.get("categoryURIMustBeASCIILabel")); jsonObject.put(Keys.MSG, langPropsService.get("categoryURIMustBeASCIILabel"));
return; return;
} }
...@@ -310,14 +306,12 @@ public class CategoryConsole { ...@@ -310,14 +306,12 @@ public class CategoryConsole {
final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false); final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false);
renderer.setJSONObject(jsonObject); renderer.setJSONObject(jsonObject);
jsonObject.put(Keys.MSG, langPropsService.get("duplicatedCategoryURILabel")); jsonObject.put(Keys.MSG, langPropsService.get("duplicatedCategoryURILabel"));
return; return;
} }
if (255 <= StringUtils.length(uri)) { if (255 <= StringUtils.length(uri)) {
final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false); final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false);
renderer.setJSONObject(jsonObject); renderer.setJSONObject(jsonObject);
jsonObject.put(Keys.MSG, langPropsService.get("categoryURITooLongLabel")); jsonObject.put(Keys.MSG, langPropsService.get("categoryURITooLongLabel"));
return; return;
} }
...@@ -409,7 +403,6 @@ public class CategoryConsole { ...@@ -409,7 +403,6 @@ public class CategoryConsole {
final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false); final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false);
renderer.setJSONObject(jsonObject); renderer.setJSONObject(jsonObject);
jsonObject.put(Keys.MSG, addArticleWithTagFirstLabel); jsonObject.put(Keys.MSG, addArticleWithTagFirstLabel);
return; return;
} }
...@@ -427,7 +420,6 @@ public class CategoryConsole { ...@@ -427,7 +420,6 @@ public class CategoryConsole {
final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false); final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false);
renderer.setJSONObject(jsonObject); renderer.setJSONObject(jsonObject);
jsonObject.put(Keys.MSG, langPropsService.get("duplicatedCategoryLabel")); jsonObject.put(Keys.MSG, langPropsService.get("duplicatedCategoryLabel"));
return; return;
} }
...@@ -436,7 +428,6 @@ public class CategoryConsole { ...@@ -436,7 +428,6 @@ public class CategoryConsole {
final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false); final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false);
renderer.setJSONObject(jsonObject); renderer.setJSONObject(jsonObject);
jsonObject.put(Keys.MSG, langPropsService.get("categoryURIMustBeASCIILabel")); jsonObject.put(Keys.MSG, langPropsService.get("categoryURIMustBeASCIILabel"));
return; return;
} }
mayExist = categoryQueryService.getByURI(uri); mayExist = categoryQueryService.getByURI(uri);
...@@ -444,14 +435,12 @@ public class CategoryConsole { ...@@ -444,14 +435,12 @@ public class CategoryConsole {
final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false); final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false);
renderer.setJSONObject(jsonObject); renderer.setJSONObject(jsonObject);
jsonObject.put(Keys.MSG, langPropsService.get("duplicatedCategoryURILabel")); jsonObject.put(Keys.MSG, langPropsService.get("duplicatedCategoryURILabel"));
return; return;
} }
if (255 <= StringUtils.length(uri)) { if (255 <= StringUtils.length(uri)) {
final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false); final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false);
renderer.setJSONObject(jsonObject); renderer.setJSONObject(jsonObject);
jsonObject.put(Keys.MSG, langPropsService.get("categoryURITooLongLabel")); jsonObject.put(Keys.MSG, langPropsService.get("categoryURITooLongLabel"));
return; return;
} }
......
...@@ -88,7 +88,6 @@ public class CommentConsole { ...@@ -88,7 +88,6 @@ public class CommentConsole {
if (!commentQueryService.canAccessComment(commentId, currentUser)) { if (!commentQueryService.canAccessComment(commentId, currentUser)) {
ret.put(Keys.STATUS_CODE, false); ret.put(Keys.STATUS_CODE, false);
ret.put(Keys.MSG, langPropsService.get("forbiddenLabel")); ret.put(Keys.MSG, langPropsService.get("forbiddenLabel"));
return; return;
} }
......
...@@ -29,7 +29,6 @@ public class ConsoleAdminAuthMidware { ...@@ -29,7 +29,6 @@ public class ConsoleAdminAuthMidware {
if (!Solos.isAdminLoggedIn(context)) { if (!Solos.isAdminLoggedIn(context)) {
context.sendError(401); context.sendError(401);
context.abort(); context.abort();
return; return;
} }
......
...@@ -33,7 +33,6 @@ public class ConsoleAuthMidware { ...@@ -33,7 +33,6 @@ public class ConsoleAuthMidware {
if (null == currentUser) { if (null == currentUser) {
context.sendError(401); context.sendError(401);
context.abort(); context.abort();
return; return;
} }
......
...@@ -323,7 +323,6 @@ public class LinkConsole { ...@@ -323,7 +323,6 @@ public class LinkConsole {
final JSONObject result = linkQueryService.getLink(linkId); final JSONObject result = linkQueryService.getLink(linkId);
if (null == result) { if (null == result) {
renderer.setJSONObject(new JSONObject().put(Keys.STATUS_CODE, false)); renderer.setJSONObject(new JSONObject().put(Keys.STATUS_CODE, false));
return; return;
} }
......
...@@ -283,7 +283,6 @@ public class PageConsole { ...@@ -283,7 +283,6 @@ public class PageConsole {
final JSONObject result = pageQueryService.getPage(pageId); final JSONObject result = pageQueryService.getPage(pageId);
if (null == result) { if (null == result) {
renderer.setJSONObject(new JSONObject().put(Keys.STATUS_CODE, false)); renderer.setJSONObject(new JSONObject().put(Keys.STATUS_CODE, false));
return; return;
} }
......
...@@ -181,7 +181,6 @@ public class PreferenceConsole { ...@@ -181,7 +181,6 @@ public class PreferenceConsole {
final JSONObject preference = optionQueryService.getPreference(); final JSONObject preference = optionQueryService.getPreference();
if (null == preference) { if (null == preference) {
renderer.setJSONObject(new JSONObject().put(Keys.STATUS_CODE, false)); renderer.setJSONObject(new JSONObject().put(Keys.STATUS_CODE, false));
return; return;
} }
......
...@@ -93,7 +93,6 @@ public class SkinConsole { ...@@ -93,7 +93,6 @@ public class SkinConsole {
final JSONObject skin = optionQueryService.getSkin(); final JSONObject skin = optionQueryService.getSkin();
if (null == skin) { if (null == skin) {
renderer.setJSONObject(new JSONObject().put(Keys.STATUS_CODE, false)); renderer.setJSONObject(new JSONObject().put(Keys.STATUS_CODE, false));
return; return;
} }
...@@ -104,7 +103,6 @@ public class SkinConsole { ...@@ -104,7 +103,6 @@ public class SkinConsole {
final String name = Latkes.getSkinName(dirName); final String name = Latkes.getSkinName(dirName);
if (null == name) { if (null == name) {
LOGGER.log(Level.WARN, "The directory [{}] does not contain any skin, ignored it", dirName); LOGGER.log(Level.WARN, "The directory [{}] does not contain any skin, ignored it", dirName);
continue; continue;
} }
......
...@@ -83,14 +83,12 @@ public class StaticSiteConsole { ...@@ -83,14 +83,12 @@ public class StaticSiteConsole {
if (!Strings.isURL(url)) { if (!Strings.isURL(url)) {
context.renderJSON(-1); context.renderJSON(-1);
context.renderMsg("Invalid site URL"); context.renderMsg("Invalid site URL");
return; return;
} }
if (Latkes.isInJar()) { if (Latkes.isInJar()) {
context.renderJSON(-1); context.renderJSON(-1);
context.renderMsg("Do not support this feature while running in Jar"); context.renderMsg("Do not support this feature while running in Jar");
return; return;
} }
......
...@@ -229,7 +229,6 @@ public class UserConsole { ...@@ -229,7 +229,6 @@ public class UserConsole {
final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false); final JSONObject jsonObject = new JSONObject().put(Keys.STATUS_CODE, false);
renderer.setJSONObject(jsonObject); renderer.setJSONObject(jsonObject);
jsonObject.put(Keys.MSG, langPropsService.get("getFailLabel")); jsonObject.put(Keys.MSG, langPropsService.get("getFailLabel"));
return; return;
} }
......
...@@ -219,7 +219,6 @@ public class ArticleMgmtService { ...@@ -219,7 +219,6 @@ public class ArticleMgmtService {
optionMgmtService.addOrUpdateOption(githubReposOpt); optionMgmtService.addOrUpdateOption(githubReposOpt);
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, "Updates github repos option failed", e); LOGGER.log(Level.ERROR, "Updates github repos option failed", e);
return; return;
} }
......
...@@ -83,7 +83,6 @@ public class CategoryMgmtService { ...@@ -83,7 +83,6 @@ public class CategoryMgmtService {
} }
LOGGER.log(Level.WARN, "Cant not find the target category of source category [order={}]", srcCategoryOrder); LOGGER.log(Level.WARN, "Cant not find the target category of source category [order={}]", srcCategoryOrder);
return; return;
} }
......
...@@ -171,7 +171,6 @@ public class CommentQueryService { ...@@ -171,7 +171,6 @@ public class CommentQueryService {
final String commentId = comment.optString(Keys.OBJECT_ID); final String commentId = comment.optString(Keys.OBJECT_ID);
commentRepository.remove(commentId); commentRepository.remove(commentId);
transaction.commit(); transaction.commit();
continue; continue;
} }
......
...@@ -456,11 +456,9 @@ public class ExportService { ...@@ -456,11 +456,9 @@ public class ExportService {
if (StringUtils.isNotBlank(article.optString(Article.ARTICLE_VIEW_PWD))) { if (StringUtils.isNotBlank(article.optString(Article.ARTICLE_VIEW_PWD))) {
passwords.add(one); passwords.add(one);
continue; continue;
} else if (Article.ARTICLE_STATUS_C_PUBLISHED == article.optInt(Article.ARTICLE_STATUS)) { } else if (Article.ARTICLE_STATUS_C_PUBLISHED == article.optInt(Article.ARTICLE_STATUS)) {
posts.add(one); posts.add(one);
continue; continue;
} else { } else {
drafts.add(one); drafts.add(one);
......
...@@ -98,7 +98,6 @@ public class UpgradeService { ...@@ -98,7 +98,6 @@ public class UpgradeService {
V380_390.perform(); V380_390.perform();
case "3.9.0": case "3.9.0":
V390_400.perform(); V390_400.perform();
break; break;
default: default:
LOGGER.log(Level.ERROR, "Please upgrade to v3.0.0 first"); LOGGER.log(Level.ERROR, "Please upgrade to v3.0.0 first");
......
...@@ -131,7 +131,6 @@ public class UserMgmtService { ...@@ -131,7 +131,6 @@ public class UserMgmtService {
usite = result.optJSONObject(Common.DATA); usite = result.optJSONObject(Common.DATA);
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, "Gets usite failed", e); LOGGER.log(Level.ERROR, "Gets usite failed", e);
return; return;
} }
...@@ -146,7 +145,6 @@ public class UserMgmtService { ...@@ -146,7 +145,6 @@ public class UserMgmtService {
optionMgmtService.addOrUpdateOption(usiteOpt); optionMgmtService.addOrUpdateOption(usiteOpt);
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, "Updates usite option failed", e); LOGGER.log(Level.ERROR, "Updates usite option failed", e);
return; return;
} }
} }
......
...@@ -249,7 +249,6 @@ public final class Markdowns { ...@@ -249,7 +249,6 @@ public final class Markdowns {
for (final Thread thread : threads) { for (final Thread thread : threads) {
if (thread.getId() == threadId[0]) { if (thread.getId() == threadId[0]) {
thread.stop(); thread.stop();
break; break;
} }
} }
......
...@@ -18,7 +18,6 @@ import org.apache.logging.log4j.Level; ...@@ -18,7 +18,6 @@ import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.b3log.latke.http.RequestContext; import org.b3log.latke.http.RequestContext;
import org.b3log.solo.model.Option;
import org.b3log.solo.processor.SkinRenderer; import org.b3log.solo.processor.SkinRenderer;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
...@@ -46,12 +45,12 @@ public final class Statics { ...@@ -46,12 +45,12 @@ public final class Statics {
/** /**
* Logger. * Logger.
*/ */
private static Logger LOGGER = LogManager.getLogger(Statics.class); private static final Logger LOGGER = LogManager.getLogger(Statics.class);
/** /**
* Generated page expire time. * Generated page expire time.
*/ */
private static long EXPIRED = TimeUnit.HOURS.toMillis(6); private static final long EXPIRED = TimeUnit.HOURS.toMillis(6);
private static File DIR; private static File DIR;
......
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