Fix ip validation problem in app

This commit is contained in:
hongqiaowei
2022-10-27 09:55:02 +08:00
parent 255ea57877
commit 4769992918
2 changed files with 10 additions and 10 deletions

View File

@@ -84,16 +84,14 @@ public class App {
String subnet = ip.substring(0, i).trim();
String addrSeg = ip.substring(i + 1).trim();
if ("*".equals(addrSeg)) {
this.ips.put(subnet, Collections.singletonList(new String[]{"1", "255"}));
// this.ips.put(subnet, Collections.singletonList(new String[]{"1", "255"}));
List<String[]> segs = this.ips.computeIfAbsent(subnet, k -> new ArrayList<>());
segs.add(new String[]{"1", "255"});
} else if (addrSeg.indexOf('-') > 0) {
String[] a = StringUtils.split(addrSeg, '-');
String beg = a[0].trim();
String end = a[1].trim();
List<String[]> lst = this.ips.get(subnet);
if (lst == null) {
lst = new ArrayList<>();
this.ips.put(subnet, lst);
}
List<String[]> lst = this.ips.computeIfAbsent(subnet, k -> new ArrayList<>());
lst.add(new String[]{beg, end});
} else {
this.ips.put(ip, null);

View File

@@ -90,9 +90,10 @@ public class AppService {
updateAppMap(app, appMapTmp);
return Flux.just(e);
} catch (Throwable t) {
throwable[0] = t;
log.info(json, t);
return Flux.error(t);
// throwable[0] = t;
log.warn(json, t);
// return Flux.error(t);
return Flux.just(e);
}
}).blockLast())).flatMap(
e -> {
@@ -107,7 +108,8 @@ public class AppService {
}
).block();
if (error != ReactorUtils.EMPTY_THROWABLE) {
throw error;
// throw error;
log.error(Consts.S.EMPTY, error);
}
appMap = appMapTmp;