Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
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-1
Commits
6afd79f5
Unverified
Commit
6afd79f5
authored
May 18, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
细化异常处理
parent
793e6cad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
src/main/java/org/b3log/solo/processor/console/ArticleConsole.java
...java/org/b3log/solo/processor/console/ArticleConsole.java
+4
-8
src/main/java/org/b3log/solo/service/ArticleQueryService.java
...main/java/org/b3log/solo/service/ArticleQueryService.java
+10
-6
No files found.
src/main/java/org/b3log/solo/processor/console/ArticleConsole.java
View file @
6afd79f5
...
...
@@ -49,7 +49,7 @@ import java.util.stream.Collectors;
* Article console request processing.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.2.0.
1, Mar 29
, 2019
* @version 1.2.0.
2, May 18
, 2019
* @since 0.4.0
*/
@Singleton
...
...
@@ -498,12 +498,10 @@ public class ArticleConsole {
ret
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"updateSuccLabel"
));
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
}
catch
(
final
ServiceException
e
)
{
final
JSONObject
jsonObject
=
new
JSONObject
().
put
(
Keys
.
STATUS_CODE
,
false
);
renderer
.
setJSONObject
(
jsonObject
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"updateFailLabel"
));
jsonObject
.
put
(
Keys
.
MSG
,
e
.
getMessage
(
));
}
}
...
...
@@ -560,11 +558,9 @@ public class ArticleConsole {
renderer
.
setJSONObject
(
ret
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
());
final
JSONObject
jsonObject
=
new
JSONObject
().
put
(
Keys
.
STATUS_CODE
,
false
);
renderer
.
setJSONObject
(
jsonObject
);
jsonObject
.
put
(
Keys
.
MSG
,
langPropsService
.
get
(
"updateFailLabel"
));
jsonObject
.
put
(
Keys
.
MSG
,
e
.
getMessage
(
));
}
}
}
src/main/java/org/b3log/solo/service/ArticleQueryService.java
View file @
6afd79f5
...
...
@@ -51,7 +51,7 @@ import java.util.*;
* @author <a href="https://hacpai.com/member/armstrong">ArmstrongCN</a>
* @author <a href="http://zephyr.b3log.org">Zephyr</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.3.2.1
3, Apr 24
, 2019
* @version 1.3.2.1
4, May 18
, 2019
* @since 0.3.5
*/
@Service
...
...
@@ -252,9 +252,9 @@ public class ArticleQueryService {
* @param articleId the given article id
* @param user the specified user
* @return {@code true} if the current user can access the article, {@code false} otherwise
* @throws
Exception
exception
* @throws
ServiceException service
exception
*/
public
boolean
canAccessArticle
(
final
String
articleId
,
final
JSONObject
user
)
throws
Exception
{
public
boolean
canAccessArticle
(
final
String
articleId
,
final
JSONObject
user
)
throws
Service
Exception
{
if
(
StringUtils
.
isBlank
(
articleId
))
{
return
false
;
}
...
...
@@ -267,10 +267,14 @@ public class ArticleQueryService {
return
true
;
}
final
JSONObject
article
=
articleRepository
.
get
(
articleId
);
final
String
currentUserId
=
user
.
getString
(
Keys
.
OBJECT_ID
);
try
{
final
JSONObject
article
=
articleRepository
.
get
(
articleId
);
final
String
currentUserId
=
user
.
getString
(
Keys
.
OBJECT_ID
);
return
article
.
getString
(
Article
.
ARTICLE_AUTHOR_ID
).
equals
(
currentUserId
);
return
article
.
getString
(
Article
.
ARTICLE_AUTHOR_ID
).
equals
(
currentUserId
);
}
catch
(
final
Exception
e
)
{
throw
new
ServiceException
(
e
);
}
}
/**
...
...
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