Uploaded image for project: 'netvirt'
  1. netvirt
  2. NETVIRT-1028

Fix unrelated types for equals in HwvtepPhysicalSwitchListener

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • Magnesium
    • Oxygen, Fluorine
    • None
    • None

      Findbugs reports a "Call to equals() comparing different types" violation in HwvtepPhysicalSwitchListener for:

        Objects.equals(l2GwDevice.getHwvtepNodeId(), globalIid)
      

      because the first parameter is a String and the second an InstanceIdentifier. The call will always return false. This occurs in 2 places. The calls were commented out by https://git.opendaylight.org/gerrit/#/c/65520/ to avoid the FB violation.

      Another part of the class does this:

        Objects.equals(l2GatewayDevice.getHwvtepNodeId(),
                                  globalIid.firstKeyOf(Node.class).getNodeId().getValue())
      

      and it seems the 2 violators should do the same. This should be analyzed by someone who knows the code to confirm this would be correct and wouldn't break anything or if the equals check is even necessary (you'd think something else would be broken by now).

            Karthikeyan Karthikeyan Krishnan
            tpantelis Tom Pantelis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: