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 subnet = ip.substring(0, i).trim();
String addrSeg = ip.substring(i + 1).trim(); String addrSeg = ip.substring(i + 1).trim();
if ("*".equals(addrSeg)) { 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) { } else if (addrSeg.indexOf('-') > 0) {
String[] a = StringUtils.split(addrSeg, '-'); String[] a = StringUtils.split(addrSeg, '-');
String beg = a[0].trim(); String beg = a[0].trim();
String end = a[1].trim(); String end = a[1].trim();
List<String[]> lst = this.ips.get(subnet); List<String[]> lst = this.ips.computeIfAbsent(subnet, k -> new ArrayList<>());
if (lst == null) {
lst = new ArrayList<>();
this.ips.put(subnet, lst);
}
lst.add(new String[]{beg, end}); lst.add(new String[]{beg, end});
} else { } else {
this.ips.put(ip, null); this.ips.put(ip, null);

View File

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