Lehel44 commented on a change in pull request #5088:
URL: https://github.com/apache/nifi/pull/5088#discussion_r668294268
##########
File path:
nifi-nar-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/factory/AbstractSNMPFactory.java
##########
@@ -35,22 +35,24 @@
public abstract class AbstractSNMPFactory {
private static final Logger logger =
LoggerFactory.getLogger(AbstractSNMPFactory.class);
+ private static final String LOCALHOST = "127.0.0.1";
protected AbstractSNMPFactory() {
// hide implicit constructor
}
- protected static Snmp createSnmpClient() {
- final Snmp snmp;
+ protected static Snmp createSimpleSnmpManager(SNMPConfiguration
configuration) {
+ final String managerAddress = LOCALHOST + "/" +
configuration.getManagerPort();
+ final Snmp snmpManager;
try {
- snmp = new Snmp(new DefaultUdpTransportMapping());
- snmp.listen();
- return snmp;
+ snmpManager = new Snmp(new DefaultUdpTransportMapping(new
UdpAddress(managerAddress)));
+ snmpManager.listen();
} catch (IOException e) {
- final String errorMessage = "Creating SNMP client failed.";
+ final String errorMessage = "Creating SNMP manager failed.";
logger.error(errorMessage, e);
throw new CreateSNMPClientException(errorMessage);
Review comment:
I removed the logging part from here as I rethrow the exception. It will
be caught and logged on a higher level.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]