[NETVIRT-1028] Fix unrelated types for equals in HwvtepPhysicalSwitchListener Created: 23/Nov/17  Updated: 29/Jan/20  Resolved: 29/Jan/20

Status: Resolved
Project: netvirt
Component/s: None
Affects Version/s: Oxygen, Fluorine
Fix Version/s: Magnesium

Type: Bug Priority: Medium
Reporter: Tom Pantelis Assignee: Karthikeyan Krishnan
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

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).



 Comments   
Comment by Chetan Arakere Gowdru [ 29/Jan/20 ]

Don't see this findbug issue in master(magnesium). And the Comparision done with Objects.Equals() as valid now

Generated at Wed Feb 07 20:23:03 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.