Bug #297

Search for existing failed devices broken

Added by Philipp Buluschek over 3 years ago.

Status:New Start date:02/04/2015
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:- Spent time: -
Target version:-
Has a patch:No Has license agreement signed:No

Description

In DeviceBuilderThread.doCreateZigBeeDeviceService(ZigBeeNode, byte), if the simple descriptor request fails (in the constructor of ZigBeeDeviceImpl), a ZigBeeBasedriverException is thrown. This will trigger to add the device in the failedAttempts map for later retry.

Here the code checks whether that particular device is already in the map with

ZigBeeDeviceReference last = new ZigBeeDeviceReference(node, ep);
if (!failedAttempts.containsKey(last))
  ...

As containsKey() uses Java's equals() method, but ZigBeeDeviceReference has no equals() defined, it falls back to Object's version which will never find the existing reference in the map.

To make it work correctly, ZigBeeDeviceReference must define an equals() and a hashCode() method. It need to use both the node and the endpoint for correct behavior.

Also available in: Atom PDF