Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
openSource
apollo
Commits
e0fcbb9f
Commit
e0fcbb9f
authored
Jul 21, 2016
by
张乐
Committed by
GitHub
Jul 21, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #336 from nobodyiam/fix-notification-controller-invalid-format
protect notification controller when the input format is invalid
parents
0447fca3
09889565
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
ReleaseMessageService.java
...p/framework/apollo/biz/service/ReleaseMessageService.java
+8
-0
NotificationControllerV2.java
...lo/configservice/controller/NotificationControllerV2.java
+4
-0
No files found.
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseMessageService.java
View file @
e0fcbb9f
...
@@ -8,8 +8,10 @@ import com.dianping.cat.Cat;
...
@@ -8,8 +8,10 @@ import com.dianping.cat.Cat;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -22,10 +24,16 @@ public class ReleaseMessageService {
...
@@ -22,10 +24,16 @@ public class ReleaseMessageService {
private
ReleaseMessageRepository
releaseMessageRepository
;
private
ReleaseMessageRepository
releaseMessageRepository
;
public
ReleaseMessage
findLatestReleaseMessageForMessages
(
Collection
<
String
>
messages
)
{
public
ReleaseMessage
findLatestReleaseMessageForMessages
(
Collection
<
String
>
messages
)
{
if
(
CollectionUtils
.
isEmpty
(
messages
))
{
return
null
;
}
return
releaseMessageRepository
.
findTopByMessageInOrderByIdDesc
(
messages
);
return
releaseMessageRepository
.
findTopByMessageInOrderByIdDesc
(
messages
);
}
}
public
List
<
ReleaseMessage
>
findLatestReleaseMessagesGroupByMessages
(
Collection
<
String
>
messages
)
{
public
List
<
ReleaseMessage
>
findLatestReleaseMessagesGroupByMessages
(
Collection
<
String
>
messages
)
{
if
(
CollectionUtils
.
isEmpty
(
messages
))
{
return
Collections
.
EMPTY_LIST
;
}
List
<
Object
[]>
result
=
List
<
Object
[]>
result
=
releaseMessageRepository
.
findLatestReleaseMessagesGroupByMessages
(
messages
);
releaseMessageRepository
.
findLatestReleaseMessagesGroupByMessages
(
messages
);
List
<
ReleaseMessage
>
releaseMessages
=
Lists
.
newArrayList
();
List
<
ReleaseMessage
>
releaseMessages
=
Lists
.
newArrayList
();
...
...
apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/controller/NotificationControllerV2.java
View file @
e0fcbb9f
...
@@ -108,6 +108,10 @@ public class NotificationControllerV2 implements ReleaseMessageListener {
...
@@ -108,6 +108,10 @@ public class NotificationControllerV2 implements ReleaseMessageListener {
clientSideNotifications
.
put
(
namespace
,
notification
.
getNotificationId
());
clientSideNotifications
.
put
(
namespace
,
notification
.
getNotificationId
());
}
}
if
(
CollectionUtils
.
isEmpty
(
namespaces
))
{
throw
new
BadRequestException
(
"Invalid format of notifications: "
+
notificationsAsString
);
}
Multimap
<
String
,
String
>
watchedKeysMap
=
Multimap
<
String
,
String
>
watchedKeysMap
=
watchKeysUtil
.
assembleAllWatchKeys
(
appId
,
cluster
,
namespaces
,
dataCenter
);
watchKeysUtil
.
assembleAllWatchKeys
(
appId
,
cluster
,
namespaces
,
dataCenter
);
...
...
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