Commit 5e0d4b9e authored by Liang Ding's avatar Liang Ding

🎨 #12515 异常处理

parent 808e23ba
......@@ -187,7 +187,7 @@ public final class SoloServletListener extends AbstractServletListener {
} catch (final Exception e) {
LOGGER.log(Level.ERROR, e.getMessage(), e);
throw new IllegalStateException(e);
System.exit(-1);
}
Stopwatchs.end();
......@@ -216,8 +216,9 @@ public final class SoloServletListener extends AbstractServletListener {
final B3CommentSender commentSender = beanManager.getReference(B3CommentSender.class);
eventManager.registerListener(commentSender);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Register event handlers error", e);
throw new IllegalStateException(e);
LOGGER.log(Level.ERROR, "Register event handlers failed", e);
System.exit(-1);
}
LOGGER.debug("Registered event handlers");
......
......@@ -19,7 +19,6 @@ package org.b3log.solo.model;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger;
import org.json.JSONArray;
import org.json.JSONObject;
......@@ -30,7 +29,7 @@ import java.util.Set;
* This class defines option model relevant keys.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.0.9, Sep 21, 2018
* @version 1.3.0.10, Oct 7, 2018
* @since 0.6.0
*/
public final class Option {
......@@ -526,28 +525,22 @@ public final class Option {
final JSONArray signs = new JSONArray();
final int signLength = 4;
try {
for (int i = 0; i < signLength; i++) {
final JSONObject sign = new JSONObject();
sign.put(Keys.OBJECT_ID, i);
signs.put(sign);
sign.put(Sign.SIGN_HTML, "");
}
// Sign(id=0) is the 'empty' sign, used for article user needn't a sign
DEFAULT_SIGNS = signs.toString();
final JSONObject replyNotificationTemplate = new JSONObject();
replyNotificationTemplate.put("subject", "${blogTitle}: New reply of your comment");
replyNotificationTemplate.put("body",
"Your comment on post[<a href='${postLink}'>" + "${postTitle}</a>] received an reply: <p>${replier}"
+ ": <span><a href='${replyURL}'>${replyContent}</a></span></p>");
DEFAULT_REPLY_NOTIFICATION_TEMPLATE = replyNotificationTemplate.toString();
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Creates sign error!", e);
throw new IllegalStateException(e);
for (int i = 0; i < signLength; i++) {
final JSONObject sign = new JSONObject();
sign.put(Keys.OBJECT_ID, i);
signs.put(sign);
sign.put(Sign.SIGN_HTML, "");
}
// Sign(id=0) is the 'empty' sign, used for article user needn't a sign
DEFAULT_SIGNS = signs.toString();
final JSONObject replyNotificationTemplate = new JSONObject();
replyNotificationTemplate.put("subject", "${blogTitle}: New reply of your comment");
replyNotificationTemplate.put("body",
"Your comment on post[<a href='${postLink}'>" + "${postTitle}</a>] received an reply: <p>${replier}"
+ ": <span><a href='${replyURL}'>${replyContent}</a></span></p>");
DEFAULT_REPLY_NOTIFICATION_TEMPLATE = replyNotificationTemplate.toString();
}
/**
......
......@@ -53,7 +53,7 @@ import static org.b3log.solo.model.Article.*;
* @author <a href="http://blog.sweelia.com">ArmstrongCN</a>
* @author <a href="http://zephyr.b3log.org">Zephyr</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.3.2.5, Oct 5, 2018
* @version 1.3.2.6, Oct 7, 2018
* @since 0.3.5
*/
@Service
......@@ -359,10 +359,7 @@ public class ArticleQueryService {
}
}
LOGGER.log(Level.WARN, "Can not find the sign[id={0}], returns a default sign[id=1]", signId);
if (null == defaultSign) {
throw new IllegalStateException("Can not find the default sign which id equals to 1");
}
LOGGER.log(Level.WARN, "Can not find the sign [id={0}], returns a default sign [id=1]", signId);
return defaultSign;
}
......
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