Skip to content

Commit

Permalink
Update ServiceController.java (#3176)
Browse files Browse the repository at this point in the history
adjust order for start and end ,avoid end value is negative number
  • Loading branch information
jiangcaijun authored Jun 28, 2020
1 parent 49c163b commit 41525b0
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,11 @@ public ObjectNode list(HttpServletRequest request) throws Exception {
}

int start = (pageNo - 1) * pageSize;
int end = start + pageSize;

if (start < 0) {
start = 0;
}

int end = start + pageSize;
if (end > serviceNameList.size()) {
end = serviceNameList.size();
}
Expand Down Expand Up @@ -456,14 +455,12 @@ public ObjectNode subscribers(HttpServletRequest request) {
List<Subscriber> subscribers = subscribeManager.getSubscribers(serviceName, namespaceId, aggregation);

int start = (pageNo - 1) * pageSize;
int end = start + pageSize;

int count = subscribers.size();

if (start < 0) {
start = 0;
}

int end = start + pageSize;
int count = subscribers.size();
if (end > count) {
end = count;
}
Expand Down

0 comments on commit 41525b0

Please sign in to comment.