Skip to content

Commit

Permalink
adapt to #3924
Browse files Browse the repository at this point in the history
Signed-off-by: Holger Friedrich <[email protected]>
  • Loading branch information
holgerfriedrich committed Dec 16, 2023
1 parent 6e4f471 commit ded7540
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,33 +121,35 @@ void scan() {

logger.trace("Checking candidate: {}", candidate.getUID());

Map<String, String> parameters = method.getParameters().stream()
.collect(Collectors.toMap(property -> property.getName(), property -> property.getValue()));
Map<String, String> matchProperties = method.getMatchProperties().stream()
.collect(Collectors.toMap(property -> property.getName(), property -> property.getRegex()));

// parse standard set op parameters:
String type = Objects.toString(matchProperties.get("type"), "");
String request = Objects.toString(matchProperties.get("request"), "");
String type = Objects.toString(parameters.get("type"), "");
String request = Objects.toString(parameters.get("request"), "");
String response = Objects.toString(matchProperties.get("response"), "");
int timeoutMs = 0;
try {
timeoutMs = Integer.parseInt(Objects.toString(matchProperties.get("timeout_ms")));
timeoutMs = Integer.parseInt(Objects.toString(parameters.get("timeout_ms")));
} catch (NumberFormatException e) {
logger.info("{}: match-property timeout_ms cannot be parsed", candidate.getUID());
logger.info("{}: discovery-parameter timeout_ms cannot be parsed", candidate.getUID());
continue;
}
@Nullable
InetAddress destIp = null;
try {
destIp = InetAddress.getByName(matchProperties.get("dest_ip"));
destIp = InetAddress.getByName(parameters.get("dest_ip"));
} catch (UnknownHostException e) {
logger.info("{}: match-property dest_ip cannot be parsed", candidate.getUID());
logger.info("{}: discovery-parameter dest_ip cannot be parsed", candidate.getUID());
continue;
}
int destPort = 0;
try {
destPort = Integer.parseInt(Objects.toString(matchProperties.get("dest_port")));
destPort = Integer.parseInt(Objects.toString(parameters.get("dest_port")));
} catch (NumberFormatException e) {
logger.info("{}: match-property dest_port cannot be parsed", candidate.getUID());
logger.info("{}: discovery-parameter dest_port cannot be parsed", candidate.getUID());
continue;
}

Expand Down Expand Up @@ -185,7 +187,7 @@ void scan() {
Iterator<SelectionKey> it = selector.selectedKeys().iterator();

switch (Objects.toString(response)) {
case "any":
case ".*":
if (it.hasNext()) {
final SocketAddress source = ((DatagramChannel) it.next().channel())
.receive(buffer);
Expand Down

0 comments on commit ded7540

Please sign in to comment.