camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: camel-snmp-2.5 problems
Date Thu, 13 Jan 2011 08:21:01 GMT
Hi

Can you try with latest source code from trunk. The issue should have
been fixed.


On Thu, Jan 13, 2011 at 9:12 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> Hi
>
> Thats seems like a bug. I have created a ticket and will patch the source
> https://issues.apache.org/jira/browse/CAMEL-3537
>
> Thanks for reporting.
>
>
> On Thu, Jan 13, 2011 at 8:50 AM, aliablue <96259d@gmail.com> wrote:
>>
>> Hi all,
>>
>> I'm using Camel2.5 SNMP component and encountered some problems.
>> I checked source code, made a patch (shown below) and it woked fine in my
>> environment.
>>
>> I would like to confirm whether belows cases are bugs or not, and if these
>> are not bugs,
>> how do I avoid them.
>>
>> *case1
>>  When application calles doStop() method in SNMP component more than twice,
>> I got NullPointerException.
>>
>> *case2
>>  I can not set protocol=tcp in SNMP component.
>>
>> *path
>>  I applied the patch for org.apache.camel.component.snmp.SnmpOIDPoller class
>>
>> --- org/SnmpOIDPoller.java      2010-10-25 16:30:46.000000000 +0900
>> +++ new/SnmpOIDPoller.java      2011-01-13 15:39:47.872629200 +0900
>> @@ -36,6 +36,7 @@
>>  import org.snmp4j.smi.OID;
>>  import org.snmp4j.smi.OctetString;
>>  import org.snmp4j.smi.VariableBinding;
>> +import org.snmp4j.transport.DefaultTcpTransportMapping;
>>  import org.snmp4j.transport.DefaultUdpTransportMapping;
>>
>>  public class SnmpOIDPoller extends ScheduledPollConsumer implements
>> ResponseListener {
>> @@ -63,7 +64,11 @@
>>
>>         LOG.debug("Activating oid poller");
>>         this.targetAddress =
>> GenericAddress.parse(this.endpoint.getAddress());
>> -        this.transport = new DefaultUdpTransportMapping();
>> +        if (this.endpoint.getProtocol().equalsIgnoreCase("tcp")) {//tcp
>> option
>> +               this.transport = new DefaultTcpTransportMapping();
>> +        } else {                                        
         //simply
>> consider udp
>> +               this.transport = new DefaultUdpTransportMapping();
>> +        }
>>         this.snmp = new Snmp(this.transport);
>>         this.usm = new USM(SecurityProtocols.getInstance(), new
>> OctetString(MPv3.createLocalEngineID()), 0);
>>         SecurityModels.getInstance().addSecurityModel(usm);
>> @@ -85,9 +90,11 @@
>>     @Override
>>     protected void doStop() throws Exception {
>>         // stop listening to the transport
>> -        if (this.transport.isListening()) {
>> -            this.transport.close();
>> -        }
>> +       if (this.transport != null) {           //suppress
>> NullPointerException when doStop called more than twice
>> +               if (this.transport.isListening()) {
>> +                   this.transport.close();
>> +               }
>> +       }
>>
>>         super.doStop();
>>     }
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/camel-snmp-2-5-problems-tp3339373p3339373.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message