Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo
Commits
4acc9b1f
Commit
4acc9b1f
authored
Jun 19, 2013
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#267
依赖最新的 Latke。 GAE 版由于 GAE runtime 默认是 JDK logging,所以用的是 slf4j-jdk14,其他版本都是使用 slf4j-log4j12
parent
2c33e79e
Changes
101
Hide whitespace changes
Inline
Side-by-side
Showing
101 changed files
with
667 additions
and
694 deletions
+667
-694
core/pom.xml
core/pom.xml
+6
-0
core/src/main/java/org/b3log/solo/SoloServletListener.java
core/src/main/java/org/b3log/solo/SoloServletListener.java
+12
-12
core/src/main/java/org/b3log/solo/api/metaweblog/MetaWeblogAPI.java
...ain/java/org/b3log/solo/api/metaweblog/MetaWeblogAPI.java
+4
-4
core/src/main/java/org/b3log/solo/api/symphony/ArticleReceiver.java
...ain/java/org/b3log/solo/api/symphony/ArticleReceiver.java
+6
-6
core/src/main/java/org/b3log/solo/api/symphony/CommentReceiver.java
...ain/java/org/b3log/solo/api/symphony/CommentReceiver.java
+11
-11
core/src/main/java/org/b3log/solo/dev/ArticleGenerator.java
core/src/main/java/org/b3log/solo/dev/ArticleGenerator.java
+4
-4
core/src/main/java/org/b3log/solo/event/cache/RemoveCacheListener.java
.../java/org/b3log/solo/event/cache/RemoveCacheListener.java
+4
-4
core/src/main/java/org/b3log/solo/event/comment/ArticleCommentReplyNotifier.java
...b3log/solo/event/comment/ArticleCommentReplyNotifier.java
+6
-6
core/src/main/java/org/b3log/solo/event/comment/PageCommentReplyNotifier.java
...rg/b3log/solo/event/comment/PageCommentReplyNotifier.java
+6
-6
core/src/main/java/org/b3log/solo/event/ping/AddArticleGoogleBlogSearchPinger.java
...log/solo/event/ping/AddArticleGoogleBlogSearchPinger.java
+4
-4
core/src/main/java/org/b3log/solo/event/ping/UpdateArticleGoogleBlogSearchPinger.java
.../solo/event/ping/UpdateArticleGoogleBlogSearchPinger.java
+4
-4
core/src/main/java/org/b3log/solo/event/plugin/PluginRefresher.java
...ain/java/org/b3log/solo/event/plugin/PluginRefresher.java
+4
-4
core/src/main/java/org/b3log/solo/event/rhythm/ArticleSender.java
.../main/java/org/b3log/solo/event/rhythm/ArticleSender.java
+7
-7
core/src/main/java/org/b3log/solo/event/rhythm/ArticleUpdater.java
...main/java/org/b3log/solo/event/rhythm/ArticleUpdater.java
+7
-7
core/src/main/java/org/b3log/solo/event/symphony/CommentSender.java
...ain/java/org/b3log/solo/event/symphony/CommentSender.java
+6
-6
core/src/main/java/org/b3log/solo/filter/AuthFilter.java
core/src/main/java/org/b3log/solo/filter/AuthFilter.java
+5
-5
core/src/main/java/org/b3log/solo/filter/InitCheckFilter.java
.../src/main/java/org/b3log/solo/filter/InitCheckFilter.java
+5
-5
core/src/main/java/org/b3log/solo/filter/PageCacheFilter.java
.../src/main/java/org/b3log/solo/filter/PageCacheFilter.java
+13
-13
core/src/main/java/org/b3log/solo/filter/PermalinkFilter.java
.../src/main/java/org/b3log/solo/filter/PermalinkFilter.java
+7
-7
core/src/main/java/org/b3log/solo/model/Preference.java
core/src/main/java/org/b3log/solo/model/Preference.java
+3
-3
core/src/main/java/org/b3log/solo/plugin/broadcast/ChanceProcessor.java
...java/org/b3log/solo/plugin/broadcast/ChanceProcessor.java
+6
-6
core/src/main/java/org/b3log/solo/plugin/cache/AdminCacheService.java
...n/java/org/b3log/solo/plugin/cache/AdminCacheService.java
+6
-6
core/src/main/java/org/b3log/solo/processor/ArticleProcessor.java
.../main/java/org/b3log/solo/processor/ArticleProcessor.java
+34
-34
core/src/main/java/org/b3log/solo/processor/CacheProcessor.java
...rc/main/java/org/b3log/solo/processor/CacheProcessor.java
+3
-3
core/src/main/java/org/b3log/solo/processor/CaptchaProcessor.java
.../main/java/org/b3log/solo/processor/CaptchaProcessor.java
+5
-5
core/src/main/java/org/b3log/solo/processor/CommentProcessor.java
.../main/java/org/b3log/solo/processor/CommentProcessor.java
+6
-6
core/src/main/java/org/b3log/solo/processor/ErrorProcessor.java
...rc/main/java/org/b3log/solo/processor/ErrorProcessor.java
+5
-5
core/src/main/java/org/b3log/solo/processor/FeedProcessor.java
...src/main/java/org/b3log/solo/processor/FeedProcessor.java
+6
-6
core/src/main/java/org/b3log/solo/processor/IndexProcessor.java
...rc/main/java/org/b3log/solo/processor/IndexProcessor.java
+9
-9
core/src/main/java/org/b3log/solo/processor/InitProcessor.java
...src/main/java/org/b3log/solo/processor/InitProcessor.java
+3
-3
core/src/main/java/org/b3log/solo/processor/LoginProcessor.java
...rc/main/java/org/b3log/solo/processor/LoginProcessor.java
+12
-12
core/src/main/java/org/b3log/solo/processor/PageProcessor.java
...src/main/java/org/b3log/solo/processor/PageProcessor.java
+4
-4
core/src/main/java/org/b3log/solo/processor/RepairProcessor.java
...c/main/java/org/b3log/solo/processor/RepairProcessor.java
+10
-11
core/src/main/java/org/b3log/solo/processor/SitemapProcessor.java
.../main/java/org/b3log/solo/processor/SitemapProcessor.java
+3
-3
core/src/main/java/org/b3log/solo/processor/StatProcessor.java
...src/main/java/org/b3log/solo/processor/StatProcessor.java
+3
-3
core/src/main/java/org/b3log/solo/processor/TagProcessor.java
.../src/main/java/org/b3log/solo/processor/TagProcessor.java
+12
-13
core/src/main/java/org/b3log/solo/processor/UpgradeProcessor.java
.../main/java/org/b3log/solo/processor/UpgradeProcessor.java
+10
-10
core/src/main/java/org/b3log/solo/processor/UserTemplateProcessor.java
.../java/org/b3log/solo/processor/UserTemplateProcessor.java
+6
-6
core/src/main/java/org/b3log/solo/processor/console/AdminConsole.java
...n/java/org/b3log/solo/processor/console/AdminConsole.java
+6
-6
core/src/main/java/org/b3log/solo/processor/console/ArticleConsole.java
...java/org/b3log/solo/processor/console/ArticleConsole.java
+11
-11
core/src/main/java/org/b3log/solo/processor/console/CommentConsole.java
...java/org/b3log/solo/processor/console/CommentConsole.java
+7
-7
core/src/main/java/org/b3log/solo/processor/console/LinkConsole.java
...in/java/org/b3log/solo/processor/console/LinkConsole.java
+8
-8
core/src/main/java/org/b3log/solo/processor/console/PageConsole.java
...in/java/org/b3log/solo/processor/console/PageConsole.java
+8
-8
core/src/main/java/org/b3log/solo/processor/console/PluginConsole.java
.../java/org/b3log/solo/processor/console/PluginConsole.java
+4
-6
core/src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
...a/org/b3log/solo/processor/console/PreferenceConsole.java
+7
-7
core/src/main/java/org/b3log/solo/processor/console/TagConsole.java
...ain/java/org/b3log/solo/processor/console/TagConsole.java
+5
-5
core/src/main/java/org/b3log/solo/processor/console/UserConsole.java
...in/java/org/b3log/solo/processor/console/UserConsole.java
+8
-8
core/src/main/java/org/b3log/solo/processor/renderer/ConsoleRenderer.java
...va/org/b3log/solo/processor/renderer/ConsoleRenderer.java
+3
-3
core/src/main/java/org/b3log/solo/processor/renderer/FrontRenderer.java
...java/org/b3log/solo/processor/renderer/FrontRenderer.java
+6
-6
core/src/main/java/org/b3log/solo/processor/util/Filler.java
core/src/main/java/org/b3log/solo/processor/util/Filler.java
+43
-43
core/src/main/java/org/b3log/solo/processor/util/TopBars.java
.../src/main/java/org/b3log/solo/processor/util/TopBars.java
+5
-5
core/src/main/java/org/b3log/solo/repository/impl/ArchiveDateRepositoryImpl.java
...b3log/solo/repository/impl/ArchiveDateRepositoryImpl.java
+4
-4
core/src/main/java/org/b3log/solo/repository/impl/ArticleRepositoryImpl.java
...org/b3log/solo/repository/impl/ArticleRepositoryImpl.java
+3
-3
core/src/main/java/org/b3log/solo/repository/impl/CommentRepositoryImpl.java
...org/b3log/solo/repository/impl/CommentRepositoryImpl.java
+5
-5
core/src/main/java/org/b3log/solo/repository/impl/LinkRepositoryImpl.java
...va/org/b3log/solo/repository/impl/LinkRepositoryImpl.java
+1
-6
core/src/main/java/org/b3log/solo/repository/impl/OptionRepositoryImpl.java
.../org/b3log/solo/repository/impl/OptionRepositoryImpl.java
+0
-7
core/src/main/java/org/b3log/solo/repository/impl/PageRepositoryImpl.java
...va/org/b3log/solo/repository/impl/PageRepositoryImpl.java
+0
-6
core/src/main/java/org/b3log/solo/repository/impl/PluginRepositoryImpl.java
.../org/b3log/solo/repository/impl/PluginRepositoryImpl.java
+0
-7
core/src/main/java/org/b3log/solo/repository/impl/PreferenceRepositoryImpl.java
.../b3log/solo/repository/impl/PreferenceRepositoryImpl.java
+0
-6
core/src/main/java/org/b3log/solo/repository/impl/StatisticRepositoryImpl.java
...g/b3log/solo/repository/impl/StatisticRepositoryImpl.java
+0
-6
core/src/main/java/org/b3log/solo/repository/impl/TagArticleRepositoryImpl.java
.../b3log/solo/repository/impl/TagArticleRepositoryImpl.java
+0
-6
core/src/main/java/org/b3log/solo/repository/impl/TagRepositoryImpl.java
...ava/org/b3log/solo/repository/impl/TagRepositoryImpl.java
+0
-6
core/src/main/java/org/b3log/solo/repository/impl/UserRepositoryImpl.java
...va/org/b3log/solo/repository/impl/UserRepositoryImpl.java
+0
-6
core/src/main/java/org/b3log/solo/service/ArchiveDateQueryService.java
.../java/org/b3log/solo/service/ArchiveDateQueryService.java
+4
-4
core/src/main/java/org/b3log/solo/service/ArticleMgmtService.java
.../main/java/org/b3log/solo/service/ArticleMgmtService.java
+26
-26
core/src/main/java/org/b3log/solo/service/ArticleQueryService.java
...main/java/org/b3log/solo/service/ArticleQueryService.java
+16
-16
core/src/main/java/org/b3log/solo/service/CommentMgmtService.java
.../main/java/org/b3log/solo/service/CommentMgmtService.java
+9
-9
core/src/main/java/org/b3log/solo/service/CommentQueryService.java
...main/java/org/b3log/solo/service/CommentQueryService.java
+4
-4
core/src/main/java/org/b3log/solo/service/InitService.java
core/src/main/java/org/b3log/solo/service/InitService.java
+9
-9
core/src/main/java/org/b3log/solo/service/LinkMgmtService.java
...src/main/java/org/b3log/solo/service/LinkMgmtService.java
+7
-7
core/src/main/java/org/b3log/solo/service/LinkQueryService.java
...rc/main/java/org/b3log/solo/service/LinkQueryService.java
+4
-4
core/src/main/java/org/b3log/solo/service/OptionMgmtService.java
...c/main/java/org/b3log/solo/service/OptionMgmtService.java
+0
-6
core/src/main/java/org/b3log/solo/service/OptionQueryService.java
.../main/java/org/b3log/solo/service/OptionQueryService.java
+0
-6
core/src/main/java/org/b3log/solo/service/PageMgmtService.java
...src/main/java/org/b3log/solo/service/PageMgmtService.java
+10
-10
core/src/main/java/org/b3log/solo/service/PageQueryService.java
...rc/main/java/org/b3log/solo/service/PageQueryService.java
+4
-4
core/src/main/java/org/b3log/solo/service/PluginMgmtService.java
...c/main/java/org/b3log/solo/service/PluginMgmtService.java
+4
-5
core/src/main/java/org/b3log/solo/service/PluginQueryService.java
.../main/java/org/b3log/solo/service/PluginQueryService.java
+5
-6
core/src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
...in/java/org/b3log/solo/service/PreferenceMgmtService.java
+9
-9
core/src/main/java/org/b3log/solo/service/PreferenceQueryService.java
...n/java/org/b3log/solo/service/PreferenceQueryService.java
+5
-5
core/src/main/java/org/b3log/solo/service/StatisticMgmtService.java
...ain/java/org/b3log/solo/service/StatisticMgmtService.java
+7
-7
core/src/main/java/org/b3log/solo/service/StatisticQueryService.java
...in/java/org/b3log/solo/service/StatisticQueryService.java
+4
-4
core/src/main/java/org/b3log/solo/service/TagMgmtService.java
.../src/main/java/org/b3log/solo/service/TagMgmtService.java
+3
-3
core/src/main/java/org/b3log/solo/service/TagQueryService.java
...src/main/java/org/b3log/solo/service/TagQueryService.java
+6
-6
core/src/main/java/org/b3log/solo/service/UserMgmtService.java
...src/main/java/org/b3log/solo/service/UserMgmtService.java
+6
-6
core/src/main/java/org/b3log/solo/service/UserQueryService.java
...rc/main/java/org/b3log/solo/service/UserQueryService.java
+6
-6
core/src/main/java/org/b3log/solo/util/Articles.java
core/src/main/java/org/b3log/solo/util/Articles.java
+7
-7
core/src/main/java/org/b3log/solo/util/Comments.java
core/src/main/java/org/b3log/solo/util/Comments.java
+10
-10
core/src/main/java/org/b3log/solo/util/Markdowns.java
core/src/main/java/org/b3log/solo/util/Markdowns.java
+3
-3
core/src/main/java/org/b3log/solo/util/Permalinks.java
core/src/main/java/org/b3log/solo/util/Permalinks.java
+3
-3
core/src/main/java/org/b3log/solo/util/Plugins.java
core/src/main/java/org/b3log/solo/util/Plugins.java
+5
-6
core/src/main/java/org/b3log/solo/util/Skins.java
core/src/main/java/org/b3log/solo/util/Skins.java
+12
-12
core/src/main/java/org/b3log/solo/util/Statistics.java
core/src/main/java/org/b3log/solo/util/Statistics.java
+9
-9
core/src/main/java/org/b3log/solo/util/Tags.java
core/src/main/java/org/b3log/solo/util/Tags.java
+0
-6
core/src/main/java/org/b3log/solo/util/Users.java
core/src/main/java/org/b3log/solo/util/Users.java
+6
-6
pom.xml
pom.xml
+7
-6
war/bae/pom.xml
war/bae/pom.xml
+0
-1
war/gae/pom.xml
war/gae/pom.xml
+22
-1
war/gae/src/main/resources/logging.properties
war/gae/src/main/resources/logging.properties
+1
-6
war/h2/pom.xml
war/h2/pom.xml
+0
-1
war/mysql/pom.xml
war/mysql/pom.xml
+0
-1
war/src/main/resources/log4j.properties
war/src/main/resources/log4j.properties
+33
-0
No files found.
core/pom.xml
View file @
4acc9b1f
...
...
@@ -83,6 +83,12 @@
<groupId>
org.tautua.markdownpapers
</groupId>
<artifactId>
markdownpapers-core
</artifactId>
</dependency>
<dependency>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-log4j12
</artifactId>
<version>
${slf4j.version}
</version>
</dependency>
</dependencies>
<build>
...
...
core/src/main/java/org/b3log/solo/SoloServletListener.java
View file @
4acc9b1f
...
...
@@ -17,8 +17,6 @@ package org.b3log.solo;
import
java.util.ResourceBundle
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.ServletContextEvent
;
import
javax.servlet.ServletRequestEvent
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -26,6 +24,8 @@ import javax.servlet.http.HttpSession;
import
javax.servlet.http.HttpSessionEvent
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.event.EventManager
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.plugin.PluginManager
;
import
org.b3log.latke.plugin.ViewLoadEventHandler
;
import
org.b3log.latke.repository.RepositoryException
;
...
...
@@ -134,7 +134,7 @@ public final class SoloServletListener extends AbstractServletListener {
LOGGER
.
info
(
"Initialized the context"
);
Stopwatchs
.
end
();
LOGGER
.
log
(
Level
.
FINE
,
"Stopwatch: {0}{1}"
,
new
Object
[]
{
Strings
.
LINE_SEPARATOR
,
Stopwatchs
.
getTimingStat
()});
LOGGER
.
log
(
Level
.
DEBUG
,
"Stopwatch: {0}{1}"
,
new
Object
[]
{
Strings
.
LINE_SEPARATOR
,
Stopwatchs
.
getTimingStat
()});
}
@Override
...
...
@@ -159,13 +159,13 @@ public final class SoloServletListener extends AbstractServletListener {
Stopwatchs
.
start
(
"Request Initialized[requestURI="
+
requestURI
+
"]"
);
if
(
Requests
.
searchEngineBotRequest
(
httpServletRequest
))
{
LOGGER
.
log
(
Level
.
FINER
,
"Request made from a search engine[User-Agent={0}]"
,
httpServletRequest
.
getHeader
(
"User-Agent"
));
LOGGER
.
log
(
Level
.
DEBUG
,
"Request made from a search engine[User-Agent={0}]"
,
httpServletRequest
.
getHeader
(
"User-Agent"
));
httpServletRequest
.
setAttribute
(
Keys
.
HttpRequest
.
IS_SEARCH_ENGINE_BOT
,
true
);
}
else
{
// Gets the session of this request
final
HttpSession
session
=
httpServletRequest
.
getSession
();
LOGGER
.
log
(
Level
.
FINE
,
"Gets a session[id={0}, remoteAddr={1}, User-Agent={2}, isNew={3}]"
,
new
Object
[]
{
LOGGER
.
log
(
Level
.
DEBUG
,
"Gets a session[id={0}, remoteAddr={1}, User-Agent={2}, isNew={3}]"
,
new
Object
[]
{
session
.
getId
(),
httpServletRequest
.
getRemoteAddr
(),
httpServletRequest
.
getHeader
(
"User-Agent"
),
session
.
isNew
()});
// Online visitor count
Statistics
.
onlineVisitorCount
(
httpServletRequest
);
...
...
@@ -178,7 +178,7 @@ public final class SoloServletListener extends AbstractServletListener {
public
void
requestDestroyed
(
final
ServletRequestEvent
servletRequestEvent
)
{
Stopwatchs
.
end
();
LOGGER
.
log
(
Level
.
FINE
,
"Stopwatch: {0}{1}"
,
new
Object
[]
{
Strings
.
LINE_SEPARATOR
,
Stopwatchs
.
getTimingStat
()});
LOGGER
.
log
(
Level
.
DEBUG
,
"Stopwatch: {0}{1}"
,
new
Object
[]
{
Strings
.
LINE_SEPARATOR
,
Stopwatchs
.
getTimingStat
()});
Stopwatchs
.
release
();
super
.
requestDestroyed
(
servletRequestEvent
);
...
...
@@ -210,7 +210,7 @@ public final class SoloServletListener extends AbstractServletListener {
try
{
preference
=
preferenceRepository
.
get
(
Preference
.
PREFERENCE
);
if
(
null
==
preference
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Can't not init default skin, please init B3log Solo first"
);
LOGGER
.
log
(
Level
.
WARN
,
"Can't not init default skin, please init B3log Solo first"
);
return
;
}
...
...
@@ -220,7 +220,7 @@ public final class SoloServletListener extends AbstractServletListener {
Templates
.
enableCache
(
pageCacheEnabled
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
throw
new
IllegalStateException
(
e
);
}
...
...
@@ -240,7 +240,7 @@ public final class SoloServletListener extends AbstractServletListener {
return
null
!=
admin
;
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"B3log Solo has not been initialized"
);
LOGGER
.
log
(
Level
.
WARN
,
"B3log Solo has not been initialized"
);
return
false
;
}
}
...
...
@@ -271,7 +271,7 @@ public final class SoloServletListener extends AbstractServletListener {
// Cache
eventManager
.
registerListener
(
new
RemoveCacheListener
());
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Register event processors error"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Register event processors error"
,
e
);
throw
new
IllegalStateException
(
e
);
}
...
...
@@ -302,12 +302,12 @@ public final class SoloServletListener extends AbstractServletListener {
desiredView
=
preference
.
getString
(
Skin
.
SKIN_DIR_NAME
);
}
else
{
desiredView
=
"mobile"
;
LOGGER
.
log
(
Level
.
FINER
,
"The request [URI={0}] comes frome mobile device"
,
requestURI
);
LOGGER
.
log
(
Level
.
DEBUG
,
"The request [URI={0}] comes frome mobile device"
,
requestURI
);
}
httpServletRequest
.
setAttribute
(
Keys
.
TEMAPLTE_DIR_NAME
,
desiredView
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Resolves skin failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Resolves skin failed"
,
e
);
}
}
}
core/src/main/java/org/b3log/solo/api/metaweblog/MetaWeblogAPI.java
View file @
4acc9b1f
...
...
@@ -19,8 +19,6 @@ package org.b3log.solo.api.metaweblog;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.ServletInputStream
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -30,6 +28,8 @@ import org.apache.commons.lang.time.DateFormatUtils;
import
org.apache.commons.lang.time.DateUtils
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.repository.Transaction
;
import
org.b3log.latke.service.ServiceException
;
...
...
@@ -290,7 +290,7 @@ public final class MetaWeblogAPI {
throw
new
UnsupportedOperationException
(
"Unsupported method[name="
+
methodName
+
"]"
);
}
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
StringBuilder
stringBuilder
=
new
StringBuilder
(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><methodResponse>"
).
append
(
"<fault><value><struct>"
).
append
(
"<member><name>faultCode</name><value><int>500</int></value></member>"
).
append
(
"<member><name>faultString</name><value><string>"
).
append
(
e
.
getMessage
()).
append
(
"</string></value></member></struct></value></fault></methodResponse>"
);
...
...
@@ -367,7 +367,7 @@ public final class MetaWeblogAPI {
try
{
date
=
(
Date
)
DateFormatUtils
.
ISO_DATETIME_FORMAT
.
parseObject
(
dateString
);
}
catch
(
final
ParseException
e
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
LOGGER
.
log
(
Level
.
WARN
,
"Parses article create date failed with ISO8601, retry to parse with "
+
"pattern[yyyy-MM-dd'T'HH:mm:ss, yyyyMMdd'T'HH:mm:ss'Z']"
);
date
=
DateUtils
.
parseDate
(
dateString
,
new
String
[]
{
"yyyyMMdd'T'HH:mm:ss"
,
"yyyyMMdd'T'HH:mm:ss'Z'"
});
...
...
core/src/main/java/org/b3log/solo/api/symphony/ArticleReceiver.java
View file @
4acc9b1f
...
...
@@ -16,11 +16,11 @@
package
org
.
b3log
.
solo
.
api
.
symphony
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.service.ServiceException
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
...
...
@@ -123,7 +123,7 @@ public final class ArticleReceiver {
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
if
(!
userB3Key
.
equals
(
preference
.
optString
(
Preference
.
KEY_OF_SOLO
)))
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"B3 key not match, ignored add article"
);
LOGGER
.
log
(
Level
.
WARN
,
"B3 key not match, ignored add article"
);
return
;
}
...
...
@@ -159,7 +159,7 @@ public final class ArticleReceiver {
renderer
.
setJSONObject
(
ret
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -216,7 +216,7 @@ public final class ArticleReceiver {
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
if
(!
userB3Key
.
equals
(
preference
.
optString
(
Preference
.
KEY_OF_SOLO
)))
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"B3 key not match, ignored update article"
);
LOGGER
.
log
(
Level
.
WARN
,
"B3 key not match, ignored update article"
);
return
;
}
...
...
@@ -253,7 +253,7 @@ public final class ArticleReceiver {
ret
.
put
(
Keys
.
MSG
,
"update article succ"
);
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
core/src/main/java/org/b3log/solo/api/symphony/CommentReceiver.java
View file @
4acc9b1f
...
...
@@ -21,8 +21,6 @@ import java.net.MalformedURLException;
import
java.net.URL
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang.time.DateFormatUtils
;
...
...
@@ -30,6 +28,8 @@ import org.b3log.latke.Keys;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.event.Event
;
import
org.b3log.latke.event.EventManager
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.Transaction
;
import
org.b3log.latke.service.ServiceException
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
...
...
@@ -197,7 +197,7 @@ public final class CommentReceiver {
try
{
new
URL
(
commentURL
);
}
catch
(
final
MalformedURLException
e
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"The comment URL is invalid [{0}]"
,
commentURL
);
LOGGER
.
log
(
Level
.
WARN
,
"The comment URL is invalid [{0}]"
,
commentURL
);
commentURL
=
""
;
}
...
...
@@ -232,7 +232,7 @@ public final class CommentReceiver {
}
else
{
comment
.
put
(
Comment
.
COMMENT_ORIGINAL_COMMENT_ID
,
""
);
comment
.
put
(
Comment
.
COMMENT_ORIGINAL_COMMENT_NAME
,
""
);
LOGGER
.
log
(
Level
.
WARN
ING
,
"Not found orginal comment[id={0}] of reply[name={1}, content={2}]"
,
LOGGER
.
log
(
Level
.
WARN
,
"Not found orginal comment[id={0}] of reply[name={1}, content={2}]"
,
new
String
[]
{
originalCommentId
,
commentName
,
commentContent
});
}
}
else
{
...
...
@@ -260,7 +260,7 @@ public final class CommentReceiver {
try
{
Comments
.
sendNotificationMail
(
article
,
comment
,
originalComment
,
preference
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Send mail failed"
,
e
);
LOGGER
.
log
(
Level
.
WARN
,
"Send mail failed"
,
e
);
}
// Step 5: Fire add comment event
final
JSONObject
eventData
=
new
JSONObject
();
...
...
@@ -279,7 +279,7 @@ public final class CommentReceiver {
renderer
.
setJSONObject
(
ret
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -347,21 +347,21 @@ public final class CommentReceiver {
thumbnailURL
=
"http://secure.gravatar.com/avatar/"
+
hashedEmail
+
"?s="
+
size
+
"&d="
+
Latkes
.
getServePath
()
+
"/images/default-user-thumbnail.png"
;
comment
.
put
(
Comment
.
COMMENT_THUMBNAIL_URL
,
thumbnailURL
);
LOGGER
.
log
(
Level
.
FINEST
,
"Comment thumbnail[URL={0}]"
,
thumbnailURL
);
LOGGER
.
log
(
Level
.
TRACE
,
"Comment thumbnail[URL={0}]"
,
thumbnailURL
);
return
;
}
}
else
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Can not fetch thumbnail from Gravatar[commentEmail={0}, statusCode={1}]"
,
LOGGER
.
log
(
Level
.
WARN
,
"Can not fetch thumbnail from Gravatar[commentEmail={0}, statusCode={1}]"
,
new
Object
[]
{
commentEmail
,
statusCode
});
}
}
catch
(
final
IOException
e
)
{
LOGGER
.
warn
ing
(
e
.
getMessage
());
LOGGER
.
log
(
Level
.
WARN
ING
,
"Can not fetch thumbnail from Gravatar[commentEmail={0}]"
,
commentEmail
);
LOGGER
.
warn
(
e
.
getMessage
());
LOGGER
.
log
(
Level
.
WARN
,
"Can not fetch thumbnail from Gravatar[commentEmail={0}]"
,
commentEmail
);
}
if
(
null
==
thumbnailURL
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Not supported yet for comment thumbnail for email[{0}]"
,
commentEmail
);
LOGGER
.
log
(
Level
.
WARN
,
"Not supported yet for comment thumbnail for email[{0}]"
,
commentEmail
);
thumbnailURL
=
"/images/"
+
DEFAULT_USER_THUMBNAIL
;
comment
.
put
(
Comment
.
COMMENT_THUMBNAIL_URL
,
thumbnailURL
);
}
...
...
core/src/main/java/org/b3log/solo/dev/ArticleGenerator.java
View file @
4acc9b1f
...
...
@@ -18,13 +18,13 @@ package org.b3log.solo.dev;
import
java.io.IOException
;
import
java.util.Date
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang.time.DateUtils
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.RuntimeMode
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.HTTPRequestMethod
;
...
...
@@ -64,7 +64,7 @@ public final class ArticleGenerator {
public
void
genArticles
(
final
HTTPRequestContext
context
,
final
HttpServletRequest
request
,
final
HttpServletResponse
response
)
throws
IOException
{
if
(
RuntimeMode
.
DEVELOPMENT
!=
Latkes
.
getRuntimeMode
())
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Article generation just for development mode, "
+
"current runtime mode is [{0}]"
,
LOGGER
.
log
(
Level
.
WARN
,
"Article generation just for development mode, "
+
"current runtime mode is [{0}]"
,
Latkes
.
getRuntimeMode
());
response
.
sendRedirect
(
Latkes
.
getServePath
());
...
...
@@ -117,7 +117,7 @@ public final class ArticleGenerator {
}
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
}
Stopwatchs
.
end
();
...
...
core/src/main/java/org/b3log/solo/event/cache/RemoveCacheListener.java
View file @
4acc9b1f
...
...
@@ -16,12 +16,12 @@
package
org
.
b3log
.
solo
.
event
.
cache
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.cache.PageCaches
;
import
org.b3log.latke.event.AbstractEventListener
;
import
org.b3log.latke.event.Event
;
import
org.b3log.latke.event.EventException
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.service.ServiceException
;
import
org.b3log.solo.service.StatisticMgmtService
;
...
...
@@ -51,13 +51,13 @@ public final class RemoveCacheListener extends AbstractEventListener<Void> {
@Override
public
void
action
(
final
Event
<
Void
>
event
)
throws
EventException
{
LOGGER
.
log
(
Level
.
FINER
,
"Processing an event[type={0} in listener[className={2}]"
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Processing an event[type={0} in listener[className={2}]"
,
new
Object
[]
{
event
.
getType
(),
RemoveCacheListener
.
class
.
getName
()});
try
{
statisticMgmtService
.
flushStatistic
();
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Flushes statistic to repository failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Flushes statistic to repository failed"
,
e
);
}
}
...
...
core/src/main/java/org/b3log/solo/event/comment/ArticleCommentReplyNotifier.java
View file @
4acc9b1f
...
...
@@ -16,13 +16,13 @@
package
org
.
b3log
.
solo
.
event
.
comment
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.event.AbstractEventListener
;
import
org.b3log.latke.event.Event
;
import
org.b3log.latke.event.EventException
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.mail.MailService
;
import
org.b3log.latke.mail.MailService.Message
;
import
org.b3log.latke.mail.MailServiceFactory
;
...
...
@@ -73,12 +73,12 @@ public final class ArticleCommentReplyNotifier extends AbstractEventListener<JSO
final
JSONObject
comment
=
eventData
.
optJSONObject
(
Comment
.
COMMENT
);
final
JSONObject
article
=
eventData
.
optJSONObject
(
Article
.
ARTICLE
);
LOGGER
.
log
(
Level
.
FINER
,
"Processing an event[type={0}, data={1}] in listener[className={2}]"
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Processing an event[type={0}, data={1}] in listener[className={2}]"
,
new
Object
[]
{
event
.
getType
(),
eventData
,
ArticleCommentReplyNotifier
.
class
.
getName
()});
final
String
originalCommentId
=
comment
.
optString
(
Comment
.
COMMENT_ORIGINAL_COMMENT_ID
);
if
(
Strings
.
isEmptyOrNull
(
originalCommentId
))
{
LOGGER
.
log
(
Level
.
FINER
,
"This comment[id={0}] is not a reply"
,
comment
.
optString
(
Keys
.
OBJECT_ID
));
LOGGER
.
log
(
Level
.
DEBUG
,
"This comment[id={0}] is not a reply"
,
comment
.
optString
(
Keys
.
OBJECT_ID
));
return
;
}
...
...
@@ -126,12 +126,12 @@ public final class ArticleCommentReplyNotifier extends AbstractEventListener<JSO
"${replyContent}"
,
commentContent
);
message
.
setHtmlBody
(
mailBody
);
LOGGER
.
log
(
Level
.
FINER
,
"Sending a mail[mailSubject={0}, mailBody=[{1}] to [{2}]"
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Sending a mail[mailSubject={0}, mailBody=[{1}] to [{2}]"
,
new
Object
[]
{
mailSubject
,
mailBody
,
originalCommentEmail
});
mailService
.
send
(
message
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
throw
new
EventException
(
"Reply notifier error!"
);
}
}
...
...
core/src/main/java/org/b3log/solo/event/comment/PageCommentReplyNotifier.java
View file @
4acc9b1f
...
...
@@ -16,13 +16,13 @@
package
org
.
b3log
.
solo
.
event
.
comment
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.event.AbstractEventListener
;
import
org.b3log.latke.event.Event
;
import
org.b3log.latke.event.EventException
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.mail.MailService
;
import
org.b3log.latke.mail.MailService.Message
;
import
org.b3log.latke.mail.MailServiceFactory
;
...
...
@@ -73,12 +73,12 @@ public final class PageCommentReplyNotifier extends AbstractEventListener<JSONOb
final
JSONObject
comment
=
eventData
.
optJSONObject
(
Comment
.
COMMENT
);
final
JSONObject
page
=
eventData
.
optJSONObject
(
Page
.
PAGE
);
LOGGER
.
log
(
Level
.
FINER
,
"Processing an event[type={0}, data={1}] in listener[className={2}]"
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Processing an event[type={0}, data={1}] in listener[className={2}]"
,
new
Object
[]
{
event
.
getType
(),
eventData
,
PageCommentReplyNotifier
.
class
.
getName
()});
final
String
originalCommentId
=
comment
.
optString
(
Comment
.
COMMENT_ORIGINAL_COMMENT_ID
);
if
(
Strings
.
isEmptyOrNull
(
originalCommentId
))
{
LOGGER
.
log
(
Level
.
FINER
,
"This comment[id={0}] is not a reply"
,
comment
.
optString
(
Keys
.
OBJECT_ID
));
LOGGER
.
log
(
Level
.
DEBUG
,
"This comment[id={0}] is not a reply"
,
comment
.
optString
(
Keys
.
OBJECT_ID
));
return
;
}
...
...
@@ -126,11 +126,11 @@ public final class PageCommentReplyNotifier extends AbstractEventListener<JSONOb
"${replyContent}"
,
commentContent
);
message
.
setHtmlBody
(
mailBody
);
LOGGER
.
log
(
Level
.
FINER
,
"Sending a mail[mailSubject={0}, mailBody=[{1}] to [{2}]"
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Sending a mail[mailSubject={0}, mailBody=[{1}] to [{2}]"
,
new
Object
[]
{
mailSubject
,
mailBody
,
originalCommentEmail
});
mailService
.
send
(
message
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
throw
new
EventException
(
"Reply notifier error!"
);
}
}
...
...
core/src/main/java/org/b3log/solo/event/ping/AddArticleGoogleBlogSearchPinger.java
View file @
4acc9b1f
...
...
@@ -18,12 +18,12 @@ package org.b3log.solo.event.ping;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.event.AbstractEventListener
;
import
org.b3log.latke.event.Event
;
import
org.b3log.latke.event.EventException
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.urlfetch.HTTPRequest
;
import
org.b3log.latke.urlfetch.URLFetchService
;
import
org.b3log.latke.urlfetch.URLFetchServiceFactory
;
...
...
@@ -96,7 +96,7 @@ public final class AddArticleGoogleBlogSearchPinger extends AbstractEventListene
final
String
spec
=
"http://blogsearch.google.com/ping?name="
+
URLEncoder
.
encode
(
blogTitle
,
"UTF-8"
)
+
"&url="
+
URLEncoder
.
encode
(
Latkes
.
getServePath
(),
"UTF-8"
)
+
"&changesURL="
+
URLEncoder
.
encode
(
articlePermalink
,
"UTF-8"
);
LOGGER
.
log
(
Level
.
FINER
,
"Request Google Blog Search Service API[{0}] while adding an "
+
"article[title="
+
articleTitle
+
"]"
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Request Google Blog Search Service API[{0}] while adding an "
+
"article[title="
+
articleTitle
+
"]"
,
spec
);
final
HTTPRequest
request
=
new
HTTPRequest
();
...
...
@@ -104,7 +104,7 @@ public final class AddArticleGoogleBlogSearchPinger extends AbstractEventListene
URL_FETCH_SERVICE
.
fetchAsync
(
request
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Ping Google Blog Search Service fail while adding an article[title="
+
articleTitle
+
"]"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Ping Google Blog Search Service fail while adding an article[title="
+
articleTitle
+
"]"
,
e
);
}
}
}
core/src/main/java/org/b3log/solo/event/ping/UpdateArticleGoogleBlogSearchPinger.java
View file @
4acc9b1f
...
...
@@ -18,12 +18,12 @@ package org.b3log.solo.event.ping;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.event.AbstractEventListener
;
import
org.b3log.latke.event.Event
;
import
org.b3log.latke.event.EventException
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.urlfetch.HTTPRequest
;
import
org.b3log.latke.urlfetch.URLFetchService
;
import
org.b3log.latke.urlfetch.URLFetchServiceFactory
;
...
...
@@ -96,14 +96,14 @@ public final class UpdateArticleGoogleBlogSearchPinger extends AbstractEventList
final
String
spec
=
"http://blogsearch.google.com/ping?name="
+
URLEncoder
.
encode
(
blogTitle
,
"UTF-8"
)
+
"&url="
+
URLEncoder
.
encode
(
Latkes
.
getServePath
(),
"UTF-8"
)
+
"&changesURL="
+
URLEncoder
.
encode
(
articlePermalink
,
"UTF-8"
);
LOGGER
.
log
(
Level
.
FINER
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Request Google Blog Search Service API[{0}] while updateing "
+
"an article[title="
+
articleTitle
+
"]"
,
spec
);
final
HTTPRequest
request
=
new
HTTPRequest
();
request
.
setURL
(
new
URL
(
spec
));
URL_FETCH_SERVICE
.
fetchAsync
(
request
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Ping Google Blog Search Service fail while updating an "
+
"article[title="
+
articleTitle
+
"]"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Ping Google Blog Search Service fail while updating an "
+
"article[title="
+
articleTitle
+
"]"
,
e
);
}
}
}
core/src/main/java/org/b3log/solo/event/plugin/PluginRefresher.java
View file @
4acc9b1f
...
...
@@ -17,11 +17,11 @@ package org.b3log.solo.event.plugin;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.event.AbstractEventListener
;
import
org.b3log.latke.event.Event
;
import
org.b3log.latke.event.EventException
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.plugin.AbstractPlugin
;
import
org.b3log.latke.plugin.PluginManager
;
import
org.b3log.latke.repository.Transaction
;
...
...
@@ -54,7 +54,7 @@ public final class PluginRefresher extends AbstractEventListener<List<AbstractPl
EventException
{
final
List
<
AbstractPlugin
>
plugins
=
event
.
getData
();
LOGGER
.
log
(
Level
.
FINER
,
"Processing an event[type={0}, data={1}] in listener[className={2}]"
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Processing an event[type={0}, data={1}] in listener[className={2}]"
,
new
Object
[]
{
event
.
getType
(),
plugins
,
PluginRefresher
.
class
.
getName
()});
final
Transaction
transaction
=
pluginRepository
.
beginTransaction
();
...
...
@@ -68,7 +68,7 @@ public final class PluginRefresher extends AbstractEventListener<List<AbstractPl
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Processing plugin loaded event error"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Processing plugin loaded event error"
,
e
);
throw
new
EventException
(
e
);
}
}
...
...
core/src/main/java/org/b3log/solo/event/rhythm/ArticleSender.java
View file @
4acc9b1f
...
...
@@ -19,13 +19,13 @@ package org.b3log.solo.event.rhythm;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.util.Date
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.event.AbstractEventListener
;
import
org.b3log.latke.event.Event
;
import
org.b3log.latke.event.EventException
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.servlet.HTTPRequestMethod
;
import
org.b3log.latke.urlfetch.HTTPRequest
;
import
org.b3log.latke.urlfetch.URLFetchService
;
...
...
@@ -77,7 +77,7 @@ public final class ArticleSender extends AbstractEventListener<JSONObject> {
try
{
ADD_ARTICLE_URL
=
new
URL
(
SoloServletListener
.
B3LOG_RHYTHM_SERVE_PATH
+
"/article"
);
}
catch
(
final
MalformedURLException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Creates remote service address[rhythm add article] error!"
);
LOGGER
.
log
(
Level
.
ERROR
,
"Creates remote service address[rhythm add article] error!"
);
throw
new
IllegalStateException
(
e
);
}
}
...
...
@@ -86,13 +86,13 @@ public final class ArticleSender extends AbstractEventListener<JSONObject> {
public
void
action
(
final
Event
<
JSONObject
>
event
)
throws
EventException
{
final
JSONObject
data
=
event
.
getData
();
LOGGER
.
log
(
Level
.
FINER
,
"Processing an event[type={0}, data={1}] in listener[className={2}]"
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Processing an event[type={0}, data={1}] in listener[className={2}]"
,
new
Object
[]
{
event
.
getType
(),
data
,
ArticleSender
.
class
.
getName
()});
try
{
final
JSONObject
originalArticle
=
data
.
getJSONObject
(
Article
.
ARTICLE
);
if
(!
originalArticle
.
getBoolean
(
Article
.
ARTICLE_IS_PUBLISHED
))
{
LOGGER
.
log
(
Level
.
FINER
,
"Ignores post article[title={0}] to Rhythm"
,
originalArticle
.
getString
(
Article
.
ARTICLE_TITLE
));
LOGGER
.
log
(
Level
.
DEBUG
,
"Ignores post article[title={0}] to Rhythm"
,
originalArticle
.
getString
(
Article
.
ARTICLE_TITLE
));
return
;
}
...
...
@@ -141,10 +141,10 @@ public final class ArticleSender extends AbstractEventListener<JSONObject> {
urlFetchService
.
fetchAsync
(
httpRequest
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Sends an article to Rhythm error: {0}"
,
e
.
getMessage
());
LOGGER
.
log
(
Level
.
ERROR
,
"Sends an article to Rhythm error: {0}"
,
e
.
getMessage
());
}
LOGGER
.
log
(
Level
.
FINER
,
"Sent an article to Rhythm"
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Sent an article to Rhythm"
);
}
/**
...
...
core/src/main/java/org/b3log/solo/event/rhythm/ArticleUpdater.java
View file @
4acc9b1f
...
...
@@ -19,13 +19,13 @@ package org.b3log.solo.event.rhythm;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.util.Date
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.event.AbstractEventListener
;
import
org.b3log.latke.event.Event
;
import
org.b3log.latke.event.EventException
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.servlet.HTTPRequestMethod
;
import
org.b3log.latke.urlfetch.HTTPRequest
;
import
org.b3log.latke.urlfetch.URLFetchService
;
...
...
@@ -76,7 +76,7 @@ public final class ArticleUpdater extends AbstractEventListener<JSONObject> {
try
{
UPDATE_ARTICLE_URL
=
new
URL
(
SoloServletListener
.
B3LOG_RHYTHM_SERVE_PATH
+
"/article"
);
}
catch
(
final
MalformedURLException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Creates remote service address[rhythm update article] error!"
);
LOGGER
.
log
(
Level
.
ERROR
,
"Creates remote service address[rhythm update article] error!"
);
throw
new
IllegalStateException
(
e
);
}
}
...
...
@@ -85,13 +85,13 @@ public final class ArticleUpdater extends AbstractEventListener<JSONObject> {
public
void
action
(
final
Event
<
JSONObject
>
event
)
throws
EventException
{
final
JSONObject
data
=
event
.
getData
();
LOGGER
.
log
(
Level
.
FINER
,
"Processing an event[type={0}, data={1}] in listener[className={2}]"
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Processing an event[type={0}, data={1}] in listener[className={2}]"
,
new
Object
[]
{
event
.
getType
(),
data
,
ArticleUpdater
.
class
.
getName
()});
try
{
final
JSONObject
originalArticle
=
data
.
getJSONObject
(
Article
.
ARTICLE
);
if
(!
originalArticle
.
getBoolean
(
Article
.
ARTICLE_IS_PUBLISHED
))
{
LOGGER
.
log
(
Level
.
FINER
,
"Ignores post article[title={0}] to Rhythm"
,
originalArticle
.
getString
(
Article
.
ARTICLE_TITLE
));
LOGGER
.
log
(
Level
.
DEBUG
,
"Ignores post article[title={0}] to Rhythm"
,
originalArticle
.
getString
(
Article
.
ARTICLE_TITLE
));
return
;
}
...
...
@@ -140,10 +140,10 @@ public final class ArticleUpdater extends AbstractEventListener<JSONObject> {
urlFetchService
.
fetchAsync
(
httpRequest
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Sends an article to Rhythm error: {0}"
,
e
.
getMessage
());
LOGGER
.
log
(
Level
.
ERROR
,
"Sends an article to Rhythm error: {0}"
,
e
.
getMessage
());
}
LOGGER
.
log
(
Level
.
FINER
,
"Sent an article to Rhythm"
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Sent an article to Rhythm"
);
}
/**
...
...
core/src/main/java/org/b3log/solo/event/symphony/CommentSender.java
View file @
4acc9b1f
...
...
@@ -18,13 +18,13 @@ package org.b3log.solo.event.symphony;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.event.AbstractEventListener
;
import
org.b3log.latke.event.Event
;
import
org.b3log.latke.event.EventException
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.servlet.HTTPRequestMethod
;
import
org.b3log.latke.urlfetch.HTTPRequest
;
import
org.b3log.latke.urlfetch.URLFetchService
;
...
...
@@ -71,7 +71,7 @@ public final class CommentSender extends AbstractEventListener<JSONObject> {
try
{
ADD_COMMENT_URL
=
new
URL
(
SoloServletListener
.
B3LOG_SYMPHONY_SERVE_PATH
+
"/solo/comment"
);
}
catch
(
final
MalformedURLException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Creates remote service address[symphony add comment] error!"
);
LOGGER
.
log
(
Level
.
ERROR
,
"Creates remote service address[symphony add comment] error!"
);
throw
new
IllegalStateException
(
e
);
}
}
...
...
@@ -80,7 +80,7 @@ public final class CommentSender extends AbstractEventListener<JSONObject> {
public
void
action
(
final
Event
<
JSONObject
>
event
)
throws
EventException
{
final
JSONObject
data
=
event
.
getData
();
LOGGER
.
log
(
Level
.
FINER
,
"Processing an event[type={0}, data={1}] in listener[className={2}]"
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Processing an event[type={0}, data={1}] in listener[className={2}]"
,
new
Object
[]
{
event
.
getType
(),
data
,
ArticleSender
.
class
.
getName
()});
try
{
final
JSONObject
originalComment
=
data
.
getJSONObject
(
Comment
.
COMMENT
);
...
...
@@ -122,10 +122,10 @@ public final class CommentSender extends AbstractEventListener<JSONObject> {
urlFetchService
.
fetchAsync
(
httpRequest
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Sends a comment to Symphony error: {0}"
,
e
.
getMessage
());
LOGGER
.
log
(
Level
.
ERROR
,
"Sends a comment to Symphony error: {0}"
,
e
.
getMessage
());
}
LOGGER
.
log
(
Level
.
FINER
,
"Sent a comment to Symphony"
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Sent a comment to Symphony"
);
}
/**
...
...
core/src/main/java/org/b3log/solo/filter/AuthFilter.java
View file @
4acc9b1f
...
...
@@ -16,8 +16,6 @@
package
org
.
b3log
.
solo
.
filter
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.io.IOException
;
import
javax.servlet.Filter
;
import
javax.servlet.FilterChain
;
...
...
@@ -27,6 +25,8 @@ import javax.servlet.ServletRequest;
import
javax.servlet.ServletResponse
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.user.GeneralUser
;
import
org.b3log.latke.user.UserService
;
import
org.b3log.latke.user.UserServiceFactory
;
...
...
@@ -85,7 +85,7 @@ public final class AuthFilter implements Filter {
final
GeneralUser
currentUser
=
userService
.
getCurrentUser
(
httpServletRequest
);
if
(
null
==
currentUser
)
{
LOGGER
.
warn
ing
(
"The request has been forbidden"
);
LOGGER
.
warn
(
"The request has been forbidden"
);
httpServletResponse
.
sendError
(
HttpServletResponse
.
SC_FORBIDDEN
);
return
;
...
...
@@ -93,14 +93,14 @@ public final class AuthFilter implements Filter {
final
String
currentUserEmail
=
currentUser
.
getEmail
();
LOGGER
.
log
(
Level
.
FINER
,
"Current user email[{0}]"
,
currentUserEmail
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Current user email[{0}]"
,
currentUserEmail
);
if
(
users
.
isSoloUser
(
currentUserEmail
))
{
chain
.
doFilter
(
request
,
response
);
return
;
}
LOGGER
.
warn
ing
(
"The request has been forbidden"
);
LOGGER
.
warn
(
"The request has been forbidden"
);
httpServletResponse
.
sendError
(
HttpServletResponse
.
SC_FORBIDDEN
);
}
catch
(
final
Exception
e
)
{
httpServletResponse
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
...
...
core/src/main/java/org/b3log/solo/filter/InitCheckFilter.java
View file @
4acc9b1f
...
...
@@ -17,8 +17,6 @@ package org.b3log.solo.filter;
import
java.io.IOException
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.Filter
;
import
javax.servlet.FilterChain
;
import
javax.servlet.FilterConfig
;
...
...
@@ -29,6 +27,8 @@ import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.service.ServiceException
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.HTTPRequestDispatcher
;
...
...
@@ -75,7 +75,7 @@ public final class InitCheckFilter implements Filter {
final
HttpServletRequest
httpServletRequest
=
(
HttpServletRequest
)
request
;
final
String
requestURI
=
httpServletRequest
.
getRequestURI
();
LOGGER
.
log
(
Level
.
FINEST
,
"Request[URI={0}]"
,
requestURI
);
LOGGER
.
log
(
Level
.
TRACE
,
"Request[URI={0}]"
,
requestURI
);
if
(
requestURI
.
startsWith
(
"/latke/remote"
))
{
// If requests Latke Remote APIs, skips this filter
...
...
@@ -98,11 +98,11 @@ public final class InitCheckFilter implements Filter {
return
;
}
LOGGER
.
finer
(
"Try to get preference to confirm whether the preference exixts"
);
LOGGER
.
debug
(
"Try to get preference to confirm whether the preference exixts"
);
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
if
(
null
==
preference
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"B3log Solo has not been initialized, so redirects to /init"
);
LOGGER
.
log
(
Level
.
WARN
,
"B3log Solo has not been initialized, so redirects to /init"
);
final
HTTPRequestContext
context
=
new
HTTPRequestContext
();
...
...
core/src/main/java/org/b3log/solo/filter/PageCacheFilter.java
View file @
4acc9b1f
...
...
@@ -18,8 +18,6 @@ package org.b3log.solo.filter;
import
java.io.IOException
;
import
java.io.PrintWriter
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.Filter
;
import
javax.servlet.FilterChain
;
import
javax.servlet.FilterConfig
;
...
...
@@ -32,6 +30,8 @@ import org.apache.commons.lang.time.DateFormatUtils;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.cache.PageCaches
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.RepositoryException
;
import
org.b3log.latke.service.LangPropsService
;
import
org.b3log.latke.service.ServiceException
;
...
...
@@ -105,19 +105,19 @@ public final class PageCacheFilter implements Filter {
final
HttpServletRequest
httpServletRequest
=
(
HttpServletRequest
)
request
;
final
String
requestURI
=
httpServletRequest
.
getRequestURI
();
LOGGER
.
log
(
Level
.
FINER
,
"Request URI[{0}]"
,
requestURI
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Request URI[{0}]"
,
requestURI
);
if
(
StaticResources
.
isStatic
(
httpServletRequest
))
{
final
String
path
=
httpServletRequest
.
getServletPath
()
+
httpServletRequest
.
getPathInfo
();
LOGGER
.
log
(
Level
.
FINEST
,
"Requests a static resource, forwards to servlet[path={0}]"
,
path
);
LOGGER
.
log
(
Level
.
TRACE
,
"Requests a static resource, forwards to servlet[path={0}]"
,
path
);
request
.
getRequestDispatcher
(
path
).
forward
(
request
,
response
);
return
;
}
if
(!
Latkes
.
isPageCacheEnabled
())
{
LOGGER
.
log
(
Level
.
FINEST
,
"Page cache is disabled"
);
LOGGER
.
log
(
Level
.
TRACE
,
"Page cache is disabled"
);
chain
.
doFilter
(
request
,
response
);
return
;
...
...
@@ -144,7 +144,7 @@ public final class PageCacheFilter implements Filter {
final
JSONObject
cachedPageContentObject
=
PageCaches
.
get
(
pageCacheKey
,
httpServletRequest
,
(
HttpServletResponse
)
response
);
if
(
null
==
cachedPageContentObject
)
{
LOGGER
.
log
(
Level
.
FINER
,
"Page cache miss for request URI[{0}]"
,
requestURI
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Page cache miss for request URI[{0}]"
,
requestURI
);
chain
.
doFilter
(
request
,
response
);
return
;
...
...
@@ -179,12 +179,12 @@ public final class PageCacheFilter implements Filter {
}
}
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
chain
.
doFilter
(
request
,
response
);
}
try
{
LOGGER
.
log
(
Level
.
FINEST
,
"Writes resposne for page[pageCacheKey={0}] from cache"
,
pageCacheKey
);
LOGGER
.
log
(
Level
.
TRACE
,
"Writes resposne for page[pageCacheKey={0}] from cache"
,
pageCacheKey
);
response
.
setContentType
(
"text/html"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
final
PrintWriter
writer
=
response
.
getWriter
();
...
...
@@ -195,7 +195,7 @@ public final class PageCacheFilter implements Filter {
final
String
cachedTitle
=
cachedPageContentObject
.
getString
(
PageCaches
.
CACHED_TITLE
);
LOGGER
.
log
(
Level
.
FINEST
,
"Cached value[key={0}, type={1}, title={2}]"
,
new
Object
[]
{
pageCacheKey
,
cachedType
,
cachedTitle
});
LOGGER
.
log
(
Level
.
TRACE
,
"Cached value[key={0}, type={1}, title={2}]"
,
new
Object
[]
{
pageCacheKey
,
cachedType
,
cachedTitle
});
statistics
.
incBlogViewCount
((
HttpServletRequest
)
request
,
(
HttpServletResponse
)
response
);
...
...
@@ -203,19 +203,19 @@ public final class PageCacheFilter implements Filter {
final
String
dateString
=
DateFormatUtils
.
format
(
endimeMillis
,
"yyyy/MM/dd HH:mm:ss"
);
final
String
msg
=
String
.
format
(
"<!-- Cached by B3log Solo(%1$d ms), %2$s -->"
,
endimeMillis
-
startTimeMillis
,
dateString
);
LOGGER
.
finer
(
msg
);
LOGGER
.
debug
(
msg
);
cachedPageContent
+=
Strings
.
LINE_SEPARATOR
+
msg
;
writer
.
write
(
cachedPageContent
);
writer
.
flush
();
writer
.
close
();
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
chain
.
doFilter
(
request
,
response
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
chain
.
doFilter
(
request
,
response
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
chain
.
doFilter
(
request
,
response
);
}
}
...
...
core/src/main/java/org/b3log/solo/filter/PermalinkFilter.java
View file @
4acc9b1f
...
...
@@ -17,8 +17,6 @@ package org.b3log.solo.filter;
import
java.io.IOException
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.Filter
;
import
javax.servlet.FilterChain
;
import
javax.servlet.FilterConfig
;
...
...
@@ -30,6 +28,8 @@ import javax.servlet.http.HttpServletResponse;
import
org.apache.commons.lang.StringUtils
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.RepositoryException
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.HTTPRequestDispatcher
;
...
...
@@ -97,13 +97,13 @@ public final class PermalinkFilter implements Filter {
final
String
requestURI
=
httpServletRequest
.
getRequestURI
();
LOGGER
.
log
(
Level
.
FINER
,
"Request URI[{0}]"
,
requestURI
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Request URI[{0}]"
,
requestURI
);
final
String
contextPath
=
Latkes
.
getContextPath
();
final
String
permalink
=
StringUtils
.
substringAfter
(
requestURI
,
contextPath
);
if
(
Permalinks
.
invalidPermalinkFormat
(
permalink
))
{
LOGGER
.
log
(
Level
.
FINER
,
"Skip filter request[URI={0}]"
,
permalink
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Skip filter request[URI={0}]"
,
permalink
);
chain
.
doFilter
(
request
,
response
);
return
;
...
...
@@ -118,14 +118,14 @@ public final class PermalinkFilter implements Filter {
page
=
pageRepository
.
getByPermalink
(
permalink
);
}
if
(
null
==
page
&&
null
==
article
)
{
LOGGER
.
log
(
Level
.
FINER
,
"Not found article/page with permalink[{0}]"
,
permalink
);
if
(
null
==
page
)
{
LOGGER
.
log
(
Level
.
DEBUG
,
"Not found article/page with permalink[{0}]"
,
permalink
);
chain
.
doFilter
(
request
,
response
);
return
;
}
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Processes article permalink filter failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Processes article permalink filter failed"
,
e
);
httpServletResponse
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
return
;
...
...
core/src/main/java/org/b3log/solo/model/Preference.java
View file @
4acc9b1f
...
...
@@ -16,11 +16,11 @@
package
org
.
b3log
.
solo
.
model
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.RuntimeEnv
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
...
...
@@ -429,7 +429,7 @@ public final class Preference {
DEFAULT_PAGE_CACHE_ENABLED
=
true
;
}
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Creates sign error!"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Creates sign error!"
,
e
);
throw
new
IllegalStateException
(
e
);
}
}
...
...
core/src/main/java/org/b3log/solo/plugin/broadcast/ChanceProcessor.java
View file @
4acc9b1f
...
...
@@ -19,12 +19,12 @@ package org.b3log.solo.plugin.broadcast;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.util.concurrent.Future
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.HTTPRequestMethod
;
import
org.b3log.latke.servlet.annotation.RequestProcessing
;
...
...
@@ -91,7 +91,7 @@ public final class ChanceProcessor {
try
{
ADD_BROADCAST_URL
=
new
URL
(
SoloServletListener
.
B3LOG_RHYTHM_SERVE_PATH
+
"/broadcast"
);
}
catch
(
final
MalformedURLException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Creates remote service address[rhythm add broadcast] error!"
);
LOGGER
.
log
(
Level
.
ERROR
,
"Creates remote service address[rhythm add broadcast] error!"
);
throw
new
IllegalStateException
(
e
);
}
}
...
...
@@ -150,7 +150,7 @@ public final class ChanceProcessor {
}
catch
(
final
Exception
e
)
{
final
String
msg
=
"Broadcast plugin exception"
;
LOGGER
.
log
(
Level
.
SEVERE
,
msg
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
msg
,
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -220,7 +220,7 @@ public final class ChanceProcessor {
ret
.
put
(
Option
.
ID_C_BROADCAST_CHANCE_EXPIRATION_TIME
,
option
.
getLong
(
Option
.
OPTION_VALUE
));
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Broadcast plugin exception"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Broadcast plugin exception"
,
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -317,7 +317,7 @@ public final class ChanceProcessor {
ret
.
put
(
Keys
.
STATUS_CODE
,
false
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Submits broadcast failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Submits broadcast failed"
,
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
core/src/main/java/org/b3log/solo/plugin/cache/AdminCacheService.java
View file @
4acc9b1f
...
...
@@ -19,8 +19,6 @@ package org.b3log.solo.plugin.cache;
import
org.b3log.solo.model.Common
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
...
...
@@ -29,6 +27,8 @@ import org.b3log.latke.model.Pagination;
import
org.b3log.solo.model.Page
;
import
org.b3log.solo.util.Users
;
import
org.b3log.latke.cache.PageCaches
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.HTTPRequestMethod
;
import
org.b3log.latke.servlet.annotation.RequestProcessing
;
...
...
@@ -122,7 +122,7 @@ public final class AdminCacheService {
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -212,7 +212,7 @@ public final class AdminCacheService {
final
List
<
JSONObject
>
pages
=
new
ArrayList
<
JSONObject
>();
for
(
final
String
key
:
keys
)
{
LOGGER
.
log
(
Level
.
FINER
,
"Cached page[key={0}]"
,
key
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Cached page[key={0}]"
,
key
);
JSONObject
cachedPage
=
PageCaches
.
get
(
key
);
...
...
@@ -228,7 +228,7 @@ public final class AdminCacheService {
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -286,7 +286,7 @@ public final class AdminCacheService {
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Sets page cache error: {0}"
,
e
.
getMessage
());
LOGGER
.
log
(
Level
.
ERROR
,
"Sets page cache error: {0}"
,
e
.
getMessage
());
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
core/src/main/java/org/b3log/solo/processor/ArticleProcessor.java
View file @
4acc9b1f
...
...
@@ -20,8 +20,6 @@ import java.io.IOException;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
java.util.*
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
...
...
@@ -30,6 +28,8 @@ import org.apache.commons.lang.time.DateFormatUtils;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.cache.PageCaches
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Pagination
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.service.LangPropsService
;
...
...
@@ -222,7 +222,7 @@ public final class ArticleProcessor {
response
.
sendRedirect
(
Latkes
.
getServePath
()
+
"/console/article-pwd?articleId="
+
article
.
optString
(
Keys
.
OBJECT_ID
)
+
"&msg=1"
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Processes article view password form submits failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Processes article view password form submits failed"
,
e
);
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
}
...
...
@@ -347,7 +347,7 @@ public final class ArticleProcessor {
try
{
content
=
articleQueryService
.
getArticleContent
(
articleId
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Can not get article content"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Can not get article content"
,
e
);
return
;
}
...
...
@@ -404,7 +404,7 @@ public final class ArticleProcessor {
jsonObject
.
put
(
Keys
.
RESULTS
,
result
);
}
catch
(
final
Exception
e
)
{
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
false
);
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets article paged failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets article paged failed"
,
e
);
}
finally
{
Stopwatchs
.
end
();
}
...
...
@@ -430,7 +430,7 @@ public final class ArticleProcessor {
try
{
tagTitle
=
URLDecoder
.
decode
(
tagTitle
,
"UTF-8"
);
}
catch
(
final
UnsupportedEncodingException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets tag title failed[requestURI="
+
request
.
getRequestURI
()
+
']'
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets tag title failed[requestURI="
+
request
.
getRequestURI
()
+
']'
,
e
);
tagTitle
=
""
;
}
...
...
@@ -482,7 +482,7 @@ public final class ArticleProcessor {
jsonObject
.
put
(
Keys
.
RESULTS
,
result
);
}
catch
(
final
Exception
e
)
{
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
false
);
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets article paged failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets article paged failed"
,
e
);
}
finally
{
Stopwatchs
.
end
();
}
...
...
@@ -553,7 +553,7 @@ public final class ArticleProcessor {
jsonObject
.
put
(
Keys
.
RESULTS
,
result
);
}
catch
(
final
Exception
e
)
{
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
false
);
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets article paged failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets article paged failed"
,
e
);
}
finally
{
Stopwatchs
.
end
();
}
...
...
@@ -617,7 +617,7 @@ public final class ArticleProcessor {
jsonObject
.
put
(
Keys
.
RESULTS
,
result
);
}
catch
(
final
Exception
e
)
{
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
false
);
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets article paged failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets article paged failed"
,
e
);
}
finally
{
Stopwatchs
.
end
();
}
...
...
@@ -655,7 +655,7 @@ public final class ArticleProcessor {
final
String
authorId
=
getAuthorId
(
requestURI
);
LOGGER
.
log
(
Level
.
FINER
,
"Request author articles[requestURI={0}, authorId={1}]"
,
new
Object
[]
{
requestURI
,
authorId
});
LOGGER
.
log
(
Level
.
DEBUG
,
"Request author articles[requestURI={0}, authorId={1}]"
,
new
Object
[]
{
requestURI
,
authorId
});
final
int
currentPageNum
=
getAuthorCurrentPageNum
(
requestURI
,
authorId
);
...
...
@@ -664,7 +664,7 @@ public final class ArticleProcessor {
return
;
}
LOGGER
.
log
(
Level
.
FINER
,
"Request author articles[authorId={0}, currentPageNum={1}]"
,
new
Object
[]
{
authorId
,
currentPageNum
});
LOGGER
.
log
(
Level
.
DEBUG
,
"Request author articles[authorId={0}, currentPageNum={1}]"
,
new
Object
[]
{
authorId
,
currentPageNum
});
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
...
...
@@ -704,7 +704,7 @@ public final class ArticleProcessor {
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
return
;
}
catch
(
final
IOException
ex
)
{
LOGGER
.
severe
(
ex
.
getMessage
());
LOGGER
.
error
(
ex
.
getMessage
());
}
}
...
...
@@ -730,12 +730,12 @@ public final class ArticleProcessor {
Skins
.
fillSkinLangs
(
preference
.
optString
(
Preference
.
LOCALE_STRING
),
(
String
)
request
.
getAttribute
(
Keys
.
TEMAPLTE_DIR_NAME
),
dataModel
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
try
{
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
}
catch
(
final
IOException
ex
)
{
LOGGER
.
severe
(
ex
.
getMessage
());
LOGGER
.
error
(
ex
.
getMessage
());
}
}
}
...
...
@@ -771,11 +771,11 @@ public final class ArticleProcessor {
return
;
}
LOGGER
.
log
(
Level
.
FINER
,
"Request archive date[string={0}, currentPageNum={1}]"
,
new
Object
[]
{
archiveDateString
,
currentPageNum
});
LOGGER
.
log
(
Level
.
DEBUG
,
"Request archive date[string={0}, currentPageNum={1}]"
,
new
Object
[]
{
archiveDateString
,
currentPageNum
});
final
JSONObject
result
=
archiveDateQueryService
.
getByArchiveDateString
(
archiveDateString
);
if
(
null
==
result
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Can not find articles for the specified archive date[string={0}]"
,
archiveDateString
);
LOGGER
.
log
(
Level
.
WARN
,
"Can not find articles for the specified archive date[string={0}]"
,
archiveDateString
);
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
return
;
}
...
...
@@ -796,7 +796,7 @@ public final class ArticleProcessor {
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
return
;
}
catch
(
final
IOException
ex
)
{
LOGGER
.
severe
(
ex
.
getMessage
());
LOGGER
.
error
(
ex
.
getMessage
());
}
}
...
...
@@ -833,12 +833,12 @@ public final class ArticleProcessor {
request
.
setAttribute
(
PageCaches
.
CACHED_TITLE
,
cachedTitle
+
" ["
+
langs
.
get
(
"pageNumLabel"
)
+
"="
+
currentPageNum
+
"]"
);
request
.
setAttribute
(
PageCaches
.
CACHED_LINK
,
requestURI
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
try
{
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
}
catch
(
final
IOException
ex
)
{
LOGGER
.
severe
(
ex
.
getMessage
());
LOGGER
.
error
(
ex
.
getMessage
());
}
}
}
...
...
@@ -856,13 +856,13 @@ public final class ArticleProcessor {
// updateCnt =
// Integer.valueOf(request.getParameter("cnt"));
// } catch (final NumberFormatException e) {
// LOGGER.log(Level.WARN
ING
, e.getMessage(), e);
// LOGGER.log(Level.WARN, e.getMessage(), e);
// }
//
// try {
// articleMgmtService.updateArticlesRandomValue(updateCnt);
// } catch (final ServiceException e) {
// LOGGER.log(Level.
SEVERE
, "Updates articles random values failed", e);
// LOGGER.log(Level.
ERROR
, "Updates articles random values failed", e);
// }
}
...
...
@@ -887,7 +887,7 @@ public final class ArticleProcessor {
final
String
articleId
=
article
.
optString
(
Keys
.
OBJECT_ID
);
LOGGER
.
log
(
Level
.
FINER
,
"Article[id={0}]"
,
articleId
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Article[id={0}]"
,
articleId
);
final
AbstractFreeMarkerRenderer
renderer
=
new
FrontRenderer
();
context
.
setRenderer
(
renderer
);
...
...
@@ -904,7 +904,7 @@ public final class ArticleProcessor {
return
;
}
LOGGER
.
log
(
Level
.
FINEST
,
"Article[title={0}]"
,
article
.
getString
(
Article
.
ARTICLE_TITLE
));
LOGGER
.
log
(
Level
.
TRACE
,
"Article[title={0}]"
,
article
.
getString
(
Article
.
ARTICLE_TITLE
));
articleQueryService
.
markdown
(
article
);
...
...
@@ -952,12 +952,12 @@ public final class ArticleProcessor {
ArticleMgmtService
.
getInstance
().
incViewCount
(
articleId
);
}
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
try
{
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
}
catch
(
final
IOException
ex
)
{
LOGGER
.
severe
(
ex
.
getMessage
());
LOGGER
.
error
(
ex
.
getMessage
());
}
}
}
...
...
@@ -1138,7 +1138,7 @@ public final class ArticleProcessor {
return
ret
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
return
Collections
.
emptyList
();
}
...
...
@@ -1278,35 +1278,35 @@ public final class ArticleProcessor {
final
String
articleId
=
article
.
getString
(
Keys
.
OBJECT_ID
);
Stopwatchs
.
start
(
"Get Article Sign"
);
LOGGER
.
finer
(
"Getting article sign...."
);
LOGGER
.
debug
(
"Getting article sign...."
);
article
.
put
(
Common
.
ARTICLE_SIGN
,
articleUtils
.
getSign
(
article
.
getString
(
Article
.
ARTICLE_SIGN_ID
),
preference
));
LOGGER
.
finer
(
"Got article sign"
);
LOGGER
.
debug
(
"Got article sign"
);
Stopwatchs
.
end
();
Stopwatchs
.
start
(
"Get Next Article"
);
LOGGER
.
finer
(
"Getting the next article...."
);
LOGGER
.
debug
(
"Getting the next article...."
);
final
JSONObject
nextArticle
=
articleQueryService
.
getNextArticle
(
articleId
);
if
(
null
!=
nextArticle
)
{
dataModel
.
put
(
Common
.
NEXT_ARTICLE_PERMALINK
,
nextArticle
.
getString
(
Article
.
ARTICLE_PERMALINK
));
dataModel
.
put
(
Common
.
NEXT_ARTICLE_TITLE
,
nextArticle
.
getString
(
Article
.
ARTICLE_TITLE
));
LOGGER
.
finer
(
"Got the next article"
);
LOGGER
.
debug
(
"Got the next article"
);
}
Stopwatchs
.
end
();
Stopwatchs
.
start
(
"Get Previous Article"
);
LOGGER
.
finer
(
"Getting the previous article...."
);
LOGGER
.
debug
(
"Getting the previous article...."
);
final
JSONObject
previousArticle
=
articleQueryService
.
getPreviousArticle
(
articleId
);
if
(
null
!=
previousArticle
)
{
dataModel
.
put
(
Common
.
PREVIOUS_ARTICLE_PERMALINK
,
previousArticle
.
getString
(
Article
.
ARTICLE_PERMALINK
));
dataModel
.
put
(
Common
.
PREVIOUS_ARTICLE_TITLE
,
previousArticle
.
getString
(
Article
.
ARTICLE_TITLE
));
LOGGER
.
finer
(
"Got the previous article"
);
LOGGER
.
debug
(
"Got the previous article"
);
}
Stopwatchs
.
end
();
Stopwatchs
.
start
(
"Get Article CMTs"
);
LOGGER
.
finer
(
"Getting article's comments...."
);
LOGGER
.
debug
(
"Getting article's comments...."
);
final
int
cmtCount
=
article
.
getInt
(
Article
.
ARTICLE_COMMENT_COUNT
);
if
(
0
!=
cmtCount
)
{
...
...
@@ -1316,7 +1316,7 @@ public final class ArticleProcessor {
}
else
{
dataModel
.
put
(
Article
.
ARTICLE_COMMENTS_REF
,
Collections
.
emptyList
());
}
LOGGER
.
finer
(
"Got article's comments"
);
LOGGER
.
debug
(
"Got article's comments"
);
Stopwatchs
.
end
();
dataModel
.
put
(
Preference
.
EXTERNAL_RELEVANT_ARTICLES_DISPLAY_CNT
,
...
...
core/src/main/java/org/b3log/solo/processor/CacheProcessor.java
View file @
4acc9b1f
...
...
@@ -17,11 +17,11 @@ package org.b3log.solo.processor;
import
java.io.IOException
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.cache.PageCaches
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.HTTPRequestMethod
;
import
org.b3log.latke.servlet.annotation.RequestProcessing
;
...
...
@@ -86,7 +86,7 @@ public final class CacheProcessor {
context
.
setRenderer
(
new
DoNothingRenderer
());
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
}
}
...
...
core/src/main/java/org/b3log/solo/processor/CaptchaProcessor.java
View file @
4acc9b1f
...
...
@@ -24,8 +24,6 @@ import java.io.OutputStream;
import
java.net.URL
;
import
java.util.Enumeration
;
import
java.util.Random
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipFile
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -37,6 +35,8 @@ import org.b3log.latke.RuntimeEnv;
import
org.b3log.latke.image.Image
;
import
org.b3log.latke.image.ImageService
;
import
org.b3log.latke.image.ImageServiceFactory
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.HTTPRequestMethod
;
import
org.b3log.latke.servlet.annotation.RequestProcessing
;
...
...
@@ -112,7 +112,7 @@ public final class CaptchaProcessor {
final
HttpSession
httpSession
=
request
.
getSession
(
false
);
if
(
null
!=
httpSession
)
{
LOGGER
.
log
(
Level
.
FINER
,
"Captcha[{0}] for session[id={1}]"
,
new
Object
[]
{
captcha
,
httpSession
.
getId
()});
LOGGER
.
log
(
Level
.
DEBUG
,
"Captcha[{0}] for session[id={1}]"
,
new
Object
[]
{
captcha
,
httpSession
.
getId
()});
httpSession
.
setAttribute
(
CAPTCHA
,
captcha
);
}
...
...
@@ -122,7 +122,7 @@ public final class CaptchaProcessor {
renderer
.
setImage
(
captchaImg
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
}
}
...
...
@@ -177,7 +177,7 @@ public final class CaptchaProcessor {
zipFile
.
close
();
}
catch
(
final
Exception
e
)
{
LOGGER
.
severe
(
"Can not load captchs!"
);
LOGGER
.
error
(
"Can not load captchs!"
);
throw
new
IllegalStateException
(
e
);
}
...
...
core/src/main/java/org/b3log/solo/processor/CommentProcessor.java
View file @
4acc9b1f
...
...
@@ -17,13 +17,13 @@ package org.b3log.solo.processor;
import
java.io.IOException
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.service.LangPropsService
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.HTTPRequestMethod
;
...
...
@@ -113,7 +113,7 @@ public final class CommentProcessor {
renderer
.
setJSONObject
(
jsonObject
);
if
(!
jsonObject
.
optBoolean
(
Keys
.
STATUS_CODE
))
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Can't add comment[msg={0}]"
,
jsonObject
.
optString
(
Keys
.
MSG
));
LOGGER
.
log
(
Level
.
WARN
,
"Can't add comment[msg={0}]"
,
jsonObject
.
optString
(
Keys
.
MSG
));
return
;
}
...
...
@@ -150,7 +150,7 @@ public final class CommentProcessor {
renderer
.
setJSONObject
(
addResult
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Can not add comment on page"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Can not add comment on page"
,
e
);
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
false
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"addFailLabel"
));
...
...
@@ -205,7 +205,7 @@ public final class CommentProcessor {
renderer
.
setJSONObject
(
jsonObject
);
if
(!
jsonObject
.
optBoolean
(
Keys
.
STATUS_CODE
))
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Can't add comment[msg={0}]"
,
jsonObject
.
optString
(
Keys
.
MSG
));
LOGGER
.
log
(
Level
.
WARN
,
"Can't add comment[msg={0}]"
,
jsonObject
.
optString
(
Keys
.
MSG
));
return
;
}
...
...
@@ -242,7 +242,7 @@ public final class CommentProcessor {
renderer
.
setJSONObject
(
addResult
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Can not add comment on article"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Can not add comment on article"
,
e
);
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
false
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"addFailLabel"
));
}
...
...
core/src/main/java/org/b3log/solo/processor/ErrorProcessor.java
View file @
4acc9b1f
...
...
@@ -19,11 +19,11 @@ package org.b3log.solo.processor;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Map
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang.StringUtils
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.service.LangPropsService
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.HTTPRequestMethod
;
...
...
@@ -89,7 +89,7 @@ public final class ErrorProcessor {
String
templateName
=
StringUtils
.
substringAfterLast
(
requestURI
,
"/"
);
templateName
=
StringUtils
.
substringBefore
(
templateName
,
"."
)
+
".ftl"
;
LOGGER
.
log
(
Level
.
FINE
,
"Shows error page[requestURI={0}, templateName={1}]"
,
new
Object
[]
{
requestURI
,
templateName
});
LOGGER
.
log
(
Level
.
DEBUG
,
"Shows error page[requestURI={0}, templateName={1}]"
,
new
Object
[]
{
requestURI
,
templateName
});
final
ConsoleRenderer
renderer
=
new
ConsoleRenderer
();
...
...
@@ -109,12 +109,12 @@ public final class ErrorProcessor {
dataModel
.
put
(
Common
.
LOGIN_URL
,
userService
.
createLoginURL
(
Common
.
ADMIN_INDEX_URI
));
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
try
{
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
}
catch
(
final
IOException
ex
)
{
LOGGER
.
severe
(
ex
.
getMessage
());
LOGGER
.
error
(
ex
.
getMessage
());
}
}
}
...
...
core/src/main/java/org/b3log/solo/processor/FeedProcessor.java
View file @
4acc9b1f
...
...
@@ -20,13 +20,13 @@ import java.io.IOException;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang.StringEscapeUtils
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.repository.CompositeFilter
;
import
org.b3log.latke.repository.CompositeFilterOperator
;
...
...
@@ -194,7 +194,7 @@ public final class FeedProcessor {
renderer
.
setContent
(
feed
.
toString
());
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Get blog article feed error"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Get blog article feed error"
,
e
);
try
{
context
.
getResponse
().
sendError
(
HttpServletResponse
.
SC_SERVICE_UNAVAILABLE
);
...
...
@@ -329,7 +329,7 @@ public final class FeedProcessor {
renderer
.
setContent
(
feed
.
toString
());
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Get tag article feed error"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Get tag article feed error"
,
e
);
try
{
context
.
getResponse
().
sendError
(
HttpServletResponse
.
SC_SERVICE_UNAVAILABLE
);
...
...
@@ -440,7 +440,7 @@ public final class FeedProcessor {
renderer
.
setContent
(
channel
.
toString
());
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Get blog article rss error"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Get blog article rss error"
,
e
);
try
{
context
.
getResponse
().
sendError
(
HttpServletResponse
.
SC_SERVICE_UNAVAILABLE
);
...
...
@@ -582,7 +582,7 @@ public final class FeedProcessor {
renderer
.
setContent
(
channel
.
toString
());
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Get tag article rss error"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Get tag article rss error"
,
e
);
try
{
context
.
getResponse
().
sendError
(
HttpServletResponse
.
SC_SERVICE_UNAVAILABLE
);
...
...
core/src/main/java/org/b3log/solo/processor/IndexProcessor.java
View file @
4acc9b1f
...
...
@@ -21,14 +21,14 @@ import java.io.IOException;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.util.Map
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang.StringUtils
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.cache.PageCaches
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Pagination
;
import
org.b3log.latke.service.LangPropsService
;
import
org.b3log.latke.service.ServiceException
;
...
...
@@ -136,12 +136,12 @@ public final class IndexProcessor {
dataModel
.
put
(
Common
.
PATH
,
""
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
try
{
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
}
catch
(
final
IOException
ex
)
{
LOGGER
.
severe
(
ex
.
getMessage
());
LOGGER
.
error
(
ex
.
getMessage
());
}
}
}
...
...
@@ -179,12 +179,12 @@ public final class IndexProcessor {
request
.
setAttribute
(
PageCaches
.
CACHED_TYPE
,
langs
.
get
(
PageTypes
.
KILL_BROWSER
.
getLangeLabel
()));
request
.
setAttribute
(
PageCaches
.
CACHED_LINK
,
request
.
getRequestURI
());
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
try
{
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
}
catch
(
final
IOException
ex
)
{
LOGGER
.
severe
(
ex
.
getMessage
());
LOGGER
.
error
(
ex
.
getMessage
());
}
}
}
...
...
@@ -218,12 +218,12 @@ public final class IndexProcessor {
Keys
.
fillServer
(
dataModel
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
try
{
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
}
catch
(
final
IOException
ex
)
{
LOGGER
.
severe
(
ex
.
getMessage
());
LOGGER
.
error
(
ex
.
getMessage
());
}
}
}
...
...
@@ -283,7 +283,7 @@ public final class IndexProcessor {
try
{
response
.
sendError
(
HttpServletResponse
.
SC_INTERNAL_SERVER_ERROR
);
}
catch
(
final
IOException
ex
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Can not sned error 500!"
,
ex
);
LOGGER
.
log
(
Level
.
ERROR
,
"Can not sned error 500!"
,
ex
);
}
}
}
...
...
core/src/main/java/org/b3log/solo/processor/InitProcessor.java
View file @
4acc9b1f
...
...
@@ -19,12 +19,12 @@ package org.b3log.solo.processor;
import
java.util.Calendar
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Role
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.service.LangPropsService
;
...
...
@@ -178,7 +178,7 @@ public final class InitProcessor {
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
ret
.
put
(
Keys
.
MSG
,
e
.
getMessage
());
}
...
...
core/src/main/java/org/b3log/solo/processor/LoginProcessor.java
View file @
4acc9b1f
...
...
@@ -19,13 +19,13 @@ package org.b3log.solo.processor;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.Map
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.mail.MailService
;
import
org.b3log.latke.mail.MailServiceFactory
;
import
org.b3log.latke.model.User
;
...
...
@@ -181,7 +181,7 @@ public final class LoginProcessor {
final
JSONObject
user
=
userQueryService
.
getUserByEmail
(
userEmail
);
if
(
null
==
user
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Not found user[email={0}]"
,
userEmail
);
LOGGER
.
log
(
Level
.
WARN
,
"Not found user[email={0}]"
,
userEmail
);
return
;
}
...
...
@@ -197,9 +197,9 @@ public final class LoginProcessor {
return
;
}
LOGGER
.
log
(
Level
.
WARN
ING
,
"Wrong password[{0}]"
,
userPwd
);
LOGGER
.
log
(
Level
.
WARN
,
"Wrong password[{0}]"
,
userPwd
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
}
}
...
...
@@ -275,7 +275,7 @@ public final class LoginProcessor {
final
String
userEmail
=
requestJSONObject
.
getString
(
User
.
USER_EMAIL
);
if
(
Strings
.
isEmptyOrNull
(
userEmail
))
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Why user's email is empty"
);
LOGGER
.
log
(
Level
.
WARN
,
"Why user's email is empty"
);
return
;
}
...
...
@@ -284,20 +284,20 @@ public final class LoginProcessor {
final
JSONObject
user
=
userQueryService
.
getUserByEmail
(
userEmail
);
if
(
null
==
user
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Not found user[email={0}]"
,
userEmail
);
LOGGER
.
log
(
Level
.
WARN
,
"Not found user[email={0}]"
,
userEmail
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"userEmailNotFoundMsg"
));
return
;
}
if
(
isPwdExpired
())
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"User[email={0}]'s random password has been expired"
,
userEmail
);
LOGGER
.
log
(
Level
.
WARN
,
"User[email={0}]'s random password has been expired"
,
userEmail
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"userEmailNotFoundMsg"
));
return
;
}
sendRandomPwd
(
user
,
userEmail
,
jsonObject
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
}
}
...
...
@@ -341,11 +341,11 @@ public final class LoginProcessor {
if
(
userPassword
.
equals
(
hashPassword
))
{
Sessions
.
login
(
request
,
response
,
user
);
LOGGER
.
log
(
Level
.
FINER
,
"Logged in with cookie[email={0}]"
,
userEmail
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Logged in with cookie[email={0}]"
,
userEmail
);
}
}
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Parses cookie failed, clears the cookie[name=b3log-latke]"
,
e
);
LOGGER
.
log
(
Level
.
WARN
,
"Parses cookie failed, clears the cookie[name=b3log-latke]"
,
e
);
final
Cookie
cookie
=
new
Cookie
(
"b3log-latke"
,
null
);
...
...
@@ -399,7 +399,7 @@ public final class LoginProcessor {
jsonObject
.
put
(
"to"
,
Latkes
.
getServePath
()
+
"/login"
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"resetPwdSuccessMsg"
));
LOGGER
.
log
(
Level
.
FINER
,
"Sending a mail[mailSubject={0}, mailBody=[{1}] to [{2}]"
,
new
Object
[]
{
mailSubject
,
mailBody
,
userEmail
});
LOGGER
.
log
(
Level
.
DEBUG
,
"Sending a mail[mailSubject={0}, mailBody=[{1}] to [{2}]"
,
new
Object
[]
{
mailSubject
,
mailBody
,
userEmail
});
}
/**
...
...
core/src/main/java/org/b3log/solo/processor/PageProcessor.java
View file @
4acc9b1f
...
...
@@ -19,13 +19,13 @@ package org.b3log.solo.processor;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.cache.PageCaches
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.service.LangPropsService
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.HTTPRequestMethod
;
...
...
@@ -156,12 +156,12 @@ public final class PageProcessor {
filler
.
fillBlogHeader
(
request
,
dataModel
,
preference
);
filler
.
fillBlogFooter
(
dataModel
,
preference
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
try
{
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
}
catch
(
final
IOException
ex
)
{
LOGGER
.
severe
(
ex
.
getMessage
());
LOGGER
.
error
(
ex
.
getMessage
());
}
}
}
...
...
core/src/main/java/org/b3log/solo/processor/RepairProcessor.java
View file @
4acc9b1f
...
...
@@ -20,13 +20,13 @@ import java.io.IOException;
import
java.util.List
;
import
java.util.Set
;
import
java.util.concurrent.ExecutionException
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.cache.PageCaches
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.mail.MailService
;
import
org.b3log.latke.mail.MailService.Message
;
import
org.b3log.latke.mail.MailServiceFactory
;
...
...
@@ -163,7 +163,7 @@ public final class RepairProcessor {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
renderer
.
setContent
(
"Removes unused article properties failed, error msg["
+
e
.
getMessage
()
+
"]"
);
}
}
...
...
@@ -212,7 +212,7 @@ public final class RepairProcessor {
renderer
.
setContent
(
"Restores statistic succeeded."
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
renderer
.
setContent
(
"Restores statistics failed, error msg["
+
e
.
getMessage
()
+
"]"
);
}
}
...
...
@@ -247,7 +247,7 @@ public final class RepairProcessor {
MAIL_SVC
.
send
(
msg
);
renderer
.
setContent
(
"Restores signs succeeded."
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
renderer
.
setContent
(
"Restores signs failed, error msg["
+
e
.
getMessage
()
+
"]"
);
}
}
...
...
@@ -305,7 +305,7 @@ public final class RepairProcessor {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
renderer
.
setContent
(
"Repairs failed, error msg["
+
e
.
getMessage
()
+
"]"
);
}
}
...
...
@@ -339,7 +339,7 @@ public final class RepairProcessor {
renderer
.
setContent
(
htmlBuilder
.
toString
());
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
try
{
context
.
getResponse
().
sendError
(
HttpServletResponse
.
SC_SERVICE_UNAVAILABLE
);
...
...
@@ -378,8 +378,7 @@ public final class RepairProcessor {
succeed
=
true
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
WARNING
,
"Removed partial data only"
);
LOGGER
.
log
(
Level
.
WARN
,
"Removed partial data only"
,
e
);
}
final
StringBuilder
htmlBuilder
=
new
StringBuilder
();
...
...
@@ -399,7 +398,7 @@ public final class RepairProcessor {
renderer
.
setContent
(
htmlBuilder
.
toString
());
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
try
{
context
.
getResponse
().
sendError
(
HttpServletResponse
.
SC_SERVICE_UNAVAILABLE
);
}
catch
(
final
IOException
ex
)
{
...
...
@@ -443,7 +442,7 @@ public final class RepairProcessor {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Removes all data in repository[name="
+
repository
.
getName
()
+
"] failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Removes all data in repository[name="
+
repository
.
getName
()
+
"] failed"
,
e
);
}
}
}
core/src/main/java/org/b3log/solo/processor/SitemapProcessor.java
View file @
4acc9b1f
...
...
@@ -19,12 +19,12 @@ package org.b3log.solo.processor;
import
java.io.IOException
;
import
java.net.URLEncoder
;
import
java.util.Date
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang.time.DateFormatUtils
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.FilterOperator
;
import
org.b3log.latke.repository.PropertyFilter
;
import
org.b3log.latke.repository.Query
;
...
...
@@ -117,7 +117,7 @@ public final class SitemapProcessor {
LOGGER
.
log
(
Level
.
INFO
,
"Generated sitemap"
);
renderer
.
setContent
(
content
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Get blog article feed error"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Get blog article feed error"
,
e
);
try
{
context
.
getResponse
().
sendError
(
HttpServletResponse
.
SC_SERVICE_UNAVAILABLE
);
...
...
core/src/main/java/org/b3log/solo/processor/StatProcessor.java
View file @
4acc9b1f
...
...
@@ -16,8 +16,8 @@
package
org
.
b3log
.
solo
.
processor
;
import
java.util
.logging.Level
;
import
java.util
.logging.Logger
;
import
org.b3log.latke
.logging.Level
;
import
org.b3log.latke
.logging.Logger
;
import
org.b3log.latke.service.ServiceException
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.HTTPRequestMethod
;
...
...
@@ -82,7 +82,7 @@ public final class StatProcessor {
try
{
statisticMgmtService
.
flushStatistic
();
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Flushes statistic to repository failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Flushes statistic to repository failed"
,
e
);
}
}
}
core/src/main/java/org/b3log/solo/processor/TagProcessor.java
View file @
4acc9b1f
...
...
@@ -22,13 +22,13 @@ import java.net.URLEncoder;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.cache.PageCaches
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Pagination
;
import
org.b3log.latke.service.LangPropsService
;
import
org.b3log.latke.service.ServiceException
;
...
...
@@ -142,7 +142,7 @@ public final class TagProcessor {
return
;
}
LOGGER
.
log
(
Level
.
FINER
,
"Tag[title={0}, currentPageNum={1}]"
,
new
Object
[]
{
tagTitle
,
currentPageNum
});
LOGGER
.
log
(
Level
.
DEBUG
,
"Tag[title={0}, currentPageNum={1}]"
,
new
Object
[]
{
tagTitle
,
currentPageNum
});
tagTitle
=
URLDecoder
.
decode
(
tagTitle
,
"UTF-8"
);
final
JSONObject
result
=
tagQueryService
.
getTagByTitle
(
tagTitle
);
...
...
@@ -180,7 +180,7 @@ public final class TagProcessor {
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
return
;
}
catch
(
final
IOException
ex
)
{
LOGGER
.
severe
(
ex
.
getMessage
());
LOGGER
.
error
(
ex
.
getMessage
());
}
}
...
...
@@ -198,11 +198,11 @@ public final class TagProcessor {
final
int
tagArticleCount
=
tag
.
getInt
(
Tag
.
TAG_PUBLISHED_REFERENCE_COUNT
);
final
int
pageCount
=
(
int
)
Math
.
ceil
((
double
)
tagArticleCount
/
(
double
)
pageSize
);
LOGGER
.
log
(
Level
.
FINEST
,
"Paginate tag-articles[currentPageNum={0}, pageSize={1}, pageCount={2}, windowSize={3}]"
,
LOGGER
.
log
(
Level
.
TRACE
,
"Paginate tag-articles[currentPageNum={0}, pageSize={1}, pageCount={2}, windowSize={3}]"
,
new
Object
[]
{
currentPageNum
,
pageSize
,
pageCount
,
windowSize
});
final
List
<
Integer
>
pageNums
=
Paginator
.
paginate
(
currentPageNum
,
pageSize
,
pageCount
,
windowSize
);
LOGGER
.
log
(
Level
.
FINEST
,
"tag-articles[pageNums={0}]"
,
pageNums
);
LOGGER
.
log
(
Level
.
TRACE
,
"tag-articles[pageNums={0}]"
,
pageNums
);
Collections
.
sort
(
articles
,
Comparators
.
ARTICLE_CREATE_DATE_COMPARATOR
);
...
...
@@ -216,20 +216,20 @@ public final class TagProcessor {
filler
.
fillBlogHeader
(
request
,
dataModel
,
preference
);
filler
.
fillBlogFooter
(
dataModel
,
preference
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
try
{
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
}
catch
(
final
IOException
ex
)
{
LOGGER
.
severe
(
ex
.
getMessage
());
LOGGER
.
error
(
ex
.
getMessage
());
}
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
try
{
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
}
catch
(
final
IOException
ex
)
{
LOGGER
.
severe
(
ex
.
getMessage
());
LOGGER
.
error
(
ex
.
getMessage
());
}
}
}
...
...
@@ -310,13 +310,12 @@ public final class TagProcessor {
filler
.
fillBlogHeader
(
request
,
dataModel
,
preference
);
filler
.
fillBlogFooter
(
dataModel
,
preference
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
try
{
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
return
;
}
catch
(
final
IOException
ex
)
{
LOGGER
.
severe
(
ex
.
getMessage
());
LOGGER
.
error
(
ex
.
getMessage
());
}
}
}
...
...
core/src/main/java/org/b3log/solo/processor/UpgradeProcessor.java
View file @
4acc9b1f
...
...
@@ -22,11 +22,11 @@ import java.sql.SQLException;
import
java.sql.Statement
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.RuntimeEnv
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.mail.MailService
;
import
org.b3log.latke.mail.MailServiceFactory
;
import
org.b3log.latke.model.User
;
...
...
@@ -143,7 +143,7 @@ public final class UpgradeProcessor {
if
(
"0.5.6"
.
equals
(
version
))
{
v056ToV060
();
}
else
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Attempt to skip more than one version to upgrade. Expected: 0.5.6; Actually: {0}"
,
version
);
LOGGER
.
log
(
Level
.
WARN
,
"Attempt to skip more than one version to upgrade. Expected: 0.5.6; Actually: {0}"
,
version
);
if
(!
sent
)
{
notifyUserByEmail
();
sent
=
true
;
...
...
@@ -151,7 +151,7 @@ public final class UpgradeProcessor {
renderer
.
setContent
(
langPropsService
.
get
(
"skipVersionAlert"
));
}
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
renderer
.
setContent
(
"Upgrade failed ["
+
e
.
getMessage
()
+
"], please contact the B3log Solo developers or reports this "
+
"issue directly (<a href='https://github.com/b3log/b3log-solo/issues/new'>"
...
...
@@ -197,7 +197,7 @@ public final class UpgradeProcessor {
try
{
JdbcFactory
.
createJdbcFactory
().
createTable
(
tableName
,
map
.
get
(
tableName
));
}
catch
(
final
SQLException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"createTable["
+
tableName
+
"] error"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"createTable["
+
tableName
+
"] error"
,
e
);
}
}
...
...
@@ -212,13 +212,13 @@ public final class UpgradeProcessor {
transaction
.
commit
();
LOGGER
.
log
(
Level
.
FINEST
,
"Updated preference"
);
LOGGER
.
log
(
Level
.
TRACE
,
"Updated preference"
);
}
catch
(
final
Exception
e
)
{
if
(
transaction
.
isActive
())
{
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Upgrade failed."
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Upgrade failed."
,
e
);
throw
new
Exception
(
"Upgrade failed from version 056 to version 060"
);
}
finally
{
articleRepository
.
setCacheEnabled
(
true
);
...
...
@@ -261,7 +261,7 @@ public final class UpgradeProcessor {
final
JSONArray
articles
=
articleRepository
.
get
(
new
Query
()).
getJSONArray
(
Keys
.
RESULTS
);
if
(
articles
.
length
()
<=
0
)
{
LOGGER
.
log
(
Level
.
FINEST
,
"No articles"
);
LOGGER
.
log
(
Level
.
TRACE
,
"No articles"
);
return
;
}
...
...
@@ -284,7 +284,7 @@ public final class UpgradeProcessor {
if
(
0
==
i
%
STEP
)
{
transaction
.
commit
();
LOGGER
.
log
(
Level
.
FINEST
,
"Updated some articles"
);
LOGGER
.
log
(
Level
.
TRACE
,
"Updated some articles"
);
}
}
...
...
@@ -292,7 +292,7 @@ public final class UpgradeProcessor {
transaction
.
commit
();
}
LOGGER
.
log
(
Level
.
FINEST
,
"Updated all articles"
);
LOGGER
.
log
(
Level
.
TRACE
,
"Updated all articles"
);
}
catch
(
final
Exception
e
)
{
if
(
transaction
.
isActive
())
{
transaction
.
rollback
();
...
...
core/src/main/java/org/b3log/solo/processor/UserTemplateProcessor.java
View file @
4acc9b1f
...
...
@@ -19,13 +19,13 @@ package org.b3log.solo.processor;
import
freemarker.template.Template
;
import
java.io.IOException
;
import
java.util.Map
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang.StringUtils
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.cache.PageCaches
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.service.LangPropsService
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.HTTPRequestMethod
;
...
...
@@ -96,7 +96,7 @@ public final class UserTemplateProcessor {
String
templateName
=
StringUtils
.
substringAfterLast
(
requestURI
,
"/"
);
templateName
=
StringUtils
.
substringBefore
(
templateName
,
"."
)
+
".ftl"
;
LOGGER
.
log
(
Level
.
FINE
,
"Shows page[requestURI={0}, templateName={1}]"
,
new
Object
[]
{
requestURI
,
templateName
});
LOGGER
.
log
(
Level
.
DEBUG
,
"Shows page[requestURI={0}, templateName={1}]"
,
new
Object
[]
{
requestURI
,
templateName
});
final
AbstractFreeMarkerRenderer
renderer
=
new
FrontRenderer
();
...
...
@@ -113,7 +113,7 @@ public final class UserTemplateProcessor {
return
;
}
catch
(
final
IOException
ex
)
{
LOGGER
.
severe
(
ex
.
getMessage
());
LOGGER
.
error
(
ex
.
getMessage
());
}
}
...
...
@@ -135,12 +135,12 @@ public final class UserTemplateProcessor {
request
.
setAttribute
(
PageCaches
.
CACHED_TYPE
,
langs
.
get
(
PageTypes
.
USER_TEMPLATE
.
getLangeLabel
()));
request
.
setAttribute
(
PageCaches
.
CACHED_LINK
,
requestURI
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
try
{
response
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
}
catch
(
final
IOException
ex
)
{
LOGGER
.
severe
(
ex
.
getMessage
());
LOGGER
.
error
(
ex
.
getMessage
());
}
}
}
...
...
core/src/main/java/org/b3log/solo/processor/console/AdminConsole.java
View file @
4acc9b1f
...
...
@@ -20,8 +20,6 @@ import java.util.Calendar;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.TimeZone
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
org.apache.commons.lang.StringUtils
;
import
org.b3log.latke.Keys
;
...
...
@@ -29,6 +27,8 @@ import org.b3log.latke.Latkes;
import
org.b3log.latke.event.Event
;
import
org.b3log.latke.event.EventException
;
import
org.b3log.latke.event.EventManager
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Plugin
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.plugin.ViewLoadEventData
;
...
...
@@ -137,7 +137,7 @@ public final class AdminConsole {
Keys
.
fillRuntime
(
dataModel
);
filler
.
fillMinified
(
dataModel
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Admin index render failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Admin index render failed"
,
e
);
}
fireFreeMarkerActionEvent
(
templateName
,
dataModel
);
...
...
@@ -169,7 +169,7 @@ public final class AdminConsole {
final
String
requestURI
=
request
.
getRequestURI
();
final
String
templateName
=
StringUtils
.
substringBetween
(
requestURI
,
Latkes
.
getContextPath
()
+
'/'
,
"."
)
+
".ftl"
;
LOGGER
.
log
(
Level
.
FINEST
,
"Admin function[templateName={0}]"
,
templateName
);
LOGGER
.
log
(
Level
.
TRACE
,
"Admin function[templateName={0}]"
,
templateName
);
renderer
.
setTemplateName
(
templateName
);
final
Locale
locale
=
Latkes
.
getLocale
();
...
...
@@ -215,7 +215,7 @@ public final class AdminConsole {
try
{
preference
=
preferenceQueryService
.
getPreference
();
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Loads preference failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Loads preference failed"
,
e
);
}
final
StringBuilder
timeZoneIdOptions
=
new
StringBuilder
();
...
...
@@ -257,7 +257,7 @@ public final class AdminConsole {
dataModel
.
put
(
Plugin
.
PLUGINS
,
""
);
}
}
catch
(
final
EventException
e
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Event[FREEMARKER_ACTION] handle failed, ignores this exception for kernel health"
,
e
);
LOGGER
.
log
(
Level
.
WARN
,
"Event[FREEMARKER_ACTION] handle failed, ignores this exception for kernel health"
,
e
);
}
}
}
core/src/main/java/org/b3log/solo/processor/console/ArticleConsole.java
View file @
4acc9b1f
...
...
@@ -16,13 +16,13 @@
package
org
.
b3log
.
solo
.
processor
.
console
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang.StringUtils
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.service.LangPropsService
;
import
org.b3log.latke.service.ServiceException
;
...
...
@@ -131,7 +131,7 @@ public final class ArticleConsole {
result
.
put
(
"html"
,
html
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -192,7 +192,7 @@ public final class ArticleConsole {
result
.
put
(
Keys
.
STATUS_CODE
,
true
);
renderer
.
setJSONObject
(
result
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -280,7 +280,7 @@ public final class ArticleConsole {
result
.
put
(
Keys
.
STATUS_CODE
,
true
);
renderer
.
setJSONObject
(
result
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -337,7 +337,7 @@ public final class ArticleConsole {
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
ret
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"removeSuccLabel"
));
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
new
JSONObject
();
...
...
@@ -396,7 +396,7 @@ public final class ArticleConsole {
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
ret
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"unPulbishSuccLabel"
));
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
new
JSONObject
();
...
...
@@ -455,7 +455,7 @@ public final class ArticleConsole {
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
ret
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"cancelTopSuccLabel"
));
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
new
JSONObject
();
...
...
@@ -514,7 +514,7 @@ public final class ArticleConsole {
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
ret
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"putTopSuccLabel"
));
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
new
JSONObject
();
...
...
@@ -593,7 +593,7 @@ public final class ArticleConsole {
ret
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"updateSuccLabel"
));
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -667,7 +667,7 @@ public final class ArticleConsole {
renderer
.
setJSONObject
(
ret
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
core/src/main/java/org/b3log/solo/processor/console/CommentConsole.java
View file @
4acc9b1f
...
...
@@ -17,12 +17,12 @@ package org.b3log.solo.processor.console;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.service.LangPropsService
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.HTTPRequestMethod
;
...
...
@@ -115,7 +115,7 @@ public final class CommentConsole {
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
true
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"removeSuccLabel"
));
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
false
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"removeFailLabel"
));
...
...
@@ -164,7 +164,7 @@ public final class CommentConsole {
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
true
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"removeSuccLabel"
));
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
false
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"removeFailLabel"
));
...
...
@@ -233,7 +233,7 @@ public final class CommentConsole {
renderer
.
setJSONObject
(
result
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -295,7 +295,7 @@ public final class CommentConsole {
ret
.
put
(
Comment
.
COMMENTS
,
comments
);
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -357,7 +357,7 @@ public final class CommentConsole {
ret
.
put
(
Comment
.
COMMENTS
,
comments
);
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
core/src/main/java/org/b3log/solo/processor/console/LinkConsole.java
View file @
4acc9b1f
...
...
@@ -16,12 +16,12 @@
package
org
.
b3log
.
solo
.
processor
.
console
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.service.LangPropsService
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.HTTPRequestMethod
;
...
...
@@ -114,7 +114,7 @@ public final class LinkConsole {
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
true
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"removeSuccLabel"
));
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
false
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"removeFailLabel"
));
...
...
@@ -173,7 +173,7 @@ public final class LinkConsole {
renderer
.
setJSONObject
(
ret
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -234,7 +234,7 @@ public final class LinkConsole {
renderer
.
setJSONObject
(
ret
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -296,7 +296,7 @@ public final class LinkConsole {
renderer
.
setJSONObject
(
ret
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -364,7 +364,7 @@ public final class LinkConsole {
renderer
.
setJSONObject
(
result
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -423,7 +423,7 @@ public final class LinkConsole {
renderer
.
setJSONObject
(
result
);
result
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
core/src/main/java/org/b3log/solo/processor/console/PageConsole.java
View file @
4acc9b1f
...
...
@@ -16,12 +16,12 @@
package
org
.
b3log
.
solo
.
processor
.
console
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.service.LangPropsService
;
import
org.b3log.latke.service.ServiceException
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
...
...
@@ -132,7 +132,7 @@ public final class PageConsole {
renderer
.
setJSONObject
(
ret
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -183,7 +183,7 @@ public final class PageConsole {
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
true
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"removeSuccLabel"
));
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
false
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"removeFailLabel"
));
...
...
@@ -247,7 +247,7 @@ public final class PageConsole {
renderer
.
setJSONObject
(
ret
);
}
catch
(
final
ServiceException
e
)
{
// May be permalink check exception
LOGGER
.
log
(
Level
.
WARN
ING
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
WARN
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -306,7 +306,7 @@ public final class PageConsole {
renderer
.
setJSONObject
(
ret
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -368,7 +368,7 @@ public final class PageConsole {
result
.
put
(
Keys
.
STATUS_CODE
,
true
);
result
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"getSuccLabel"
));
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -444,7 +444,7 @@ public final class PageConsole {
renderer
.
setJSONObject
(
result
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
core/src/main/java/org/b3log/solo/processor/console/PluginConsole.java
View file @
4acc9b1f
...
...
@@ -17,14 +17,12 @@ package org.b3log.solo.processor.console;
import
java.util.Map
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Plugin
;
import
org.b3log.latke.service.LangPropsService
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
...
...
@@ -171,7 +169,7 @@ public final class PluginConsole {
result
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -210,7 +208,7 @@ public final class PluginConsole {
dataModel
.
put
(
Keys
.
OBJECT_ID
,
pluginId
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
final
JSONRenderer
jsonRenderer
=
new
JSONRenderer
();
...
...
core/src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
View file @
4acc9b1f
...
...
@@ -16,11 +16,11 @@
package
org
.
b3log
.
solo
.
processor
.
console
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.service.LangPropsService
;
import
org.b3log.latke.service.ServiceException
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
...
...
@@ -124,7 +124,7 @@ public final class PreferenceConsole {
ret
.
put
(
Preference
.
REPLY_NOTIFICATION_TEMPLATE
,
replyNotificationTemplate
);
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -177,7 +177,7 @@ public final class PreferenceConsole {
renderer
.
setJSONObject
(
ret
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -238,7 +238,7 @@ public final class PreferenceConsole {
ret
.
put
(
Sign
.
SIGNS
,
signs
);
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -328,7 +328,7 @@ public final class PreferenceConsole {
ret
.
put
(
Preference
.
PREFERENCE
,
preference
);
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -409,7 +409,7 @@ public final class PreferenceConsole {
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
ret
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"updateSuccLabel"
));
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
core/src/main/java/org/b3log/solo/processor/console/TagConsole.java
View file @
4acc9b1f
...
...
@@ -19,11 +19,11 @@ package org.b3log.solo.processor.console;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.service.LangPropsService
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.HTTPRequestMethod
;
...
...
@@ -118,7 +118,7 @@ public final class TagConsole {
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets tags failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets tags failed"
,
e
);
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
false
);
}
...
...
@@ -183,7 +183,7 @@ public final class TagConsole {
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets unused tags failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets unused tags failed"
,
e
);
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
false
);
}
...
...
@@ -230,7 +230,7 @@ public final class TagConsole {
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"removeSuccLabel"
));
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Removes unused tags failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Removes unused tags failed"
,
e
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"removeFailLabel"
));
}
...
...
core/src/main/java/org/b3log/solo/processor/console/UserConsole.java
View file @
4acc9b1f
...
...
@@ -16,12 +16,12 @@
package
org
.
b3log
.
solo
.
processor
.
console
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Role
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.service.LangPropsService
;
...
...
@@ -127,7 +127,7 @@ public final class UserConsole {
renderer
.
setJSONObject
(
ret
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -193,7 +193,7 @@ public final class UserConsole {
renderer
.
setJSONObject
(
ret
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -244,7 +244,7 @@ public final class UserConsole {
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
true
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"removeSuccLabel"
));
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
false
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"removeFailLabel"
));
...
...
@@ -308,7 +308,7 @@ public final class UserConsole {
renderer
.
setJSONObject
(
result
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -368,7 +368,7 @@ public final class UserConsole {
result
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
final
JSONObject
jsonObject
=
QueryResults
.
defaultResult
();
...
...
@@ -420,7 +420,7 @@ public final class UserConsole {
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"updateSuccLabel"
));
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
false
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"removeFailLabel"
));
...
...
core/src/main/java/org/b3log/solo/processor/renderer/ConsoleRenderer.java
View file @
4acc9b1f
...
...
@@ -20,8 +20,8 @@ import freemarker.template.Configuration;
import
freemarker.template.Template
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util
.logging.Level
;
import
java.util
.logging.Logger
;
import
org.b3log.latke
.logging.Level
;
import
org.b3log.latke
.logging.Logger
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.renderer.freemarker.AbstractFreeMarkerRenderer
;
import
org.b3log.solo.SoloServletListener
;
...
...
@@ -55,7 +55,7 @@ public final class ConsoleRenderer extends AbstractFreeMarkerRenderer {
TEMPLATE_CFG
.
setDirectoryForTemplateLoading
(
new
File
(
webRootPath
));
}
catch
(
final
IOException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
}
}
...
...
core/src/main/java/org/b3log/solo/processor/renderer/FrontRenderer.java
View file @
4acc9b1f
...
...
@@ -17,12 +17,12 @@ package org.b3log.solo.processor.renderer;
import
java.io.PrintWriter
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.cache.PageCaches
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.servlet.HTTPRequestContext
;
import
org.b3log.latke.servlet.renderer.freemarker.CacheFreeMarkerRenderer
;
import
org.b3log.solo.model.Common
;
...
...
@@ -59,14 +59,14 @@ public final class FrontRenderer extends CacheFreeMarkerRenderer {
*/
@Override
protected
void
beforeRender
(
final
HTTPRequestContext
context
)
throws
Exception
{
LOGGER
.
log
(
Level
.
FINEST
,
"Before render...."
);
LOGGER
.
log
(
Level
.
TRACE
,
"Before render...."
);
getDataModel
().
put
(
Common
.
TOP_BAR_REPLACEMENT_FLAG_KEY
,
Common
.
TOP_BAR_REPLACEMENT_FLAG
);
}
@Override
protected
void
doRender
(
final
String
html
,
final
HttpServletRequest
request
,
final
HttpServletResponse
response
)
throws
Exception
{
LOGGER
.
log
(
Level
.
FINEST
,
"Do render...."
);
LOGGER
.
log
(
Level
.
TRACE
,
"Do render...."
);
response
.
setContentType
(
"text/html"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
...
...
@@ -99,7 +99,7 @@ public final class FrontRenderer extends CacheFreeMarkerRenderer {
try
{
statistics
.
incBlogViewCount
(
request
,
response
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Incs blog view count failed"
,
e
);
LOGGER
.
log
(
Level
.
WARN
,
"Incs blog view count failed"
,
e
);
}
// Write out
...
...
@@ -117,7 +117,7 @@ public final class FrontRenderer extends CacheFreeMarkerRenderer {
*/
@Override
protected
void
afterRender
(
final
HTTPRequestContext
context
)
throws
Exception
{
LOGGER
.
log
(
Level
.
FINEST
,
"After render...."
);
LOGGER
.
log
(
Level
.
TRACE
,
"After render...."
);
final
HttpServletRequest
request
=
context
.
getRequest
();
...
...
core/src/main/java/org/b3log/solo/processor/util/Filler.java
View file @
4acc9b1f
...
...
@@ -22,8 +22,6 @@ import java.util.Calendar;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -35,6 +33,8 @@ import org.b3log.latke.Latkes;
import
org.b3log.latke.event.Event
;
import
org.b3log.latke.event.EventException
;
import
org.b3log.latke.event.EventManager
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Pagination
;
import
org.b3log.latke.model.Plugin
;
import
org.b3log.latke.model.User
;
...
...
@@ -209,13 +209,13 @@ public final class Filler {
boolean
isArticles1
=
false
;
if
(
null
==
template
)
{
LOGGER
.
fine
(
"The skin dose not contain [index.ftl] template"
);
LOGGER
.
debug
(
"The skin dose not contain [index.ftl] template"
);
}
else
{
// See https://github.com/b3log/b3log-solo/issues/179 for more details
if
(
Templates
.
hasExpression
(
template
,
"<#list articles1 as article>"
))
{
isArticles1
=
true
;
query
.
addSort
(
Article
.
ARTICLE_CREATE_DATE
,
SortDirection
.
DESCENDING
);
LOGGER
.
finest
(
"Query ${articles1} in index.ftl"
);
LOGGER
.
trace
(
"Query ${articles1} in index.ftl"
);
}
else
{
// <#list articles as article>
query
.
addSort
(
Article
.
ARTICLE_PUT_TOP
,
SortDirection
.
DESCENDING
);
if
(
preference
.
getBoolean
(
Preference
.
ENABLE_ARTICLE_UPDATE_HINT
))
{
...
...
@@ -259,10 +259,10 @@ public final class Filler {
dataModel
.
put
(
Article
.
ARTICLES
+
"1"
,
articles
);
}
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills index articles failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills index articles failed"
,
e
);
throw
new
ServiceException
(
e
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills index articles failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills index articles failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
@@ -287,10 +287,10 @@ public final class Filler {
dataModel
.
put
(
Link
.
LINKS
,
links
);
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills links failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills links failed"
,
e
);
throw
new
ServiceException
(
e
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills links failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills links failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
@@ -309,7 +309,7 @@ public final class Filler {
Stopwatchs
.
start
(
"Fill Most Used Tags"
);
try
{
LOGGER
.
finer
(
"Filling most used tags...."
);
LOGGER
.
debug
(
"Filling most used tags...."
);
final
int
mostUsedTagDisplayCnt
=
preference
.
getInt
(
Preference
.
MOST_USED_TAG_DISPLAY_CNT
);
final
List
<
JSONObject
>
tags
=
tagRepository
.
getMostUsedTags
(
mostUsedTagDisplayCnt
);
...
...
@@ -318,10 +318,10 @@ public final class Filler {
dataModel
.
put
(
Common
.
MOST_USED_TAGS
,
tags
);
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills most used tags failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills most used tags failed"
,
e
);
throw
new
ServiceException
(
e
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills most used tags failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills most used tags failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
@@ -339,7 +339,7 @@ public final class Filler {
Stopwatchs
.
start
(
"Fill Archive Dates"
);
try
{
LOGGER
.
finer
(
"Filling archive dates...."
);
LOGGER
.
debug
(
"Filling archive dates...."
);
final
List
<
JSONObject
>
archiveDates
=
archiveDateRepository
.
getArchiveDates
();
final
List
<
JSONObject
>
archiveDates2
=
new
ArrayList
<
JSONObject
>();
...
...
@@ -362,7 +362,7 @@ public final class Filler {
if
(!
dateString
.
equals
(
lastDateString
))
{
archiveDates2
.
add
(
archiveDate
);
}
else
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Found a duplicated archive date [{0}]"
,
dateString
);
LOGGER
.
log
(
Level
.
WARN
,
"Found a duplicated archive date [{0}]"
,
dateString
);
}
}
...
...
@@ -388,10 +388,10 @@ public final class Filler {
dataModel
.
put
(
ArchiveDate
.
ARCHIVE_DATES
,
archiveDates2
);
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills archive dates failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills archive dates failed"
,
e
);
throw
new
ServiceException
(
e
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills archive dates failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills archive dates failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
@@ -408,14 +408,14 @@ public final class Filler {
public
void
fillMostViewCountArticles
(
final
Map
<
String
,
Object
>
dataModel
,
final
JSONObject
preference
)
throws
ServiceException
{
Stopwatchs
.
start
(
"Fill Most View Articles"
);
try
{
LOGGER
.
finer
(
"Filling the most view count articles...."
);
LOGGER
.
debug
(
"Filling the most view count articles...."
);
final
int
mostCommentArticleDisplayCnt
=
preference
.
getInt
(
Preference
.
MOST_VIEW_ARTICLE_DISPLAY_CNT
);
final
List
<
JSONObject
>
mostViewCountArticles
=
articleRepository
.
getMostViewCountArticles
(
mostCommentArticleDisplayCnt
);
dataModel
.
put
(
Common
.
MOST_VIEW_COUNT_ARTICLES
,
mostViewCountArticles
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills most view count articles failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills most view count articles failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
@@ -433,13 +433,13 @@ public final class Filler {
Stopwatchs
.
start
(
"Fill Most CMMTs Articles"
);
try
{
LOGGER
.
finer
(
"Filling most comment articles...."
);
LOGGER
.
debug
(
"Filling most comment articles...."
);
final
int
mostCommentArticleDisplayCnt
=
preference
.
getInt
(
Preference
.
MOST_COMMENT_ARTICLE_DISPLAY_CNT
);
final
List
<
JSONObject
>
mostCommentArticles
=
articleRepository
.
getMostCommentArticles
(
mostCommentArticleDisplayCnt
);
dataModel
.
put
(
Common
.
MOST_COMMENT_ARTICLES
,
mostCommentArticles
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills most comment articles failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills most comment articles failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
@@ -464,10 +464,10 @@ public final class Filler {
dataModel
.
put
(
Common
.
RECENT_ARTICLES
,
recentArticles
);
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills recent articles failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills recent articles failed"
,
e
);
throw
new
ServiceException
(
e
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills recent articles failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills recent articles failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
@@ -514,7 +514,7 @@ public final class Filler {
dataModel
.
put
(
tagName
,
articles
);
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills recent articles failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills recent articles failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
@@ -532,7 +532,7 @@ public final class Filler {
public
void
fillRecentComments
(
final
Map
<
String
,
Object
>
dataModel
,
final
JSONObject
preference
)
throws
ServiceException
{
Stopwatchs
.
start
(
"Fill Recent Comments"
);
try
{
LOGGER
.
finer
(
"Filling recent comments...."
);
LOGGER
.
debug
(
"Filling recent comments...."
);
final
int
recentCommentDisplayCnt
=
preference
.
getInt
(
Preference
.
RECENT_COMMENT_DISPLAY_CNT
);
final
List
<
JSONObject
>
recentComments
=
commentRepository
.
getRecentComments
(
recentCommentDisplayCnt
);
...
...
@@ -550,10 +550,10 @@ public final class Filler {
dataModel
.
put
(
Common
.
RECENT_COMMENTS
,
recentComments
);
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills recent comments failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills recent comments failed"
,
e
);
throw
new
ServiceException
(
e
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills recent comments failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills recent comments failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
@@ -570,7 +570,7 @@ public final class Filler {
public
void
fillBlogFooter
(
final
Map
<
String
,
Object
>
dataModel
,
final
JSONObject
preference
)
throws
ServiceException
{
Stopwatchs
.
start
(
"Fill Footer"
);
try
{
LOGGER
.
finer
(
"Filling footer...."
);
LOGGER
.
debug
(
"Filling footer...."
);
final
String
blogTitle
=
preference
.
getString
(
Preference
.
BLOG_TITLE
);
dataModel
.
put
(
Preference
.
BLOG_TITLE
,
blogTitle
);
...
...
@@ -595,10 +595,10 @@ public final class Filler {
dataModel
.
put
(
Plugin
.
PLUGINS
,
""
);
}
}
catch
(
final
EventException
e
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Event[FREEMARKER_ACTION] handle failed, ignores this exception for kernel health"
,
e
);
LOGGER
.
log
(
Level
.
WARN
,
"Event[FREEMARKER_ACTION] handle failed, ignores this exception for kernel health"
,
e
);
}
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills blog footer failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills blog footer failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
@@ -617,7 +617,7 @@ public final class Filler {
throws
ServiceException
{
Stopwatchs
.
start
(
"Fill Header"
);
try
{
LOGGER
.
fine
(
"Filling header...."
);
LOGGER
.
debug
(
"Filling header...."
);
dataModel
.
put
(
Preference
.
ARTICLE_LIST_DISPLAY_COUNT
,
preference
.
getInt
(
Preference
.
ARTICLE_LIST_DISPLAY_COUNT
));
dataModel
.
put
(
Preference
.
ARTICLE_LIST_PAGINATION_WINDOW_SIZE
,
preference
.
getInt
(
Preference
.
ARTICLE_LIST_PAGINATION_WINDOW_SIZE
));
dataModel
.
put
(
Preference
.
LOCALE_STRING
,
preference
.
getString
(
Preference
.
LOCALE_STRING
));
...
...
@@ -653,10 +653,10 @@ public final class Filler {
fillPageNavigations
(
dataModel
);
fillStatistic
(
dataModel
);
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills blog header failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills blog header failed"
,
e
);
throw
new
ServiceException
(
e
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills blog header failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills blog header failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
@@ -695,16 +695,16 @@ public final class Filler {
throws
ServiceException
{
Stopwatchs
.
start
(
"Fill Side"
);
try
{
LOGGER
.
fine
(
"Filling side...."
);
LOGGER
.
debug
(
"Filling side...."
);
Template
template
=
Templates
.
getTemplate
((
String
)
request
.
getAttribute
(
Keys
.
TEMAPLTE_DIR_NAME
),
"side.ftl"
);
if
(
null
==
template
)
{
LOGGER
.
fine
(
"The skin dose not contain [side.ftl] template"
);
LOGGER
.
debug
(
"The skin dose not contain [side.ftl] template"
);
template
=
Templates
.
getTemplate
((
String
)
request
.
getAttribute
(
Keys
.
TEMAPLTE_DIR_NAME
),
"index.ftl"
);
if
(
null
==
template
)
{
LOGGER
.
fine
(
"The skin dose not contain [index.ftl] template"
);
LOGGER
.
debug
(
"The skin dose not contain [index.ftl] template"
);
return
;
}
}
...
...
@@ -745,7 +745,7 @@ public final class Filler {
}
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills side failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills side failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
@@ -764,7 +764,7 @@ public final class Filler {
throws
ServiceException
{
Stopwatchs
.
start
(
"Fill User Template[name="
+
template
.
getName
()
+
"]"
);
try
{
LOGGER
.
log
(
Level
.
FINE
,
"Filling user template[name{0}]"
,
template
.
getName
());
LOGGER
.
log
(
Level
.
DEBUG
,
"Filling user template[name{0}]"
,
template
.
getName
());
if
(
Templates
.
hasExpression
(
template
,
"<#list links as link>"
))
{
fillLinks
(
dataModel
);
...
...
@@ -794,7 +794,7 @@ public final class Filler {
dataModel
.
put
(
Preference
.
NOTICE_BOARD
,
noticeBoard
);
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills user template failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills user template failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
@@ -810,7 +810,7 @@ public final class Filler {
private
void
fillPageNavigations
(
final
Map
<
String
,
Object
>
dataModel
)
throws
ServiceException
{
Stopwatchs
.
start
(
"Fill Navigations"
);
try
{
LOGGER
.
finer
(
"Filling page navigations...."
);
LOGGER
.
debug
(
"Filling page navigations...."
);
final
List
<
JSONObject
>
pages
=
pageRepository
.
getPages
();
for
(
final
JSONObject
page
:
pages
)
{
...
...
@@ -823,7 +823,7 @@ public final class Filler {
dataModel
.
put
(
Common
.
PAGE_NAVIGATIONS
,
pages
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills page navigations failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills page navigations failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
@@ -839,12 +839,12 @@ public final class Filler {
private
void
fillStatistic
(
final
Map
<
String
,
Object
>
dataModel
)
throws
ServiceException
{
Stopwatchs
.
start
(
"Fill Statistic"
);
try
{
LOGGER
.
finer
(
"Filling statistic...."
);
LOGGER
.
debug
(
"Filling statistic...."
);
final
JSONObject
statistic
=
statisticQueryService
.
getStatistic
();
dataModel
.
put
(
Statistic
.
STATISTIC
,
statistic
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills statistic failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills statistic failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
@@ -891,7 +891,7 @@ public final class Filler {
articleQueryService
.
markdown
(
article
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Sets article extra properties failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Sets article extra properties failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -935,7 +935,7 @@ public final class Filler {
articleQueryService
.
markdown
(
article
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Sets article extra properties failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Sets article extra properties failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
core/src/main/java/org/b3log/solo/processor/util/TopBars.java
View file @
4acc9b1f
...
...
@@ -22,11 +22,11 @@ import java.io.IOException;
import
java.io.StringWriter
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Role
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.service.LangPropsService
;
...
...
@@ -131,13 +131,13 @@ public final class TopBars {
return
stringWriter
.
toString
();
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gens top bar HTML failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gens top bar HTML failed"
,
e
);
throw
new
ServiceException
(
e
);
}
catch
(
final
IOException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gens top bar HTML failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gens top bar HTML failed"
,
e
);
throw
new
ServiceException
(
e
);
}
catch
(
final
TemplateException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gens top bar HTML failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gens top bar HTML failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
core/src/main/java/org/b3log/solo/repository/impl/ArchiveDateRepositoryImpl.java
View file @
4acc9b1f
...
...
@@ -19,10 +19,10 @@ package org.b3log.solo.repository.impl;
import
java.text.ParseException
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.apache.commons.lang.time.DateUtils
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.*
;
import
org.b3log.latke.util.CollectionUtils
;
import
org.b3log.solo.model.ArchiveDate
;
...
...
@@ -57,11 +57,11 @@ public final class ArchiveDateRepositoryImpl extends AbstractRepository implemen
try
{
time
=
DateUtils
.
parseDate
(
archiveDate
,
new
String
[]
{
"yyyy/MM"
}).
getTime
();
}
catch
(
final
ParseException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Can not parse archive date ["
+
archiveDate
+
"]"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Can not parse archive date ["
+
archiveDate
+
"]"
,
e
);
throw
new
RepositoryException
(
"Can not parse archive date ["
+
archiveDate
+
"]"
);
}
LOGGER
.
log
(
Level
.
FINEST
,
"Archive date [{0}] parsed to time [{1}]"
,
new
Object
[]
{
archiveDate
,
time
});
LOGGER
.
log
(
Level
.
TRACE
,
"Archive date [{0}] parsed to time [{1}]"
,
new
Object
[]
{
archiveDate
,
time
});
final
Query
query
=
new
Query
();
...
...
core/src/main/java/org/b3log/solo/repository/impl/ArticleRepositoryImpl.java
View file @
4acc9b1f
...
...
@@ -19,9 +19,9 @@ package org.b3log.solo.repository.impl;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.*
;
import
org.b3log.latke.util.CollectionUtils
;
import
org.b3log.solo.model.Article
;
...
...
@@ -199,7 +199,7 @@ public final class ArticleRepositoryImpl extends AbstractRepository implements A
final
double
mid
=
Math
.
random
()
+
RANDOM_RANGE
;
LOGGER
.
log
(
Level
.
FINEST
,
"Random mid[{0}]"
,
mid
);
LOGGER
.
log
(
Level
.
TRACE
,
"Random mid[{0}]"
,
mid
);
Query
query
=
new
Query
();
...
...
core/src/main/java/org/b3log/solo/repository/impl/CommentRepositoryImpl.java
View file @
4acc9b1f
...
...
@@ -19,10 +19,10 @@ package org.b3log.solo.repository.impl;
import
java.io.Serializable
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.cache.Cache
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.*
;
import
org.b3log.solo.model.Comment
;
import
org.b3log.solo.repository.CommentRepository
;
...
...
@@ -72,7 +72,7 @@ public final class CommentRepositoryImpl extends AbstractRepository implements C
remove
(
commentId
);
}
LOGGER
.
log
(
Level
.
FINER
,
"Removed comments[onId={0}, removedCnt={1}]"
,
new
Object
[]
{
onId
,
comments
.
size
()});
LOGGER
.
log
(
Level
.
DEBUG
,
"Removed comments[onId={0}, removedCnt={1}]"
,
new
Object
[]
{
onId
,
comments
.
size
()});
return
comments
.
size
();
}
...
...
@@ -131,7 +131,7 @@ public final class CommentRepositoryImpl extends AbstractRepository implements C
* @throws RepositoryException repository exception
*/
private
void
removeForUnpublishedArticles
(
final
List
<
JSONObject
>
comments
)
throws
RepositoryException
{
LOGGER
.
finer
(
"Removing unpublished articles' comments...."
);
LOGGER
.
debug
(
"Removing unpublished articles' comments...."
);
final
Iterator
<
JSONObject
>
iterator
=
comments
.
iterator
();
while
(
iterator
.
hasNext
())
{
...
...
@@ -147,7 +147,7 @@ public final class CommentRepositoryImpl extends AbstractRepository implements C
}
}
LOGGER
.
finer
(
"Removed unpublished articles' comments...."
);
LOGGER
.
debug
(
"Removed unpublished articles' comments...."
);
}
/**
...
...
core/src/main/java/org/b3log/solo/repository/impl/LinkRepositoryImpl.java
View file @
4acc9b1f
...
...
@@ -16,8 +16,8 @@
package
org
.
b3log
.
solo
.
repository
.
impl
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.*
;
import
org.b3log.solo.model.Link
;
import
org.b3log.solo.repository.LinkRepository
;
...
...
@@ -34,11 +34,6 @@ import org.json.JSONObject;
*/
public
final
class
LinkRepositoryImpl
extends
AbstractRepository
implements
LinkRepository
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
LinkRepositoryImpl
.
class
.
getName
());
/**
* Singleton.
*/
...
...
core/src/main/java/org/b3log/solo/repository/impl/OptionRepositoryImpl.java
View file @
4acc9b1f
...
...
@@ -16,8 +16,6 @@
package
org
.
b3log
.
solo
.
repository
.
impl
;
import
java.util.logging.Logger
;
import
org.b3log.latke.repository.AbstractRepository
;
import
org.b3log.solo.model.Option
;
import
org.b3log.solo.repository.OptionRepository
;
...
...
@@ -32,11 +30,6 @@ import org.b3log.solo.repository.OptionRepository;
*/
public
final
class
OptionRepositoryImpl
extends
AbstractRepository
implements
OptionRepository
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
OptionRepositoryImpl
.
class
.
getName
());
/**
* Singleton.
*/
...
...
core/src/main/java/org/b3log/solo/repository/impl/PageRepositoryImpl.java
View file @
4acc9b1f
...
...
@@ -17,7 +17,6 @@ package org.b3log.solo.repository.impl;
import
java.util.List
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.repository.*
;
import
org.b3log.latke.util.CollectionUtils
;
...
...
@@ -36,11 +35,6 @@ import org.json.JSONObject;
*/
public
final
class
PageRepositoryImpl
extends
AbstractRepository
implements
PageRepository
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
PageRepositoryImpl
.
class
.
getName
());
/**
* Singleton.
*/
...
...
core/src/main/java/org/b3log/solo/repository/impl/PluginRepositoryImpl.java
View file @
4acc9b1f
...
...
@@ -16,8 +16,6 @@
package
org
.
b3log
.
solo
.
repository
.
impl
;
import
java.util.logging.Logger
;
import
org.b3log.latke.model.Plugin
;
import
org.b3log.latke.repository.AbstractRepository
;
import
org.b3log.solo.repository.PluginRepository
;
...
...
@@ -32,11 +30,6 @@ import org.b3log.solo.repository.PluginRepository;
*/
public
final
class
PluginRepositoryImpl
extends
AbstractRepository
implements
PluginRepository
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
PluginRepositoryImpl
.
class
.
getName
());
/**
* Singleton.
*/
...
...
core/src/main/java/org/b3log/solo/repository/impl/PreferenceRepositoryImpl.java
View file @
4acc9b1f
...
...
@@ -16,7 +16,6 @@
package
org
.
b3log
.
solo
.
repository
.
impl
;
import
java.util.logging.Logger
;
import
org.b3log.latke.repository.AbstractRepository
;
import
org.b3log.latke.repository.RepositoryException
;
import
org.b3log.solo.model.Preference
;
...
...
@@ -33,11 +32,6 @@ import org.json.JSONObject;
*/
public
final
class
PreferenceRepositoryImpl
extends
AbstractRepository
implements
PreferenceRepository
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
PreferenceRepositoryImpl
.
class
.
getName
());
/**
* Singleton.
*/
...
...
core/src/main/java/org/b3log/solo/repository/impl/StatisticRepositoryImpl.java
View file @
4acc9b1f
...
...
@@ -16,7 +16,6 @@
package
org
.
b3log
.
solo
.
repository
.
impl
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.repository.AbstractRepository
;
import
org.b3log.latke.repository.RepositoryException
;
...
...
@@ -35,11 +34,6 @@ import org.json.JSONObject;
*/
public
final
class
StatisticRepositoryImpl
extends
AbstractRepository
implements
StatisticRepository
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
StatisticRepositoryImpl
.
class
.
getName
());
/**
* Singleton.
*/
...
...
core/src/main/java/org/b3log/solo/repository/impl/TagArticleRepositoryImpl.java
View file @
4acc9b1f
...
...
@@ -17,7 +17,6 @@ package org.b3log.solo.repository.impl;
import
java.util.List
;
import
java.util.logging.Logger
;
import
org.b3log.solo.model.Article
;
import
org.b3log.solo.model.Tag
;
import
org.b3log.solo.repository.TagArticleRepository
;
...
...
@@ -37,11 +36,6 @@ import org.json.JSONObject;
*/
public
final
class
TagArticleRepositoryImpl
extends
AbstractRepository
implements
TagArticleRepository
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
TagArticleRepositoryImpl
.
class
.
getName
());
/**
* Singleton.
*/
...
...
core/src/main/java/org/b3log/solo/repository/impl/TagRepositoryImpl.java
View file @
4acc9b1f
...
...
@@ -18,7 +18,6 @@ package org.b3log.solo.repository.impl;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.logging.Logger
;
import
org.b3log.solo.model.Tag
;
import
org.b3log.solo.repository.TagRepository
;
import
org.b3log.latke.Keys
;
...
...
@@ -37,11 +36,6 @@ import org.json.JSONObject;
*/
public
final
class
TagRepositoryImpl
extends
AbstractRepository
implements
TagRepository
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
TagRepositoryImpl
.
class
.
getName
());
/**
* Singleton.
*/
...
...
core/src/main/java/org/b3log/solo/repository/impl/UserRepositoryImpl.java
View file @
4acc9b1f
...
...
@@ -16,7 +16,6 @@
package
org
.
b3log
.
solo
.
repository
.
impl
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.model.Role
;
import
org.b3log.latke.model.User
;
...
...
@@ -35,11 +34,6 @@ import org.json.JSONObject;
*/
public
final
class
UserRepositoryImpl
extends
AbstractRepository
implements
UserRepository
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
UserRepositoryImpl
.
class
.
getName
());
/**
* Singleton.
*/
...
...
core/src/main/java/org/b3log/solo/service/ArchiveDateQueryService.java
View file @
4acc9b1f
...
...
@@ -17,8 +17,8 @@ package org.b3log.solo.service;
import
java.util.List
;
import
java.util
.logging.Level
;
import
java.util
.logging.Logger
;
import
org.b3log.latke
.logging.Level
;
import
org.b3log.latke
.logging.Logger
;
import
org.b3log.latke.repository.RepositoryException
;
import
org.b3log.latke.service.ServiceException
;
import
org.b3log.solo.model.ArchiveDate
;
...
...
@@ -56,7 +56,7 @@ public final class ArchiveDateQueryService {
try
{
return
archiveDateRepository
.
getArchiveDates
();
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets archive dates failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets archive dates failed"
,
e
);
throw
new
ServiceException
(
"Gets archive dates failed"
);
}
}
...
...
@@ -92,7 +92,7 @@ public final class ArchiveDateQueryService {
return
ret
;
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets archive date[string="
+
archiveDateString
+
"] failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets archive date[string="
+
archiveDateString
+
"] failed"
,
e
);
throw
new
ServiceException
(
"Gets archive date[string="
+
archiveDateString
+
"] failed"
);
}
}
...
...
core/src/main/java/org/b3log/solo/service/ArticleMgmtService.java
View file @
4acc9b1f
...
...
@@ -21,14 +21,14 @@ import java.util.ArrayList;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.apache.commons.lang.time.DateFormatUtils
;
import
org.apache.commons.lang.time.DateUtils
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.event.Event
;
import
org.b3log.latke.event.EventException
;
import
org.b3log.latke.event.EventManager
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.RepositoryException
;
import
org.b3log.latke.repository.Transaction
;
import
org.b3log.latke.service.LangPropsService
;
...
...
@@ -182,7 +182,7 @@ public final class ArticleMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Cancels publish article failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Cancels publish article failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
@@ -212,7 +212,7 @@ public final class ArticleMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Can't put the article[oId{0}] to top"
,
articleId
);
LOGGER
.
log
(
Level
.
ERROR
,
"Can't put the article[oId{0}] to top"
,
articleId
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -335,7 +335,7 @@ public final class ArticleMgmtService {
try
{
eventManager
.
fireEventSynchronously
(
new
Event
<
JSONObject
>(
EventTypes
.
ADD_ARTICLE
,
eventData
));
}
catch
(
final
EventException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
}
}
else
{
// Fire update article event
...
...
@@ -346,7 +346,7 @@ public final class ArticleMgmtService {
try
{
eventManager
.
fireEventSynchronously
(
new
Event
<
JSONObject
>(
EventTypes
.
UPDATE_ARTICLE
,
eventData
));
}
catch
(
final
EventException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
}
}
...
...
@@ -356,7 +356,7 @@ public final class ArticleMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Updates an article failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Updates an article failed"
,
e
);
throw
e
;
}
catch
(
final
Exception
e
)
{
...
...
@@ -364,7 +364,7 @@ public final class ArticleMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Updates an article failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Updates an article failed"
,
e
);
throw
new
ServiceException
(
e
.
getMessage
());
}
...
...
@@ -516,11 +516,11 @@ public final class ArticleMgmtService {
article
.
remove
(
Common
.
POST_TO_COMMUNITY
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Adds an article failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Adds an article failed"
,
e
);
throw
new
ServiceException
(
e
);
}
catch
(
final
EventException
e
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Adds an article event process failed"
,
e
);
LOGGER
.
log
(
Level
.
WARN
,
"Adds an article event process failed"
,
e
);
}
return
ret
;
...
...
@@ -533,7 +533,7 @@ public final class ArticleMgmtService {
* @throws ServiceException service exception
*/
public
void
removeArticle
(
final
String
articleId
)
throws
ServiceException
{
LOGGER
.
log
(
Level
.
FINER
,
"Removing an article[id={0}]"
,
articleId
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Removing an article[id={0}]"
,
articleId
);
final
Transaction
transaction
=
articleRepository
.
beginTransaction
();
...
...
@@ -564,11 +564,11 @@ public final class ArticleMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Removes an article[id="
+
articleId
+
"] failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Removes an article[id="
+
articleId
+
"] failed"
,
e
);
throw
new
ServiceException
(
e
);
}
LOGGER
.
log
(
Level
.
FINER
,
"Removed an article[id={0}]"
,
articleId
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Removed an article[id={0}]"
,
articleId
);
}
/**
...
...
@@ -598,7 +598,7 @@ public final class ArticleMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
WARN
ING
,
"Updates article random value failed"
);
LOGGER
.
log
(
Level
.
WARN
,
"Updates article random value failed"
);
throw
new
ServiceException
(
e
);
}
...
...
@@ -620,7 +620,7 @@ public final class ArticleMgmtService {
return
;
}
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets article [id="
+
articleId
+
"] failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets article [id="
+
articleId
+
"] failed"
,
e
);
return
;
}
...
...
@@ -638,7 +638,7 @@ public final class ArticleMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
WARN
ING
,
"Updates article view count failed"
);
LOGGER
.
log
(
Level
.
WARN
,
"Updates article view count failed"
);
throw
new
ServiceException
(
e
);
}
...
...
@@ -669,17 +669,17 @@ public final class ArticleMgmtService {
tag
.
put
(
Tag
.
TAG_PUBLISHED_REFERENCE_COUNT
,
publishedRefCnt
);
}
tagRepository
.
update
(
tagId
,
tag
);
LOGGER
.
log
(
Level
.
FINEST
,
"Deced tag[title={0}, refCnt={1}, publishedRefCnt={2}] of article[id={3}]"
,
LOGGER
.
log
(
Level
.
TRACE
,
"Deced tag[title={0}, refCnt={1}, publishedRefCnt={2}] of article[id={3}]"
,
new
Object
[]
{
tag
.
getString
(
Tag
.
TAG_TITLE
),
tag
.
getInt
(
Tag
.
TAG_REFERENCE_COUNT
),
tag
.
getInt
(
Tag
.
TAG_PUBLISHED_REFERENCE_COUNT
),
articleId
});
}
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Decs tag references count of article[id"
+
articleId
+
"] failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Decs tag references count of article[id"
+
articleId
+
"] failed"
,
e
);
throw
new
ServiceException
(
e
);
}
LOGGER
.
log
(
Level
.
FINER
,
"Deced all tag reference count of article[id={0}]"
,
articleId
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Deced all tag reference count of article[id={0}]"
,
articleId
);
}
/**
...
...
@@ -716,7 +716,7 @@ public final class ArticleMgmtService {
archiveDateArticleRepository
.
remove
(
archiveDateArticleRelation
.
getString
(
Keys
.
OBJECT_ID
));
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Unarchive date for article[id="
+
articleId
+
"] failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Unarchive date for article[id="
+
articleId
+
"] failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
@@ -789,7 +789,7 @@ public final class ArticleMgmtService {
final
String
newTagTitle
=
newTag
.
getString
(
Tag
.
TAG_TITLE
);
if
(!
tagExists
(
newTagTitle
,
oldTags
))
{
LOGGER
.
log
(
Level
.
FINER
,
"Tag need to add[title={0}]"
,
newTagTitle
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Tag need to add[title={0}]"
,
newTagTitle
);
tagsNeedToAdd
.
add
(
newTag
);
}
else
{
tagsUnchanged
.
add
(
newTag
);
...
...
@@ -799,14 +799,14 @@ public final class ArticleMgmtService {
final
String
oldTagTitle
=
oldTag
.
getString
(
Tag
.
TAG_TITLE
);
if
(!
tagExists
(
oldTagTitle
,
newTags
))
{
LOGGER
.
log
(
Level
.
FINER
,
"Tag dropped[title={0}]"
,
oldTag
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Tag dropped[title={0}]"
,
oldTag
);
tagsDropped
.
add
(
oldTag
);
}
else
{
tagsUnchanged
.
remove
(
oldTag
);
}
}
LOGGER
.
log
(
Level
.
FINER
,
"Tags unchanged[{0}]"
,
tagsUnchanged
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Tags unchanged[{0}]"
,
tagsUnchanged
);
for
(
final
JSONObject
tagUnchanged
:
tagsUnchanged
)
{
final
String
tagId
=
tagUnchanged
.
optString
(
Keys
.
OBJECT_ID
);
...
...
@@ -934,7 +934,7 @@ public final class ArticleMgmtService {
String
tagId
;
if
(
null
==
tag
)
{
LOGGER
.
log
(
Level
.
FINEST
,
"Found a new tag[title={0}] in article[title={1}]"
,
LOGGER
.
log
(
Level
.
TRACE
,
"Found a new tag[title={0}] in article[title={1}]"
,
new
Object
[]
{
tagTitle
,
article
.
optString
(
Article
.
ARTICLE_TITLE
)});
tag
=
new
JSONObject
();
tag
.
put
(
Tag
.
TAG_TITLE
,
tagTitle
);
...
...
@@ -949,7 +949,7 @@ public final class ArticleMgmtService {
tag
.
put
(
Keys
.
OBJECT_ID
,
tagId
);
}
else
{
tagId
=
tag
.
optString
(
Keys
.
OBJECT_ID
);
LOGGER
.
log
(
Level
.
FINEST
,
"Found a existing tag[title={0}, id={1}] in article[title={2}]"
,
LOGGER
.
log
(
Level
.
TRACE
,
"Found a existing tag[title={0}, id={1}] in article[title={2}]"
,
new
Object
[]
{
tag
.
optString
(
Tag
.
TAG_TITLE
),
tag
.
optString
(
Keys
.
OBJECT_ID
),
article
.
optString
(
Article
.
ARTICLE_TITLE
)});
final
JSONObject
tagTmp
=
new
JSONObject
();
...
...
@@ -1046,7 +1046,7 @@ public final class ArticleMgmtService {
archiveDateRepository
.
add
(
archiveDate
);
}
catch
(
final
ParseException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
throw
new
RepositoryException
(
e
);
}
}
...
...
core/src/main/java/org/b3log/solo/service/ArticleQueryService.java
View file @
4acc9b1f
...
...
@@ -22,9 +22,9 @@ import java.util.Date;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Pagination
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.repository.*
;
...
...
@@ -117,7 +117,7 @@ public final class ArticleQueryService {
try
{
return
articleRepository
.
getRecentArticles
(
fetchSize
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets recent articles failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets recent articles failed"
,
e
);
return
Collections
.
emptyList
();
}
...
...
@@ -197,11 +197,11 @@ public final class ArticleQueryService {
article
.
remove
(
ARTICLE_VIEW_COUNT
);
article
.
remove
(
ARTICLE_RANDOM_DOUBLE
);
LOGGER
.
log
(
Level
.
FINER
,
"Got an article[id={0}]"
,
articleId
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Got an article[id={0}]"
,
articleId
);
return
ret
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets an article failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets an article failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -316,7 +316,7 @@ public final class ArticleQueryService {
return
ret
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets articles failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets articles failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
@@ -376,7 +376,7 @@ public final class ArticleQueryService {
return
ret
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets articles by tag[id="
+
tagId
+
"] failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets articles by tag[id="
+
tagId
+
"] failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -436,7 +436,7 @@ public final class ArticleQueryService {
return
ret
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets articles by archive date[id="
+
archiveDateId
+
"] failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets articles by archive date[id="
+
archiveDateId
+
"] failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -461,7 +461,7 @@ public final class ArticleQueryService {
return
ret
;
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets articles randomly failed[fetchSize="
+
fetchSize
+
"]"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets articles randomly failed[fetchSize="
+
fetchSize
+
"]"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -541,7 +541,7 @@ public final class ArticleQueryService {
return
ret
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets relevant articles failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets relevant articles failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
@@ -558,7 +558,7 @@ public final class ArticleQueryService {
try
{
return
articleRepository
.
isPublished
(
articleId
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Determines the article publish status failed[articleId="
+
articleId
+
"]"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Determines the article publish status failed[articleId="
+
articleId
+
"]"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -585,7 +585,7 @@ public final class ArticleQueryService {
try
{
return
articleRepository
.
getNextArticle
(
articleId
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets the next article failed[articleId="
+
articleId
+
"]"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets the next article failed[articleId="
+
articleId
+
"]"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -612,7 +612,7 @@ public final class ArticleQueryService {
try
{
return
articleRepository
.
getPreviousArticle
(
articleId
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets the previous article failed[articleId="
+
articleId
+
"]"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets the previous article failed[articleId="
+
articleId
+
"]"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -632,7 +632,7 @@ public final class ArticleQueryService {
try
{
return
articleRepository
.
get
(
articleId
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets an article[articleId="
+
articleId
+
"] failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets an article[articleId="
+
articleId
+
"] failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -666,7 +666,7 @@ public final class ArticleQueryService {
return
ret
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
LOGGER
.
log
(
Level
.
ERROR
,
"Gets articles by author email failed[authorEmail="
+
authorEmail
+
", currentPageNum="
+
currentPageNum
+
", pageSize="
+
pageSize
+
"]"
,
e
);
...
...
@@ -709,7 +709,7 @@ public final class ArticleQueryService {
return
article
.
getString
(
Article
.
ARTICLE_CONTENT
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets article content failed[articleId="
+
articleId
+
"]"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets article content failed[articleId="
+
articleId
+
"]"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
core/src/main/java/org/b3log/solo/service/CommentMgmtService.java
View file @
4acc9b1f
...
...
@@ -19,8 +19,6 @@ package org.b3log.solo.service;
import
java.io.IOException
;
import
java.net.URL
;
import
java.util.Date
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang.StringEscapeUtils
;
import
org.apache.commons.lang.time.DateFormatUtils
;
...
...
@@ -28,6 +26,8 @@ import org.b3log.latke.Keys;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.event.Event
;
import
org.b3log.latke.event.EventManager
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.RepositoryException
;
import
org.b3log.latke.repository.Transaction
;
import
org.b3log.latke.service.ServiceException
;
...
...
@@ -179,7 +179,7 @@ public final class CommentMgmtService {
comment
.
put
(
Comment
.
COMMENT_ORIGINAL_COMMENT_NAME
,
originalCommentName
);
ret
.
put
(
Comment
.
COMMENT_ORIGINAL_COMMENT_NAME
,
originalCommentName
);
}
else
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Not found orginal comment[id={0}] of reply[name={1}, content={2}]"
,
LOGGER
.
log
(
Level
.
WARN
,
"Not found orginal comment[id={0}] of reply[name={1}, content={2}]"
,
new
String
[]
{
originalCommentId
,
commentName
,
commentContent
});
}
}
...
...
@@ -207,7 +207,7 @@ public final class CommentMgmtService {
try
{
Comments
.
sendNotificationMail
(
page
,
comment
,
originalComment
,
preference
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Send mail failed"
,
e
);
LOGGER
.
log
(
Level
.
WARN
,
"Send mail failed"
,
e
);
}
// Step 5: Fire add comment event
final
JSONObject
eventData
=
new
JSONObject
();
...
...
@@ -300,7 +300,7 @@ public final class CommentMgmtService {
comment
.
put
(
Comment
.
COMMENT_ORIGINAL_COMMENT_NAME
,
originalCommentName
);
ret
.
put
(
Comment
.
COMMENT_ORIGINAL_COMMENT_NAME
,
originalCommentName
);
}
else
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Not found orginal comment[id={0}] of reply[name={1}, content={2}]"
,
LOGGER
.
log
(
Level
.
WARN
,
"Not found orginal comment[id={0}] of reply[name={1}, content={2}]"
,
new
String
[]
{
originalCommentId
,
commentName
,
commentContent
});
}
}
...
...
@@ -328,7 +328,7 @@ public final class CommentMgmtService {
try
{
Comments
.
sendNotificationMail
(
article
,
comment
,
originalComment
,
preference
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Send mail failed"
,
e
);
LOGGER
.
log
(
Level
.
WARN
,
"Send mail failed"
,
e
);
}
// Step 5: Fire add comment event
final
JSONObject
eventData
=
new
JSONObject
();
...
...
@@ -378,7 +378,7 @@ public final class CommentMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Removes a comment of a page failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Removes a comment of a page failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -411,7 +411,7 @@ public final class CommentMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Removes a comment of an article failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Removes a comment of an article failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -499,7 +499,7 @@ public final class CommentMgmtService {
statusCode
=
response
.
getResponseCode
();
}
catch
(
final
IOException
e
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Can not fetch thumbnail from Gravatar[commentEmail={0}]"
,
commentEmail
);
LOGGER
.
log
(
Level
.
WARN
,
"Can not fetch thumbnail from Gravatar[commentEmail={0}]"
,
commentEmail
);
}
finally
{
if
(
HttpServletResponse
.
SC_OK
!=
statusCode
)
{
thumbnailURL
=
Latkes
.
getStaticServePath
()
+
"/images/"
+
DEFAULT_USER_THUMBNAIL
;
...
...
core/src/main/java/org/b3log/solo/service/CommentQueryService.java
View file @
4acc9b1f
...
...
@@ -19,10 +19,10 @@ package org.b3log.solo.service;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.apache.commons.lang.StringEscapeUtils
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Pagination
;
import
org.b3log.latke.repository.Query
;
import
org.b3log.latke.repository.SortDirection
;
...
...
@@ -168,7 +168,7 @@ public final class CommentQueryService {
return
ret
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets comments failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets comments failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
@@ -206,7 +206,7 @@ public final class CommentQueryService {
return
ret
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets comments failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets comments failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
core/src/main/java/org/b3log/solo/service/InitService.java
View file @
4acc9b1f
...
...
@@ -22,14 +22,14 @@ import java.text.ParseException;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.apache.commons.lang.StringEscapeUtils
;
import
org.apache.commons.lang.time.DateFormatUtils
;
import
org.apache.commons.lang.time.DateUtils
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.RuntimeEnv
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Role
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.repository.RepositoryException
;
...
...
@@ -196,13 +196,13 @@ public final class InitService {
break
;
}
catch
(
final
Exception
e
)
{
if
(
0
==
retries
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Initialize B3log Solo error"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Initialize B3log Solo error"
,
e
);
throw
new
ServiceException
(
"Initailize B3log Solo error: "
+
e
.
getMessage
());
}
// Allow retry to occur
--
retries
;
LOGGER
.
log
(
Level
.
WARN
ING
,
"Retrying to init B3log Solo[retries={0}]"
,
retries
);
LOGGER
.
log
(
Level
.
WARN
,
"Retrying to init B3log Solo[retries={0}]"
,
retries
);
}
finally
{
if
(
transaction
.
isActive
())
{
transaction
.
rollback
();
...
...
@@ -220,7 +220,7 @@ public final class InitService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Hello World error?!"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Hello World error?!"
,
e
);
}
}
...
...
@@ -321,7 +321,7 @@ public final class InitService {
admin
.
put
(
UserExt
.
USER_PUBLISHED_ARTICLE_COUNT
,
1
);
userRepository
.
update
(
admin
.
optString
(
Keys
.
OBJECT_ID
),
admin
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Adds an article failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Adds an article failed"
,
e
);
throw
new
RepositoryException
(
e
);
}
...
...
@@ -355,7 +355,7 @@ public final class InitService {
archiveDateRepository
.
add
(
archiveDate
);
}
catch
(
final
ParseException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
throw
new
RepositoryException
(
e
);
}
...
...
@@ -401,7 +401,7 @@ public final class InitService {
final
String
tagTitle
=
tagTitles
[
i
].
trim
();
final
JSONObject
tag
=
new
JSONObject
();
LOGGER
.
log
(
Level
.
FINEST
,
"Found a new tag[title={0}] in article[title={1}]"
,
LOGGER
.
log
(
Level
.
TRACE
,
"Found a new tag[title={0}] in article[title={1}]"
,
new
Object
[]
{
tagTitle
,
article
.
optString
(
Article
.
ARTICLE_TITLE
)});
tag
.
put
(
Tag
.
TAG_TITLE
,
tagTitle
);
tag
.
put
(
Tag
.
TAG_REFERENCE_COUNT
,
1
);
...
...
@@ -562,7 +562,7 @@ public final class InitService {
Templates
.
MAIN_CFG
.
setDirectoryForTemplateLoading
(
new
File
(
skinPath
));
}
catch
(
final
IOException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Loads skins error!"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Loads skins error!"
,
e
);
throw
new
IllegalStateException
(
e
);
}
...
...
core/src/main/java/org/b3log/solo/service/LinkMgmtService.java
View file @
4acc9b1f
...
...
@@ -16,9 +16,9 @@
package
org
.
b3log
.
solo
.
service
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.Transaction
;
import
org.b3log.latke.service.ServiceException
;
import
org.b3log.solo.model.Link
;
...
...
@@ -65,7 +65,7 @@ public final class LinkMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Removes a link[id="
+
linkId
+
"] failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Removes a link[id="
+
linkId
+
"] failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -104,7 +104,7 @@ public final class LinkMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
throw
new
ServiceException
(
e
);
}
...
...
@@ -139,7 +139,7 @@ public final class LinkMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
WARN
ING
,
"Cant not find the target link of source link[order={0}]"
,
srcLinkOrder
);
LOGGER
.
log
(
Level
.
WARN
,
"Cant not find the target link of source link[order={0}]"
,
srcLinkOrder
);
return
;
}
...
...
@@ -156,7 +156,7 @@ public final class LinkMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Changes link's order failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Changes link's order failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
@@ -197,7 +197,7 @@ public final class LinkMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Adds a link failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Adds a link failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
core/src/main/java/org/b3log/solo/service/LinkQueryService.java
View file @
4acc9b1f
...
...
@@ -17,9 +17,9 @@ package org.b3log.solo.service;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Pagination
;
import
org.b3log.latke.repository.Query
;
import
org.b3log.latke.repository.SortDirection
;
...
...
@@ -106,7 +106,7 @@ public final class LinkQueryService {
return
ret
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets links failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets links failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -142,7 +142,7 @@ public final class LinkQueryService {
return
ret
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets a link failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets a link failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
core/src/main/java/org/b3log/solo/service/OptionMgmtService.java
View file @
4acc9b1f
...
...
@@ -16,7 +16,6 @@
package
org
.
b3log
.
solo
.
service
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.repository.Transaction
;
import
org.b3log.latke.service.ServiceException
;
...
...
@@ -36,11 +35,6 @@ import org.json.JSONObject;
*/
public
final
class
OptionMgmtService
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
OptionMgmtService
.
class
.
getName
());
/**
* Option repository.
*/
...
...
core/src/main/java/org/b3log/solo/service/OptionQueryService.java
View file @
4acc9b1f
...
...
@@ -16,7 +16,6 @@
package
org
.
b3log
.
solo
.
service
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.repository.FilterOperator
;
import
org.b3log.latke.repository.PropertyFilter
;
...
...
@@ -39,11 +38,6 @@ import org.json.JSONObject;
*/
public
final
class
OptionQueryService
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
OptionQueryService
.
class
.
getName
());
/**
* Option repository.
*/
...
...
core/src/main/java/org/b3log/solo/service/PageMgmtService.java
View file @
4acc9b1f
...
...
@@ -17,9 +17,9 @@ package org.b3log.solo.service;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.RepositoryException
;
import
org.b3log.latke.repository.Transaction
;
import
org.b3log.latke.service.LangPropsService
;
...
...
@@ -166,9 +166,9 @@ public final class PageMgmtService {
transaction
.
commit
();
LOGGER
.
log
(
Level
.
FINER
,
"Updated a page[id={0}]"
,
pageId
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Updated a page[id={0}]"
,
pageId
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
if
(
transaction
.
isActive
())
{
transaction
.
rollback
();
}
...
...
@@ -187,7 +187,7 @@ public final class PageMgmtService {
final
Transaction
transaction
=
pageRepository
.
beginTransaction
();
try
{
LOGGER
.
log
(
Level
.
FINER
,
"Removing a page[id={0}]"
,
pageId
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Removing a page[id={0}]"
,
pageId
);
removePageComments
(
pageId
);
pageRepository
.
remove
(
pageId
);
...
...
@@ -198,7 +198,7 @@ public final class PageMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Removes a page[id="
+
pageId
+
"] failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Removes a page[id="
+
pageId
+
"] failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
@@ -277,14 +277,14 @@ public final class PageMgmtService {
return
ret
;
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
if
(
transaction
.
isActive
())
{
transaction
.
rollback
();
}
throw
new
ServiceException
(
e
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
if
(
transaction
.
isActive
())
{
transaction
.
rollback
();
}
...
...
@@ -322,7 +322,7 @@ public final class PageMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
WARN
ING
,
"Cant not find the target page of source page[order={0}]"
,
srcPageOrder
);
LOGGER
.
log
(
Level
.
WARN
,
"Cant not find the target page of source page[order={0}]"
,
srcPageOrder
);
return
;
}
...
...
@@ -339,7 +339,7 @@ public final class PageMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Changes page's order failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Changes page's order failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
core/src/main/java/org/b3log/solo/service/PageQueryService.java
View file @
4acc9b1f
...
...
@@ -17,9 +17,9 @@ package org.b3log.solo.service;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Pagination
;
import
org.b3log.latke.repository.Query
;
import
org.b3log.latke.repository.SortDirection
;
...
...
@@ -87,7 +87,7 @@ public final class PageQueryService {
return
ret
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
throw
new
ServiceException
(
e
);
}
...
...
@@ -158,7 +158,7 @@ public final class PageQueryService {
return
ret
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets pages failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets pages failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
core/src/main/java/org/b3log/solo/service/PluginMgmtService.java
View file @
4acc9b1f
...
...
@@ -18,11 +18,10 @@ package org.b3log.solo.service;
import
java.util.List
;
import
java.util.Map
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Plugin
;
import
org.b3log.latke.plugin.AbstractPlugin
;
import
org.b3log.latke.plugin.PluginManager
;
...
...
@@ -101,7 +100,7 @@ public final class PluginMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Set plugin status error"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Set plugin status error"
,
e
);
ret
.
put
(
Keys
.
STATUS_CODE
,
false
);
ret
.
put
(
Keys
.
MSG
,
langs
.
get
(
"setFailLabel"
));
...
...
@@ -153,7 +152,7 @@ public final class PluginMgmtService {
if
(
transaction
.
isActive
())
{
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Set plugin status error"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Set plugin status error"
,
e
);
ret
.
put
(
Keys
.
STATUS_CODE
,
false
);
ret
.
put
(
Keys
.
MSG
,
langs
.
get
(
"setFailLabel"
));
...
...
core/src/main/java/org/b3log/solo/service/PluginQueryService.java
View file @
4acc9b1f
...
...
@@ -18,9 +18,8 @@ package org.b3log.solo.service;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Pagination
;
import
org.b3log.latke.model.Plugin
;
import
org.b3log.latke.plugin.AbstractPlugin
;
...
...
@@ -117,7 +116,7 @@ public final class PluginQueryService {
return
ret
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets plugins failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets plugins failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
@@ -138,13 +137,13 @@ public final class PluginQueryService {
try
{
ret
=
pluginRepository
.
get
(
pluginId
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"get plugin["
+
pluginId
+
"] fail"
);
LOGGER
.
log
(
Level
.
ERROR
,
"get plugin["
+
pluginId
+
"] fail"
);
throw
new
ServiceException
(
"get plugin["
+
pluginId
+
"] fail"
);
}
if
(
ret
==
null
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"can not find plugin["
+
pluginId
+
"]"
);
LOGGER
.
log
(
Level
.
ERROR
,
"can not find plugin["
+
pluginId
+
"]"
);
throw
new
ServiceException
(
"can not find plugin["
+
pluginId
+
"]"
);
}
...
...
core/src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
View file @
4acc9b1f
...
...
@@ -25,10 +25,10 @@ import java.io.File;
import
java.util.Iterator
;
import
java.util.Locale
;
import
java.util.Set
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.RuntimeEnv
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.RepositoryException
;
import
org.b3log.latke.repository.Transaction
;
import
org.b3log.latke.service.ServiceException
;
...
...
@@ -93,7 +93,7 @@ public final class PreferenceMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Updates reply notification failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Updates reply notification failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -141,7 +141,7 @@ public final class PreferenceMgmtService {
final
String
webRootPath
=
SoloServletListener
.
getWebRoot
();
final
String
skinPath
=
webRootPath
+
Skin
.
SKINS
+
"/"
+
skinDirName
;
LOGGER
.
log
(
Level
.
FINER
,
"Skin path[{0}]"
,
skinPath
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Skin path[{0}]"
,
skinPath
);
Templates
.
CACHE
.
clear
();
preference
.
put
(
Skin
.
SKINS
,
skinArray
.
toString
());
...
...
@@ -185,7 +185,7 @@ public final class PreferenceMgmtService {
final
String
localeString
=
preference
.
getString
(
Preference
.
LOCALE_STRING
);
LOGGER
.
log
(
Level
.
FINER
,
"Current locale[string={0}]"
,
localeString
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Current locale[string={0}]"
,
localeString
);
Latkes
.
setLocale
(
new
Locale
(
Locales
.
getLanguage
(
localeString
),
Locales
.
getCountry
(
localeString
)));
preferenceRepository
.
update
(
Preference
.
PREFERENCE
,
preference
);
...
...
@@ -203,23 +203,23 @@ public final class PreferenceMgmtService {
if
(
transaction
.
isActive
())
{
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Updates preference failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Updates preference failed"
,
e
);
throw
new
ServiceException
(
langPropsService
.
get
(
"updateFailLabel"
));
}
catch
(
final
RepositoryException
e
)
{
if
(
transaction
.
isActive
())
{
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Updates preference failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Updates preference failed"
,
e
);
throw
new
ServiceException
(
langPropsService
.
get
(
"updateFailLabel"
));
}
catch
(
final
IOException
e
)
{
if
(
transaction
.
isActive
())
{
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Updates preference failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Updates preference failed"
,
e
);
throw
new
ServiceException
(
langPropsService
.
get
(
"updateFailLabel"
));
}
LOGGER
.
log
(
Level
.
FINER
,
"Updates preference successfully"
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Updates preference successfully"
);
}
/**
...
...
core/src/main/java/org/b3log/solo/service/PreferenceQueryService.java
View file @
4acc9b1f
...
...
@@ -16,8 +16,8 @@
package
org
.
b3log
.
solo
.
service
;
import
java.util
.logging.Level
;
import
java.util
.logging.Logger
;
import
org.b3log.latke
.logging.Level
;
import
org.b3log.latke
.logging.Logger
;
import
org.b3log.latke.repository.RepositoryException
;
import
org.b3log.latke.service.ServiceException
;
import
org.b3log.solo.model.Preference
;
...
...
@@ -55,7 +55,7 @@ public final class PreferenceQueryService {
try
{
return
preferenceRepository
.
get
(
Preference
.
REPLY_NOTIFICATION_TEMPLATE
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Updates reply notification template failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Updates reply notification template failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -75,13 +75,13 @@ public final class PreferenceQueryService {
final
JSONObject
ret
=
preferenceRepository
.
get
(
Preference
.
PREFERENCE
);
if
(
null
==
ret
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Can not load preference from datastore"
);
LOGGER
.
log
(
Level
.
WARN
,
"Can not load preference from datastore"
);
return
null
;
}
return
ret
;
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
throw
new
IllegalStateException
(
e
);
}
}
...
...
core/src/main/java/org/b3log/solo/service/StatisticMgmtService.java
View file @
4acc9b1f
...
...
@@ -21,10 +21,10 @@ import java.util.HashSet;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.cache.PageCaches
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.RepositoryException
;
import
org.b3log.latke.repository.Transaction
;
import
org.b3log.latke.service.LangPropsService
;
...
...
@@ -138,7 +138,7 @@ public final class StatisticMgmtService {
continue
;
}
LOGGER
.
log
(
Level
.
FINER
,
"Updating article[id={0}, title={1}] view count"
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Updating article[id={0}, title={1}] view count"
,
new
Object
[]
{
articleId
,
cachedPage
.
optString
(
PageCaches
.
CACHED_TITLE
)});
final
int
oldViewCount
=
article
.
optInt
(
Article
.
ARTICLE_VIEW_COUNT
);
...
...
@@ -152,7 +152,7 @@ public final class StatisticMgmtService {
cachedPage
.
put
(
PageCaches
.
CACHED_HIT_COUNT
,
0
);
LOGGER
.
log
(
Level
.
FINER
,
"Updating article[id={0}, title={1}] view count from [{2}] to [{3}]"
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Updating article[id={0}, title={1}] view count from [{2}] to [{3}]"
,
new
Object
[]
{
articleId
,
article
.
optString
(
Article
.
ARTICLE_TITLE
),
oldViewCount
,
viewCount
});
}
...
...
@@ -164,7 +164,7 @@ public final class StatisticMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Updates statistic failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Updates statistic failed"
,
e
);
}
}
...
...
@@ -184,10 +184,10 @@ public final class StatisticMgmtService {
if
(
transaction
.
isActive
())
{
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Updates statistic failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Updates statistic failed"
,
e
);
}
LOGGER
.
log
(
Level
.
FINER
,
"Updates statistic successfully"
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Updates statistic successfully"
);
}
/**
...
...
core/src/main/java/org/b3log/solo/service/StatisticQueryService.java
View file @
4acc9b1f
...
...
@@ -16,8 +16,8 @@
package
org
.
b3log
.
solo
.
service
;
import
java.util
.logging.Level
;
import
java.util
.logging.Logger
;
import
org.b3log.latke
.logging.Level
;
import
org.b3log.latke
.logging.Logger
;
import
org.b3log.latke.repository.RepositoryException
;
import
org.b3log.latke.service.ServiceException
;
import
org.b3log.solo.model.Statistic
;
...
...
@@ -56,13 +56,13 @@ public final class StatisticQueryService {
final
JSONObject
ret
=
statisticRepository
.
get
(
Statistic
.
STATISTIC
);
if
(
null
==
ret
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Can not load statistic from repository"
);
LOGGER
.
log
(
Level
.
WARN
,
"Can not load statistic from repository"
);
return
null
;
}
return
ret
;
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
throw
new
IllegalStateException
(
e
);
}
}
...
...
core/src/main/java/org/b3log/solo/service/TagMgmtService.java
View file @
4acc9b1f
...
...
@@ -17,9 +17,9 @@ package org.b3log.solo.service;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.Transaction
;
import
org.b3log.latke.service.ServiceException
;
import
org.b3log.solo.model.Tag
;
...
...
@@ -80,7 +80,7 @@ public final class TagMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Removes unused tags failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Removes unused tags failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
core/src/main/java/org/b3log/solo/service/TagQueryService.java
View file @
4acc9b1f
...
...
@@ -17,9 +17,9 @@ package org.b3log.solo.service;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.Query
;
import
org.b3log.latke.repository.RepositoryException
;
import
org.b3log.latke.service.ServiceException
;
...
...
@@ -79,11 +79,11 @@ public final class TagQueryService {
ret
.
put
(
Tag
.
TAG
,
tag
);
LOGGER
.
log
(
Level
.
FINER
,
"Got an tag[title={0}]"
,
tagTitle
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Got an tag[title={0}]"
,
tagTitle
);
return
ret
;
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets an article failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets an article failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -98,7 +98,7 @@ public final class TagQueryService {
try
{
return
tagRepository
.
count
();
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets tags failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets tags failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
@@ -125,7 +125,7 @@ public final class TagQueryService {
return
CollectionUtils
.
jsonArrayToList
(
tagArray
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets tags failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets tags failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
core/src/main/java/org/b3log/solo/service/UserMgmtService.java
View file @
4acc9b1f
...
...
@@ -16,10 +16,10 @@
package
org
.
b3log
.
solo
.
service
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Role
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.repository.RepositoryException
;
...
...
@@ -136,7 +136,7 @@ public final class UserMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Updates a user failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Updates a user failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -173,7 +173,7 @@ public final class UserMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Updates a user failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Updates a user failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -249,7 +249,7 @@ public final class UserMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Adds a user failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Adds a user failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -272,7 +272,7 @@ public final class UserMgmtService {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Removes a user[id="
+
userId
+
"] failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Removes a user[id="
+
userId
+
"] failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
core/src/main/java/org/b3log/solo/service/UserQueryService.java
View file @
4acc9b1f
...
...
@@ -17,9 +17,9 @@ package org.b3log.solo.service;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Pagination
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.repository.Query
;
...
...
@@ -68,7 +68,7 @@ public final class UserQueryService {
try
{
return
userRepository
.
getAdmin
();
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets admin failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets admin failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -84,7 +84,7 @@ public final class UserQueryService {
try
{
return
userRepository
.
getByEmail
(
email
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets user by email["
+
email
+
"] failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets user by email["
+
email
+
"] failed"
,
e
);
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -132,7 +132,7 @@ public final class UserQueryService {
try
{
result
=
userRepository
.
get
(
query
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets users failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets users failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
@@ -179,7 +179,7 @@ public final class UserQueryService {
try
{
user
=
userRepository
.
get
(
userId
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets a user failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets a user failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
core/src/main/java/org/b3log/solo/util/Articles.java
View file @
4acc9b1f
...
...
@@ -20,11 +20,11 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.*
;
import
org.b3log.latke.service.ServiceException
;
import
org.b3log.latke.user.UserService
;
...
...
@@ -134,7 +134,7 @@ public final class Articles {
return
((
Date
)
recentArticle
.
get
(
Article
.
ARTICLE_UPDATE_DATE
)).
getTime
();
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
throw
new
ServiceException
(
"Gets recent article time failed"
);
}
}
...
...
@@ -164,7 +164,7 @@ public final class Articles {
JSONObject
ret
=
userRepository
.
getByEmail
(
email
);
if
(
null
==
ret
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Gets author of article failed, assumes the administrator is the author of this article[id={0}]"
,
LOGGER
.
log
(
Level
.
WARN
,
"Gets author of article failed, assumes the administrator is the author of this article[id={0}]"
,
article
.
getString
(
Keys
.
OBJECT_ID
));
// This author may be deleted by admin, use admin as the author
// of this article
...
...
@@ -173,10 +173,10 @@ public final class Articles {
return
ret
;
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets author of article[id={0}] failed"
,
article
.
optString
(
Keys
.
OBJECT_ID
));
LOGGER
.
log
(
Level
.
ERROR
,
"Gets author of article[id={0}] failed"
,
article
.
optString
(
Keys
.
OBJECT_ID
));
throw
new
ServiceException
(
e
);
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets author of article[id={0}] failed"
,
article
.
optString
(
Keys
.
OBJECT_ID
));
LOGGER
.
log
(
Level
.
ERROR
,
"Gets author of article[id={0}] failed"
,
article
.
optString
(
Keys
.
OBJECT_ID
));
throw
new
ServiceException
(
e
);
}
}
...
...
@@ -224,7 +224,7 @@ public final class Articles {
}
}
LOGGER
.
log
(
Level
.
WARN
ING
,
"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"
);
}
...
...
core/src/main/java/org/b3log/solo/util/Comments.java
View file @
4acc9b1f
...
...
@@ -17,10 +17,10 @@ package org.b3log.solo.util;
import
java.io.IOException
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.mail.MailService
;
import
org.b3log.latke.mail.MailService.Message
;
import
org.b3log.latke.mail.MailServiceFactory
;
...
...
@@ -187,7 +187,7 @@ public final class Comments {
final
String
commentName
=
requestJSONObject
.
getString
(
Comment
.
COMMENT_NAME
);
if
(
MAX_COMMENT_NAME_LENGTH
<
commentName
.
length
()
||
MIN_COMMENT_NAME_LENGTH
>
commentName
.
length
())
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Comment name is too long[{0}]"
,
commentName
);
LOGGER
.
log
(
Level
.
WARN
,
"Comment name is too long[{0}]"
,
commentName
);
ret
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"nameTooLongLabel"
));
return
ret
;
...
...
@@ -196,7 +196,7 @@ public final class Comments {
final
String
commentEmail
=
requestJSONObject
.
getString
(
Comment
.
COMMENT_EMAIL
).
trim
().
toLowerCase
();
if
(!
Strings
.
isEmail
(
commentEmail
))
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Comment email is invalid[{0}]"
,
commentEmail
);
LOGGER
.
log
(
Level
.
WARN
,
"Comment email is invalid[{0}]"
,
commentEmail
);
ret
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"mailInvalidLabel"
));
return
ret
;
...
...
@@ -205,7 +205,7 @@ public final class Comments {
final
String
commentURL
=
requestJSONObject
.
optString
(
Comment
.
COMMENT_URL
);
if
(!
Strings
.
isURL
(
commentURL
))
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Comment URL is invalid[{0}]"
,
commentURL
);
LOGGER
.
log
(
Level
.
WARN
,
"Comment URL is invalid[{0}]"
,
commentURL
);
ret
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"urlInvalidLabel"
));
return
ret
;
...
...
@@ -215,7 +215,7 @@ public final class Comments {
SoloServletListener
.
ENTER_ESC
);
if
(
MAX_COMMENT_CONTENT_LENGTH
<
commentContent
.
length
()
||
MIN_COMMENT_CONTENT_LENGTH
>
commentContent
.
length
())
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Comment conent length is invalid[{0}]"
,
commentContent
.
length
());
LOGGER
.
log
(
Level
.
WARN
,
"Comment conent length is invalid[{0}]"
,
commentContent
.
length
());
ret
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"commentContentCannotEmptyLabel"
));
return
ret
;
...
...
@@ -225,7 +225,7 @@ public final class Comments {
return
ret
;
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Checks add comment request["
+
requestJSONObject
.
toString
()
+
"] failed"
,
e
);
LOGGER
.
log
(
Level
.
WARN
,
"Checks add comment request["
+
requestJSONObject
.
toString
()
+
"] failed"
,
e
);
ret
.
put
(
Keys
.
STATUS_CODE
,
false
);
ret
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"addFailLabel"
));
...
...
@@ -258,7 +258,7 @@ public final class Comments {
final
String
adminEmail
=
preference
.
getString
(
Preference
.
ADMIN_EMAIL
);
if
(
adminEmail
.
equalsIgnoreCase
(
commentEmail
))
{
LOGGER
.
log
(
Level
.
FINER
,
"Do not send comment notification mail to admin itself[{0}]"
,
adminEmail
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Do not send comment notification mail to admin itself[{0}]"
,
adminEmail
);
return
;
}
...
...
@@ -266,7 +266,7 @@ public final class Comments {
final
String
originalEmail
=
originalComment
.
getString
(
Comment
.
COMMENT_EMAIL
);
if
(
originalEmail
.
equalsIgnoreCase
(
adminEmail
))
{
LOGGER
.
log
(
Level
.
FINER
,
"Do not send comment notification mail to admin while the specified comment[{0}] is an reply"
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Do not send comment notification mail to admin while the specified comment[{0}] is an reply"
,
commentId
);
return
;
}
...
...
@@ -315,7 +315,7 @@ public final class Comments {
"{commenter}"
,
commenter
);
message
.
setHtmlBody
(
mailBody
);
LOGGER
.
log
(
Level
.
FINER
,
"Sending a mail[mailSubject={0}, mailBody=[{1}] to admin[email={2}]"
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Sending a mail[mailSubject={0}, mailBody=[{1}] to admin[email={2}]"
,
new
Object
[]
{
mailSubject
,
mailBody
,
adminEmail
});
MAIL_SVC
.
send
(
message
);
}
...
...
core/src/main/java/org/b3log/solo/util/Markdowns.java
View file @
4acc9b1f
...
...
@@ -18,8 +18,8 @@ package org.b3log.solo.util;
import
java.io.StringReader
;
import
java.io.StringWriter
;
import
java.util
.logging.Level
;
import
java.util
.logging.Logger
;
import
org.b3log.latke
.logging.Level
;
import
org.b3log.latke
.logging.Logger
;
import
org.b3log.latke.util.Strings
;
import
org.tautua.markdownpapers.Markdown
;
import
org.tautua.markdownpapers.parser.ParseException
;
...
...
@@ -59,7 +59,7 @@ public final class Markdowns {
try
{
markdown
.
transform
(
new
StringReader
(
markdownText
),
writer
);
}
catch
(
final
ParseException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Markdown error"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Markdown error"
,
e
);
return
"Markdown error"
;
}
...
...
core/src/main/java/org/b3log/solo/util/Permalinks.java
View file @
4acc9b1f
...
...
@@ -16,10 +16,10 @@
package
org
.
b3log
.
solo
.
util
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.RepositoryException
;
import
org.b3log.latke.util.Strings
;
import
org.b3log.solo.repository.ArticleRepository
;
...
...
@@ -217,7 +217,7 @@ public final class Permalinks {
return
isReservedLink
(
permalink
)
||
null
!=
articleRepository
.
getByPermalink
(
permalink
)
||
null
!=
pageRepository
.
getByPermalink
(
permalink
)
||
permalink
.
endsWith
(
".ftl"
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Determines whether the permalink["
+
permalink
+
"] exists failed, returns true"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Determines whether the permalink["
+
permalink
+
"] exists failed, returns true"
,
e
);
return
true
;
}
...
...
core/src/main/java/org/b3log/solo/util/Plugins.java
View file @
4acc9b1f
...
...
@@ -17,11 +17,10 @@ package org.b3log.solo.util;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
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.b3log.latke.model.Plugin
;
import
org.b3log.latke.plugin.AbstractPlugin
;
import
org.b3log.latke.plugin.PluginStatus
;
...
...
@@ -84,7 +83,7 @@ public final class Plugins {
plugin
.
setSetting
(
new
JSONObject
(
setting
));
}
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"the formatter of the old config failed to convert to json"
,
e
);
LOGGER
.
log
(
Level
.
WARN
,
"the formatter of the old config failed to convert to json"
,
e
);
}
}
}
...
...
@@ -95,11 +94,11 @@ public final class Plugins {
PLUGIN_REPOS
.
add
(
pluginDesc
);
LOGGER
.
log
(
Level
.
FINEST
,
"Refreshed plugin[{0}]"
,
pluginDesc
);
LOGGER
.
log
(
Level
.
TRACE
,
"Refreshed plugin[{0}]"
,
pluginDesc
);
}
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Refresh plugins failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Refresh plugins failed"
,
e
);
}
PLUGIN_REPOS
.
setCacheEnabled
(
true
);
...
...
core/src/main/java/org/b3log/solo/util/Skins.java
View file @
4acc9b1f
...
...
@@ -25,11 +25,11 @@ import java.util.HashSet;
import
java.util.Map
;
import
java.util.Properties
;
import
java.util.Set
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.cache.PageCaches
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.service.ServiceException
;
import
org.b3log.latke.util.Locales
;
import
org.b3log.latke.util.Stopwatchs
;
...
...
@@ -113,7 +113,7 @@ public final class Skins {
dataModel
.
putAll
(
langs
);
}
catch
(
final
IOException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Fills skin langs failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Fills skin langs failed"
,
e
);
throw
new
ServiceException
(
e
);
}
finally
{
Stopwatchs
.
end
();
...
...
@@ -139,7 +139,7 @@ public final class Skins {
final
Set
<
String
>
skinDirNames
=
getSkinDirNames
();
LOGGER
.
log
(
Level
.
FINER
,
"Loaded skins[dirNames={0}]"
,
skinDirNames
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Loaded skins[dirNames={0}]"
,
skinDirNames
);
final
JSONArray
skinArray
=
new
JSONArray
();
for
(
final
String
dirName
:
skinDirNames
)
{
...
...
@@ -147,7 +147,7 @@ public final class Skins {
final
String
name
=
getSkinName
(
dirName
);
if
(
null
==
name
)
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"The directory[{0}] does not contain any skin, ignored it"
,
dirName
);
LOGGER
.
log
(
Level
.
WARN
,
"The directory[{0}] does not contain any skin, ignored it"
,
dirName
);
continue
;
}
...
...
@@ -163,10 +163,10 @@ public final class Skins {
LOGGER
.
log
(
Level
.
INFO
,
"Current skin[name={0}]"
,
skinName
);
if
(!
skinDirNames
.
contains
(
currentSkinDirName
))
{
LOGGER
.
log
(
Level
.
WARN
ING
,
"Configred skin[dirName={0}] can not find, try to use "
+
"default skin[dirName=ease] instead."
,
LOGGER
.
log
(
Level
.
WARN
,
"Configred skin[dirName={0}] can not find, try to use "
+
"default skin[dirName=ease] instead."
,
currentSkinDirName
);
if
(!
skinDirNames
.
contains
(
"ease"
))
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Can not find skin[dirName=ease]"
);
LOGGER
.
log
(
Level
.
ERROR
,
"Can not find skin[dirName=ease]"
);
throw
new
IllegalStateException
(
"Can not find default skin[dirName=ease], please redeploy your B3log Solo and make sure "
...
...
@@ -223,7 +223,7 @@ public final class Skins {
Templates
.
MOBILE_CFG
.
setDirectoryForTemplateLoading
(
new
File
(
webRootPath
+
SKINS
+
File
.
separator
+
"mobile"
));
}
catch
(
final
IOException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Loads skins error!"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Loads skins error!"
,
e
);
throw
new
IllegalStateException
(
e
);
}
}
...
...
@@ -257,7 +257,7 @@ public final class Skins {
final
Set
<
String
>
ret
=
new
HashSet
<
String
>();
if
(
null
==
skinDirs
)
{
LOGGER
.
severe
(
"Skin directory is null"
);
LOGGER
.
error
(
"Skin directory is null"
);
return
ret
;
}
...
...
@@ -292,13 +292,13 @@ public final class Skins {
});
if
(
null
==
skinDirs
)
{
LOGGER
.
severe
(
"Skin directory is null"
);
LOGGER
.
error
(
"Skin directory is null"
);
return
null
;
}
if
(
1
!=
skinDirs
.
length
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Skin directory count[{0}]"
,
skinDirs
.
length
);
LOGGER
.
log
(
Level
.
ERROR
,
"Skin directory count[{0}]"
,
skinDirs
.
length
);
return
null
;
}
...
...
@@ -311,7 +311,7 @@ public final class Skins {
return
ret
.
getProperty
(
"name"
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Read skin configuration error[msg={0}]"
,
e
.
getMessage
());
LOGGER
.
log
(
Level
.
ERROR
,
"Read skin configuration error[msg={0}]"
,
e
.
getMessage
());
return
null
;
}
...
...
core/src/main/java/org/b3log/solo/util/Statistics.java
View file @
4acc9b1f
...
...
@@ -20,11 +20,11 @@ import java.util.HashMap;
import
java.util.Iterator
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.repository.RepositoryException
;
import
org.b3log.latke.repository.Transaction
;
import
org.b3log.latke.util.Requests
;
...
...
@@ -94,10 +94,10 @@ public final class Statistics {
public
static
void
onlineVisitorCount
(
final
HttpServletRequest
request
)
{
final
String
remoteAddr
=
Requests
.
getRemoteAddr
(
request
);
LOGGER
.
log
(
Level
.
FINER
,
"Current request [IP={0}]"
,
remoteAddr
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Current request [IP={0}]"
,
remoteAddr
);
ONLINE_VISITORS
.
put
(
remoteAddr
,
System
.
currentTimeMillis
());
LOGGER
.
log
(
Level
.
FINER
,
"Current online visitor count [{0}]"
,
ONLINE_VISITORS
.
size
());
LOGGER
.
log
(
Level
.
DEBUG
,
"Current online visitor count [{0}]"
,
ONLINE_VISITORS
.
size
());
}
/**
...
...
@@ -113,11 +113,11 @@ public final class Statistics {
if
(
currentTimeMillis
>
(
onlineVisitor
.
getValue
()
+
ONLINE_VISITOR_EXPIRATION
))
{
iterator
.
remove
();
LOGGER
.
log
(
Level
.
FINEST
,
"Removed online visitor[ip={0}]"
,
onlineVisitor
.
getKey
());
LOGGER
.
log
(
Level
.
TRACE
,
"Removed online visitor[ip={0}]"
,
onlineVisitor
.
getKey
());
}
}
LOGGER
.
log
(
Level
.
FINER
,
"Current online visitor count [{0}]"
,
ONLINE_VISITORS
.
size
());
LOGGER
.
log
(
Level
.
DEBUG
,
"Current online visitor count [{0}]"
,
ONLINE_VISITORS
.
size
());
}
/**
...
...
@@ -257,7 +257,7 @@ public final class Statistics {
return
;
}
LOGGER
.
log
(
Level
.
FINEST
,
"Before inc blog view count[statistic={0}]"
,
statistic
);
LOGGER
.
log
(
Level
.
TRACE
,
"Before inc blog view count[statistic={0}]"
,
statistic
);
int
blogViewCnt
=
statistic
.
getInt
(
Statistic
.
STATISTIC_BLOG_VIEW_COUNT
);
...
...
@@ -276,14 +276,14 @@ public final class Statistics {
transaction
.
rollback
();
}
LOGGER
.
log
(
Level
.
SEVERE
,
"Updates blog view count failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Updates blog view count failed"
,
e
);
}
}
else
{
// Repository cache prefix, Refers to GAERepository#CACHE_KEY_PREFIX
statisticRepository
.
getCache
().
putAsync
(
REPOSITORY_CACHE_KEY_PREFIX
+
Statistic
.
STATISTIC
,
statistic
);
}
LOGGER
.
log
(
Level
.
FINER
,
"Inced blog view count[statistic={0}]"
,
statistic
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Inced blog view count[statistic={0}]"
,
statistic
);
}
/**
...
...
core/src/main/java/org/b3log/solo/util/Tags.java
View file @
4acc9b1f
...
...
@@ -18,7 +18,6 @@ package org.b3log.solo.util;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.logging.Logger
;
import
org.b3log.solo.model.Tag
;
import
org.b3log.solo.repository.TagRepository
;
import
org.b3log.latke.Keys
;
...
...
@@ -36,11 +35,6 @@ import org.json.JSONObject;
*/
public
final
class
Tags
{
/**
* Logger.
*/
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
Tags
.
class
.
getName
());
/**
* Tag repository.
*/
...
...
core/src/main/java/org/b3log/solo/util/Users.java
View file @
4acc9b1f
...
...
@@ -16,11 +16,11 @@
package
org
.
b3log
.
solo
.
util
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.logging.Level
;
import
org.b3log.latke.logging.Logger
;
import
org.b3log.latke.model.Role
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.repository.Query
;
...
...
@@ -85,11 +85,11 @@ public final class Users {
return
1
!=
users
.
length
();
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Determines multiple users failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Determines multiple users failed"
,
e
);
throw
new
ServiceException
(
e
);
}
catch
(
final
JSONException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Determines multiple users failed"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Determines multiple users failed"
,
e
);
throw
new
ServiceException
(
e
);
}
...
...
@@ -178,7 +178,7 @@ public final class Users {
try
{
return
userRepository
.
getByEmail
(
email
);
}
catch
(
final
RepositoryException
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
"Gets current user by request failed, returns null"
,
e
);
LOGGER
.
log
(
Level
.
ERROR
,
"Gets current user by request failed, returns null"
,
e
);
return
null
;
}
...
...
@@ -199,7 +199,7 @@ public final class Users {
return
existEmail
(
email
,
users
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
SEVERE
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
return
false
;
}
}
...
...
pom.xml
View file @
4acc9b1f
<?xml version="1.0" encoding="UTF-8"?>
<!--
Description: B3log Solo parent POM.
Version: 2.0.
2.9, Mar 12
, 2013
Version: 2.0.
3.0, Jun 18
, 2013
Author: Liang Ding
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
...
...
@@ -28,6 +28,7 @@
<!-- Properties -->
<properties>
<servlet.version>
2.5
</servlet.version>
<slf4j.version>
1.7.5
</slf4j.version>
<org.b3log.solo.version>
0.6.0
</org.b3log.solo.version>
<org.b3log.latke.version>
0.5.0-SNAPSHOT
</org.b3log.latke.version>
<org.b3log.latke-gae.version>
0.5.0-SNAPSHOT
</org.b3log.latke-gae.version>
...
...
@@ -208,11 +209,11 @@
<scope>
runtime
</scope>
</dependency>
<
!-- <
dependency>
<groupId>
com.google.api.client
</groupId>
<artifactId>
google-api-client
</artifactId>
<version>${
com.google.api.client
.version}</version>
</dependency>
-->
<dependency>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-log4j12
</artifactId>
<version>
${
slf4j
.version}
</version>
</dependency>
<dependency>
<groupId>
org.freemarker
</groupId>
...
...
war/bae/pom.xml
View file @
4acc9b1f
...
...
@@ -124,7 +124,6 @@
<resources>
<resource>
<directory>
src/main/resources
</directory>
<filtering>
true
</filtering>
</resource>
</resources>
</configuration>
...
...
war/gae/pom.xml
View file @
4acc9b1f
...
...
@@ -75,6 +75,24 @@
<groupId>
org.b3log
</groupId>
<artifactId>
latke-gae
</artifactId>
</dependency>
<dependency>
<groupId>
org.b3log
</groupId>
<artifactId>
solo-core
</artifactId>
<exclusions>
<!-- Logging -->
<exclusion>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-log4j12
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-jdk14
</artifactId>
<version>
${slf4j.version}
</version>
</dependency>
<dependency>
<groupId>
com.google.appengine
</groupId>
...
...
@@ -146,7 +164,10 @@
<resources>
<resource>
<directory>
src/main/resources
</directory>
<filtering>
true
</filtering>
<excludes>
<!-- GAE uses JDK logger -->
<exclude>
log4j.properties
</exclude>
</excludes>
</resource>
</resources>
</configuration>
...
...
war/src/main/resources/logging.properties
→
war/
gae/
src/main/resources/logging.properties
View file @
4acc9b1f
...
...
@@ -15,8 +15,7 @@
#
#
# Description: B3log Solo JDK logging configurations. Add the following to
# appengine-web.xml:
# Description: B3log Solo JDK logging configurations. Add the following to appengine-web.xml:
# <system-properties>
# <property name="java.util.logging.config.file" value="WEB-INF/classes/logging.properties"/>
# </system-properties>
...
...
@@ -25,10 +24,6 @@
#
handlers
=
java.util.logging.ConsoleHandler
# XXX: java.util.logging.ConsoleHandler.encoding=UTF-8
# FIXME: formatter does not work, issue 59
#java.util.logging.ConsoleHandler.formatter=org.b3log.latke.logging.LatkeFormatter
#org.b3log.latke.logging.LatkeFormatter.format=%L: %m [%C.%M]
org.b3log.solo.level
=
INFO
...
...
war/h2/pom.xml
View file @
4acc9b1f
...
...
@@ -105,7 +105,6 @@
<resources>
<resource>
<directory>
src/main/resources
</directory>
<filtering>
true
</filtering>
</resource>
</resources>
</configuration>
...
...
war/mysql/pom.xml
View file @
4acc9b1f
...
...
@@ -100,7 +100,6 @@
<resources>
<resource>
<directory>
src/main/resources
</directory>
<filtering>
true
</filtering>
</resource>
</resources>
</configuration>
...
...
war/src/main/resources/log4j.properties
0 → 100644
View file @
4acc9b1f
#
# Copyright (c) 2009, 2010, 2011, 2012, 2013, B3log Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Description: B3log Solo logging configurations.
# Version: 1.0.0.0, Jun 19, 2013
# Author: Liang Ding
#
log4j.rootLogger
=
INFO, stdout
log4j.appender.stdout
=
org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target
=
System.out
log4j.appender.stdout.layout
=
org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern
=
[%-5p]-[%d{yyyy-MM-dd HH:mm:ss}]-[%c:%L]: %m%n
log4j.logger.org.b3log.solo
=
INFO
log4j.logger.org.b3log.latke
=
TRACE
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment