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

🎨 #12515 异常处理

parent 808e23ba
...@@ -187,7 +187,7 @@ public final class SoloServletListener extends AbstractServletListener { ...@@ -187,7 +187,7 @@ public final class SoloServletListener extends AbstractServletListener {
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, e.getMessage(), e); LOGGER.log(Level.ERROR, e.getMessage(), e);
throw new IllegalStateException(e); System.exit(-1);
} }
Stopwatchs.end(); Stopwatchs.end();
...@@ -216,8 +216,9 @@ public final class SoloServletListener extends AbstractServletListener { ...@@ -216,8 +216,9 @@ public final class SoloServletListener extends AbstractServletListener {
final B3CommentSender commentSender = beanManager.getReference(B3CommentSender.class); final B3CommentSender commentSender = beanManager.getReference(B3CommentSender.class);
eventManager.registerListener(commentSender); eventManager.registerListener(commentSender);
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, "Register event handlers error", e); LOGGER.log(Level.ERROR, "Register event handlers failed", e);
throw new IllegalStateException(e);
System.exit(-1);
} }
LOGGER.debug("Registered event handlers"); LOGGER.debug("Registered event handlers");
......
...@@ -19,7 +19,6 @@ package org.b3log.solo.model; ...@@ -19,7 +19,6 @@ package org.b3log.solo.model;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys; import org.b3log.latke.Keys;
import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger; import org.b3log.latke.logging.Logger;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
...@@ -30,7 +29,7 @@ import java.util.Set; ...@@ -30,7 +29,7 @@ import java.util.Set;
* This class defines option model relevant keys. * This class defines option model relevant keys.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @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 * @since 0.6.0
*/ */
public final class Option { public final class Option {
...@@ -526,28 +525,22 @@ public final class Option { ...@@ -526,28 +525,22 @@ public final class Option {
final JSONArray signs = new JSONArray(); final JSONArray signs = new JSONArray();
final int signLength = 4; final int signLength = 4;
try { for (int i = 0; i < signLength; i++) {
for (int i = 0; i < signLength; i++) { final JSONObject sign = new JSONObject();
final JSONObject sign = new JSONObject(); sign.put(Keys.OBJECT_ID, i);
sign.put(Keys.OBJECT_ID, i); signs.put(sign);
signs.put(sign); sign.put(Sign.SIGN_HTML, "");
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);
} }
// 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.*; ...@@ -53,7 +53,7 @@ import static org.b3log.solo.model.Article.*;
* @author <a href="http://blog.sweelia.com">ArmstrongCN</a> * @author <a href="http://blog.sweelia.com">ArmstrongCN</a>
* @author <a href="http://zephyr.b3log.org">Zephyr</a> * @author <a href="http://zephyr.b3log.org">Zephyr</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</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 * @since 0.3.5
*/ */
@Service @Service
...@@ -359,10 +359,7 @@ public class ArticleQueryService { ...@@ -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); 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");
}
return defaultSign; 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