CAMEL-10319, SNMP Producer
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/83d6e4f9 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/83d6e4f9 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/83d6e4f9 Branch: refs/heads/master Commit: 83d6e4f9b2c1d98b58a3732f6d5d482bb2679167 Parents: 64441b9 Author: Fabrizio Spataro <fabrizio.spat...@bizmate.it> Authored: Wed Sep 14 17:37:22 2016 +0200 Committer: Andrea Cosentino <anco...@gmail.com> Committed: Thu Sep 15 10:52:13 2016 +0200 ---------------------------------------------------------------------- .../org/apache/camel/component/snmp/SnmpProducer.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/83d6e4f9/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpProducer.java b/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpProducer.java index 1db6696..43cfe0c 100644 --- a/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpProducer.java +++ b/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpProducer.java @@ -57,16 +57,12 @@ public class SnmpProducer extends DefaultProducer { public void process(final Exchange exchange) throws Exception { // load connection data only if the endpoint is enabled Snmp snmp = null; - USM usm; TransportMapping<? extends Address> transport = null; - CommunityTarget target = null; - PDU pdu = null; - Address targetAddress = null; try { LOG.debug("Starting SNMP producer on {}", endpoint.getAddress()); - targetAddress = GenericAddress.parse(endpoint.getAddress()); + Address targetAddress = GenericAddress.parse(endpoint.getAddress()); LOG.debug("targetAddress: " + targetAddress); @@ -80,19 +76,19 @@ public class SnmpProducer extends DefaultProducer { } snmp = new Snmp(transport); - usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0); + USM usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0); SecurityModels.getInstance().addSecurityModel(usm); // setting up target - target = new CommunityTarget(); + CommunityTarget target = new CommunityTarget(); target.setCommunity(new OctetString(endpoint.getSnmpCommunity())); target.setAddress(targetAddress); target.setRetries(this.endpoint.getRetries()); target.setTimeout(this.endpoint.getTimeout()); target.setVersion(this.endpoint.getSnmpVersion()); - pdu = new PDU(); + PDU pdu = new PDU(); for (OID oid : endpoint.getOids()) { pdu.add(new VariableBinding(oid)); }