|
@@ -65,14 +65,19 @@ public class ApiStatusEndpoint {
|
|
public int compare(ApiStatusInfo o1, ApiStatusInfo o2) {
|
|
public int compare(ApiStatusInfo o1, ApiStatusInfo o2) {
|
|
|
|
|
|
try {
|
|
try {
|
|
- Field field = o1.getClass().getField(order);
|
|
|
|
|
|
+ Field field = o1.getClass().getDeclaredField(order);
|
|
|
|
+ field.setAccessible(true);
|
|
Object value1 = field.get(o1);
|
|
Object value1 = field.get(o1);
|
|
Object value2 = field.get(o2);
|
|
Object value2 = field.get(o2);
|
|
|
|
|
|
- if (value1 instanceof Long) {
|
|
|
|
- return (int) (((Long) value1) - ((Long) value2));
|
|
|
|
|
|
+ if (null == value1) {
|
|
|
|
+ return -1;
|
|
|
|
+ } else if (null == value2) {
|
|
|
|
+ return 1;
|
|
|
|
+ } else if (value1 instanceof Long) {
|
|
|
|
+ return (int) (((Long) value2) - ((Long) value1));
|
|
} else if (value1 instanceof Double) {
|
|
} else if (value1 instanceof Double) {
|
|
- return (int) (((Double) value1) - ((Double) value2));
|
|
|
|
|
|
+ return (int) (((Double) value2) - ((Double) value1));
|
|
} else if (value1 instanceof String) {
|
|
} else if (value1 instanceof String) {
|
|
return ((String) value1).compareToIgnoreCase((String) value2);
|
|
return ((String) value1).compareToIgnoreCase((String) value2);
|
|
} else {
|
|
} else {
|