Skip to content

Commit

Permalink
CamlCase
Browse files Browse the repository at this point in the history
Signed-off-by: Holger Friedrich <[email protected]>
  • Loading branch information
holgerfriedrich committed Dec 17, 2023
1 parent e4b5a9b commit a1b2269
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@ public class IpAddonFinder extends BaseAddonFinder {
public static final String SERVICE_TYPE = SERVICE_TYPE_IP;
public static final String SERVICE_NAME = SERVICE_NAME_IP;

private static final String TYPE_IP_MULTICAST = "ip_multicast";
private static final String MATCH_PROPERTY_RESPONSE = "response";
private static final String PARAMETER_DEST_IP = "dest_ip";
private static final String PARAMETER_DEST_PORT = "dest_port";
private static final String PARAMETER_REQUEST = "request";
private static final String PARAMETER_TIMEOUT_MS = "timeout_ms";
private static final String TYPE_IP_MULTICAST = "IpMulticast";
private static final String MATCH_PROPERTY_RESPONSE = "Response";
private static final String PARAMETER_DEST_IP = "DestIp";
private static final String PARAMETER_DEST_PORT = "DestPort";
private static final String PARAMETER_REQUEST = "Request";
private static final String PARAMETER_SRC_IP = "SrcIp";
private static final String PARAMETER_SRC_PORT = "SrcPort";
private static final String PARAMETER_TIMEOUT_MS = "TimeoutMs";

private final Logger logger = LoggerFactory.getLogger(IpAddonFinder.class);
private final ScheduledExecutorService scheduler = ThreadPoolManager.getScheduledPool(SERVICE_NAME);
Expand Down Expand Up @@ -142,22 +144,22 @@ void scan() {
try {
timeoutMs = Integer.parseInt(Objects.toString(parameters.get(PARAMETER_TIMEOUT_MS)));
} catch (NumberFormatException e) {
logger.info("{}: discovery-parameter timeout_ms cannot be parsed", candidate.getUID());
logger.info("{}: discovery-parameter " + PARAMETER_TIMEOUT_MS + "cannot be parsed", candidate.getUID());
continue;
}
@Nullable
InetAddress destIp = null;
try {
destIp = InetAddress.getByName(parameters.get(PARAMETER_DEST_IP));
} catch (UnknownHostException e) {
logger.info("{}: discovery-parameter dest_ip cannot be parsed", candidate.getUID());
logger.info("{}: discovery-parameter " + PARAMETER_DEST_IP + " cannot be parsed", candidate.getUID());
continue;
}
int destPort = 0;
try {
destPort = Integer.parseInt(Objects.toString(parameters.get(PARAMETER_DEST_PORT)));
} catch (NumberFormatException e) {
logger.info("{}: discovery-parameter dest_port cannot be parsed", candidate.getUID());
logger.info("{}: discovery-parameter " + PARAMETER_DEST_PORT + " cannot be parsed", candidate.getUID());
continue;
}

Expand Down Expand Up @@ -240,11 +242,11 @@ byte[] buildRequestArray(DatagramChannel channel, String request) throws java.io
String token = parts.nextToken();
if (token.startsWith("$")) {
switch (token) {
case "$src_ip":
case "$" + PARAMETER_SRC_IP:
byte[] adr = sock.getAddress().getAddress();
requestFrame.write(adr);
break;
case "$src_port":
case "$" + PARAMETER_SRC_PORT:
int dPort = sock.getPort();
requestFrame.write((byte) ((dPort >> 8) & 0xff));
requestFrame.write((byte) (dPort & 0xff));
Expand Down

0 comments on commit a1b2269

Please sign in to comment.