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/0ed2840d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0ed2840d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0ed2840d

Branch: refs/heads/master
Commit: 0ed2840d41681ec6c35608bd4af99bc6a21af37b
Parents: b7b6ff2
Author: Fabryprog <fabryp...@gmail.com>
Authored: Wed Sep 14 19:47:05 2016 +0200
Committer: Andrea Cosentino <anco...@gmail.com>
Committed: Thu Sep 15 10:52:13 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/component/snmp/SnmpProducer.java  | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/0ed2840d/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 0da0b00..9f69ff9 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
@@ -33,6 +33,7 @@ import org.snmp4j.security.SecurityProtocols;
 import org.snmp4j.security.USM;
 import org.snmp4j.smi.Address;
 import org.snmp4j.smi.GenericAddress;
+import org.snmp4j.smi.Integer32;
 import org.snmp4j.smi.OID;
 import org.snmp4j.smi.OctetString;
 import org.snmp4j.smi.VariableBinding;
@@ -73,8 +74,12 @@ public class SnmpProducer extends DefaultProducer {
     public void stop() throws Exception {
         super.stop();
 
-        this.targetAddress = null;
-        this.usm = null;
+        try {
+            SecurityModels.getInstance().removeSecurityModel(new 
Integer32(this.usm.getID()));
+        } finally {
+            this.targetAddress = null;
+            this.usm = null;
+        }
     }
     
     @Override

Reply via email to