WIFI-1651: Reduce message for invalid secondary DNS address to warning, cleanup copy/paste mistakes for retry w. byte array if string fails for InetAddress

This commit is contained in:
Mike Hansen
2021-02-23 18:37:16 -05:00
parent 15a7741909
commit 23f9da0af0

View File

@@ -2206,15 +2206,11 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
try { try {
clientDhcpDetails.setGatewayIp(InetAddress.getByName(dhcpLeasedIps.get("gateway"))); clientDhcpDetails.setGatewayIp(InetAddress.getByName(dhcpLeasedIps.get("gateway")));
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
LOG.error("Invalid Gateway IP", e);
try { try {
clientDhcpDetails.setGatewayIp(InetAddress.getByAddress(dhcpLeasedIps.get("gateway").getBytes())); clientDhcpDetails.setGatewayIp(InetAddress.getByAddress(dhcpLeasedIps.get("gateway").getBytes()));
} catch (UnknownHostException e1) { } catch (UnknownHostException e1) {
// TODO Auto-generated catch block LOG.warn("Invalid Gateway IP {}", e.getMessage());
LOG.error("Invalid Gateway Address", e);
} }
} }
} }
@@ -2222,13 +2218,11 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
try { try {
clientDhcpDetails.setSubnetMask(InetAddress.getByName(dhcpLeasedIps.get("subnet_mask"))); clientDhcpDetails.setSubnetMask(InetAddress.getByName(dhcpLeasedIps.get("subnet_mask")));
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
LOG.error("Invalid Subnet Mask", e);
try { try {
clientDhcpDetails clientDhcpDetails
.setGatewayIp(InetAddress.getByAddress(dhcpLeasedIps.get("subnet_mask").getBytes())); .setSubnetMask(InetAddress.getByAddress(dhcpLeasedIps.get("subnet_mask").getBytes()));
} catch (UnknownHostException e1) { } catch (UnknownHostException e1) {
// TODO Auto-generated catch block LOG.warn("Invalid Subnet Mask {}", e.getMessage());
LOG.error("Invalid Subnet Mask Address", e);
} }
} }
} }
@@ -2237,15 +2231,12 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
try { try {
clientDhcpDetails.setPrimaryDns(InetAddress.getByName(dhcpLeasedIps.get("primary_dns"))); clientDhcpDetails.setPrimaryDns(InetAddress.getByName(dhcpLeasedIps.get("primary_dns")));
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
LOG.error("Invalid Primary DNS", e);
try { try {
clientDhcpDetails clientDhcpDetails
.setGatewayIp(InetAddress.getByAddress(dhcpLeasedIps.get("primary_dns").getBytes())); .setPrimaryDns(InetAddress.getByAddress(dhcpLeasedIps.get("primary_dns").getBytes()));
} catch (UnknownHostException e1) { } catch (UnknownHostException e1) {
// TODO Auto-generated catch block LOG.warn("Invalid Primary DNS {}", e.getMessage());
LOG.error("Invalid Primary DNS Address", e);
} }
} }
} }
@@ -2253,25 +2244,19 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
try { try {
clientDhcpDetails.setSecondaryDns(InetAddress.getByName(dhcpLeasedIps.get("secondary_dns"))); clientDhcpDetails.setSecondaryDns(InetAddress.getByName(dhcpLeasedIps.get("secondary_dns")));
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
LOG.error("Invalid Secondary DNS", e);
try { try {
clientDhcpDetails clientDhcpDetails
.setGatewayIp(InetAddress.getByAddress(dhcpLeasedIps.get("secondary_dns").getBytes())); .setSecondaryDns(InetAddress.getByAddress(dhcpLeasedIps.get("secondary_dns").getBytes()));
} catch (UnknownHostException e1) { } catch (UnknownHostException e1) {
// TODO Auto-generated catch block LOG.warn("Invalid Secondary DNS {}", e.getMessage());
LOG.error("Invalid Seconary DNS Address", e);
} }
} }
} }
if (dhcpLeasedIps.containsKey("device_name")) { if (dhcpLeasedIps.containsKey("device_name")) {
clientSessionDetails.setClassificationName(dhcpLeasedIps.get("device_name")); clientSessionDetails.setClassificationName(dhcpLeasedIps.get("device_name"));
} }
clientSessionDetails.setDhcpDetails(clientDhcpDetails); clientSessionDetails.setDhcpDetails(clientDhcpDetails);
session.getDetails().mergeSession(clientSessionDetails); session.getDetails().mergeSession(clientSessionDetails);
return session; return session;
} }