Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 57086 invoked from network); 13 Jan 2011 08:13:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Jan 2011 08:13:33 -0000 Received: (qmail 19243 invoked by uid 500); 13 Jan 2011 08:13:33 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 18944 invoked by uid 500); 13 Jan 2011 08:13:30 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 18935 invoked by uid 99); 13 Jan 2011 08:13:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Jan 2011 08:13:29 +0000 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of claus.ibsen@gmail.com designates 209.85.216.173 as permitted sender) Received: from [209.85.216.173] (HELO mail-qy0-f173.google.com) (209.85.216.173) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Jan 2011 08:13:23 +0000 Received: by qyl38 with SMTP id 38so2452183qyl.11 for ; Thu, 13 Jan 2011 00:13:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=AoYDutd0n3A/dcr7AcxaaHpIEES1L6+0ETCPxX5pOMc=; b=w0dU1G/gIExWvk87Zj7guEmSZAaLjCwY85j/s8YLugdO52w/XSOsGOugq5GU+buZKf k5EjSE0LRL3r8ZfDxajStlMYYPo92nrcBW/FFngjZxgsnzqxYMF0aZsmIwFkfrkH62p+ QxgTD8kz0zxsuY1A9vDU6DXs+vpkae2bgghdQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=CEB3wvNyGDt9OD1oHgPQTPYzMv6GDoW9Fh8lyzns10RrCpn7oMF3Lbgo/qK/9+5XX+ 97u3ptYZWL17UbycPONMeUfai9wJKrof+KgRZeLRpjgdxmDJB7hSJV8kSPC2w8gZORCd 0SQzrfz3/jGMTVdbfElGq+zBMr71Uhr9b8wnk= Received: by 10.229.99.143 with SMTP id u15mr1701789qcn.206.1294906381329; Thu, 13 Jan 2011 00:13:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.68.104 with HTTP; Thu, 13 Jan 2011 00:12:41 -0800 (PST) In-Reply-To: <1294905030586-3339373.post@n5.nabble.com> References: <1294905030586-3339373.post@n5.nabble.com> From: Claus Ibsen Date: Thu, 13 Jan 2011 09:12:41 +0100 Message-ID: Subject: Re: camel-snmp-2.5 problems To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org 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 thes= e > are not bugs, > how do I avoid them. > > *case1 > =A0When application calles doStop() method in SNMP component more than tw= ice, > I got NullPointerException. > > *case2 > =A0I can not set protocol=3Dtcp in SNMP component. > > *path > =A0I applied the patch for org.apache.camel.component.snmp.SnmpOIDPoller = class > > --- org/SnmpOIDPoller.java =A0 =A0 =A02010-10-25 16:30:46.000000000 +0900 > +++ new/SnmpOIDPoller.java =A0 =A0 =A02011-01-13 15:39:47.872629200 +0900 > @@ -36,6 +36,7 @@ > =A0import org.snmp4j.smi.OID; > =A0import org.snmp4j.smi.OctetString; > =A0import org.snmp4j.smi.VariableBinding; > +import org.snmp4j.transport.DefaultTcpTransportMapping; > =A0import org.snmp4j.transport.DefaultUdpTransportMapping; > > =A0public class SnmpOIDPoller extends ScheduledPollConsumer implements > ResponseListener { > @@ -63,7 +64,11 @@ > > =A0 =A0 =A0 =A0 LOG.debug("Activating oid poller"); > =A0 =A0 =A0 =A0 this.targetAddress =3D > GenericAddress.parse(this.endpoint.getAddress()); > - =A0 =A0 =A0 =A0this.transport =3D new DefaultUdpTransportMapping(); > + =A0 =A0 =A0 =A0if (this.endpoint.getProtocol().equalsIgnoreCase("tcp"))= {//tcp > option > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 this.transport =3D new DefaultTcpTransportM= apping(); > + =A0 =A0 =A0 =A0} else { =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0//simply > consider udp > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 this.transport =3D new DefaultUdpTransportM= apping(); > + =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0 this.snmp =3D new Snmp(this.transport); > =A0 =A0 =A0 =A0 this.usm =3D new USM(SecurityProtocols.getInstance(), new > OctetString(MPv3.createLocalEngineID()), 0); > =A0 =A0 =A0 =A0 SecurityModels.getInstance().addSecurityModel(usm); > @@ -85,9 +90,11 @@ > =A0 =A0 @Override > =A0 =A0 protected void doStop() throws Exception { > =A0 =A0 =A0 =A0 // stop listening to the transport > - =A0 =A0 =A0 =A0if (this.transport.isListening()) { > - =A0 =A0 =A0 =A0 =A0 =A0this.transport.close(); > - =A0 =A0 =A0 =A0} > + =A0 =A0 =A0 if (this.transport !=3D null) { =A0 =A0 =A0 =A0 =A0 //suppr= ess > NullPointerException when doStop called more than twice > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (this.transport.isListening()) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 this.transport.close(); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > > =A0 =A0 =A0 =A0 super.doStop(); > =A0 =A0 } > > -- > View this message in context: http://camel.465427.n5.nabble.com/camel-snm= p-2-5-problems-tp3339373p3339373.html > Sent from the Camel - Users mailing list archive at Nabble.com. > --=20 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/