Update ServiceController.java (#3176)
adjust order for start and end ,avoid end value is negative number
This commit is contained in:
parent
49c163b266
commit
41525b0a5c
@ -247,12 +247,11 @@ public class ServiceController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int start = (pageNo - 1) * pageSize;
|
int start = (pageNo - 1) * pageSize;
|
||||||
int end = start + pageSize;
|
|
||||||
|
|
||||||
if (start < 0) {
|
if (start < 0) {
|
||||||
start = 0;
|
start = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int end = start + pageSize;
|
||||||
if (end > serviceNameList.size()) {
|
if (end > serviceNameList.size()) {
|
||||||
end = serviceNameList.size();
|
end = serviceNameList.size();
|
||||||
}
|
}
|
||||||
@ -456,14 +455,12 @@ public class ServiceController {
|
|||||||
List<Subscriber> subscribers = subscribeManager.getSubscribers(serviceName, namespaceId, aggregation);
|
List<Subscriber> subscribers = subscribeManager.getSubscribers(serviceName, namespaceId, aggregation);
|
||||||
|
|
||||||
int start = (pageNo - 1) * pageSize;
|
int start = (pageNo - 1) * pageSize;
|
||||||
int end = start + pageSize;
|
|
||||||
|
|
||||||
int count = subscribers.size();
|
|
||||||
|
|
||||||
if (start < 0) {
|
if (start < 0) {
|
||||||
start = 0;
|
start = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int end = start + pageSize;
|
||||||
|
int count = subscribers.size();
|
||||||
if (end > count) {
|
if (end > count) {
|
||||||
end = count;
|
end = count;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user