Skip to content

Commit

Permalink
Replaced an if-statement with a switch statement in `SnmpSession.crea…
Browse files Browse the repository at this point in the history
…tePDU()` method.
  • Loading branch information
dmccoystephenson committed Sep 11, 2023
1 parent c0d985d commit 947e0b5
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,12 @@ public void endSession() throws IOException {
* @throws ParseException
*/
public static ScopedPDU createPDU(SNMP snmp, String payload, int index, RequestVerb verb, SnmpProtocol snmpProtocol) throws ParseException {
if (snmpProtocol == SnmpProtocol.FOURDOT1) {
switch (snmpProtocol) {
case FOURDOT1:
return createPDUWithFourDot1Protocol(snmp, payload, index, verb);
}
else if (snmpProtocol == SnmpProtocol.NTCIP1218) {
case NTCIP1218:
return createPDUWithNTCIP1218Protocol(snmp, payload, index, verb);
}
else {
default:
logger.error("Unknown SNMP protocol: {}", snmpProtocol);
return null;
}
Expand Down

0 comments on commit 947e0b5

Please sign in to comment.