Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-7736

bug in EventBuilder method setParam()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 15.0.2
    • Fix Version/s: 17.0.0
    • Component/s: Testing / JUnit
    • Security Level: Default (Default Security Scheme)
    • Labels:
      None

      Description

      I'm creating some Drools rules for some extended event translation. For that reason I wanted to use the EventBuilder class to set some existing event parameters of an event to a new value. I tried to use the setParam() method of EventBuilder and saw, that an existing event parameter did not get a new value, instead, a new event parameter with the same name was added.

      After a look into the source code:

      public EventBuilder setParam(final String parmName, final String val) {
              if (m_event.getParmCollection().size() < 1) {
                  return addParam(parmName, val);
              }
      
              for(final Parm parm : m_event.getParmCollection()) {
                  if (parm.getParmName().equals(val)) {
                  	final Value value = new Value();
                      value.setContent(val);
                      parm.setValue(value);
                      return this;
                  }
       }
      

      I think, the condition in the second if() sould be

      parm.getParmName().equals(parmName)

        Attachments

          Activity

            People

            • Assignee:
              seth Seth Leger
              Reporter:
              michael_nt Michael Batz
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: