[SNMP4J] There seems a logic fault in MessageDispatcherImpl class

Yaomin Yang yaomin at exavio.com.cn
Sat Jan 15 11:01:50 CET 2005


Hi, Frank
    Pls see the comments in below lines.
    

    /**
   * Adds a message processing model to this message dispatcher. If a message
   * processing model with the same ID as the supplied one already exists it
   * will not be changed. Please call {@link #removeMessageProcessingModel}
        [Yaomin] the constraints disagrees with the below logic 
   * before to replace a message processing model.
   * @param model
   *    a MessageProcessingModel instance.
   */
  public synchronized void addMessageProcessingModel(MessageProcessingModel model) {
    while (mpm.size() <= model.getID()) {
      mpm.add(null);
    }
    if (mpm.get(model.getID()) != null) {
              [Yaomin] I think it should be "mpm.get(model.getID()) == null" because no model can be added according to the logic, but I am bewildered that why the tool you brought can run without exceptions.
      mpm.set(model.getID(), model);
    }
  }

    Thanks,
    Yaomin


More information about the SNMP4J mailing list