Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Network] Present used arping tool to user #4821

Merged
merged 1 commit into from
Feb 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,29 @@ public void setUseArpPing(boolean enable, String arpPingUtilPath, @Nullable Inet
arpPingMethod = ArpPingUtilEnum.UNKNOWN_TOOL;
return;
} else if (destinationAddress == null || !(destinationAddress instanceof Inet4Address)) {
arpPingState = "Destination is not IPv4";
arpPingState = "Destination is not a valid IPv4 address";
arpPingMethod = ArpPingUtilEnum.UNKNOWN_TOOL;
return;
}
arpPingMethod = networkUtils.determineNativeARPpingMethod(arpPingUtilPath);
switch (arpPingMethod) {
case UNKNOWN_TOOL: {
arpPingState = "Unknown arping tool";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also store these strings in the enum, then they are closer together, or maybe using a map. This could also work but imho the other options are a little bit more elegant.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might want to apply I18n at some point and thus not hardcoding the strings into the Enum. I do not expect that enum to change a lot, and if it falls through, there is just no name exposed to the user.

break;
}
case THOMAS_HABERT_ARPING: {
arpPingState = "Arping tool by Thomas Habets";
break;
}
case THOMAS_HABERT_ARPING_WITHOUT_TIMEOUT: {
arpPingState = "Arping tool by Thomas Habets (old version)";
break;
}
case IPUTILS_ARPING: {
arpPingState = "Ipuitls Arping";
break;
}
}
}

/**
Expand Down