[SNMP4J] possible bug in org.snmp4j.agent.mo.snmp.NotificationOriginatorImpl

Yuan Ding yding at goldengate.com
Fri Apr 27 22:23:35 CEST 2007


Hi, 

 

I don't know if anyone encounter this before.

 

It looks like a bug in this class's notify method.

 

Here is the scenario:

 

Add two notification entries to notificationMIB in the agent.

Then send one notification with notificationID (OID) and set all
variable bindings. 

 

The result is: two identical notifications are sent.

 

I have a temporary fix: while adding notification entry, I use
notificationID as name. Within NotificationOriginatorImpl's notify
method, since there are several private members, I have to clone the
impl class and change "notify" method the following way:

 

  public Object notify(OctetString context, OID notificationID,

                       TimeTicks sysUpTime, VariableBinding[] vbs) {

    if (logger.isInfoEnabled()) {

      logger.info("Notification " + notificationID + " issued with " +

                  Arrays.asList(vbs));

    }

    List responses = new LinkedList();

    for (Iterator it =
notificationMIB.getNotifyTable().getModel().iterator();

         it.hasNext(); ) {

      MOTableRow notifyRow = (MOTableRow) it.next();

      

      //==================Start local fix=======================

      // fetch name as OID

      OctetString name = new OctetString();

      name.fromSubIndex(notifyRow.getIndex(), true);

      String notificationIDStr = notificationID.toString();

      if (!notificationIDStr.equals(name.toString())) {

        continue; // skip those notification that does not match
notificationID

      }

      //==================End local fix========================

... (the rest of the code)

 

Let me know if this is truly a bug or the way I am using it is wrong. If
it's a bug let me know if the fix make sense. 

Thanks

yuan



This e-mail message and any attachments may contain private, confidential, proprietary or privileged material of GoldenGate Software, Inc. that is for the sole use of the intended recipient(s) of this e-mail message.  Any review, copying or distribution or other use of this e-mail message or any attachments hereto by anyone other than the intended recipient(s) is strictly prohibited.  If you are not the intended recipient(s) of this e-mail message, please contact GoldenGate Software, Inc. (415-777-0200) immediately and permanently delete the original e-mail message and any copies of this e-mail message and all attachments, if any.


More information about the SNMP4J mailing list