Skip to content

Commit

Permalink
🐛 修复异常报错问题
Browse files Browse the repository at this point in the history
  • Loading branch information
adlered committed Apr 2, 2021
1 parent 6e228b4 commit f8c8606
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/main/java/org/b3log/solo/SoloServletListener.java
Expand Up @@ -50,6 +50,7 @@
import org.b3log.solo.util.Markdowns;
import org.b3log.solo.util.Skins;
import org.b3log.solo.util.Solos;
import org.json.JSONException;
import org.json.JSONObject;

import javax.servlet.ServletContextEvent;
Expand Down Expand Up @@ -166,10 +167,13 @@ public void contextInitialized(final ServletContextEvent servletContextEvent) {
WAF.set();
new Thread(KanBanNiangProcessor::downloadKBNResource).start();

final OptionQueryService optionQueryService = beanManager.getReference(OptionQueryService.class);
final JSONObject preference = optionQueryService.getPreference();
final String localeString = preference.getString(Option.ID_C_LOCALE_STRING);
Latkes.setLocale(new Locale(Locales.getLanguage(localeString), Locales.getCountry(localeString)));
try {
final OptionQueryService optionQueryService = beanManager.getReference(OptionQueryService.class);
final JSONObject preference = optionQueryService.getPreference();
final String localeString = preference.getString(Option.ID_C_LOCALE_STRING);
Latkes.setLocale(new Locale(Locales.getLanguage(localeString), Locales.getCountry(localeString)));
} catch (JSONException ignored) {
}
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/b3log/solo/service/CronMgmtService.java
Expand Up @@ -23,6 +23,7 @@
import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.util.Stopwatchs;
import org.b3log.solo.model.Option;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.concurrent.Executors;
Expand Down Expand Up @@ -104,7 +105,7 @@ public void start() {
try {
enableAutoFlushGitHub = preference.getBoolean(Option.ID_C_ENABLE_AUTO_FLUSH_GITHUB);
myGitHubID = preference.getString(Option.ID_C_MY_GITHUB_ID);
} catch (NullPointerException e) {
} catch (NullPointerException | JSONException e) {
enableAutoFlushGitHub = false;
myGitHubID = "";
}
Expand Down

0 comments on commit f8c8606

Please sign in to comment.