Update ServiceController.java (#3176)

adjust order for start and end ,avoid end value is negative number
This commit is contained in:
Joe 2020-06-28 09:21:28 +08:00 committed by GitHub
parent 49c163b266
commit 41525b0a5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -247,12 +247,11 @@ public class ServiceController {
}
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();
}
@ -456,14 +455,12 @@ public class ServiceController {
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;
}