@kaikreuzer This pull request is a continuation of PR #6859.
Basically, #6859 fixed a possible NPE, but didn't provide a fix for the issue that if an exception occurs the firmware transfer may never continue. Here's the reason why:
Inside processFirmwareStatusInfo(...) the following statement is declared:
On one hand, during the first time we set the value for the exact thing UID previousFirmwareStatusInfo is effectively assigned null. On the other hand, however, the value of newFirmwareStatusInfo for the current thing UID is added to the firmwareStatusInfoMap.
Then, inside transferLatestFirmware(...), if an exception occurs, firmwareStatusInfoMap is not changed, because previousFirmwareStatusInfo is null, but at the same time it contains a value of newFirmwareStatusInfo for the current thing UID. Further ahead, e.g. after some time processFirmwareStatusInfo(...) is called again with the same value for newFirmwareStatusInfo, but the check previousFirmwareStatusInfo == null || !previousFirmwareStatusInfo.equals(newFirmwareStatusInfo) is not fulfilled, because previousFirmwareStatusInfo equals newFirmwareStatusInfo and is not null. In this situation, the code that is responsible for transferring the firmware is never executed and the update hangs on.
In order to prevent this, the change done in #6859 is now extended to remove the stored value for the current thing UID from firmwareStatusInfoMap if in case of an exception the previousFirmwareStatusInfo is null.
@kaikreuzer This pull request is a continuation of PR #6859.
Basically, #6859 fixed a possible NPE, but didn't provide a fix for the issue that if an exception occurs the firmware transfer may never continue. Here's the reason why:
Inside
processFirmwareStatusInfo(...)
the following statement is declared:On one hand, during the first time we set the value for the exact thing UID
previousFirmwareStatusInfo
is effectively assigned null. On the other hand, however, the value ofnewFirmwareStatusInfo
for the current thing UID is added to thefirmwareStatusInfoMap
.Then, inside
transferLatestFirmware(...)
, if an exception occurs,firmwareStatusInfoMap
is not changed, becausepreviousFirmwareStatusInfo
isnull
, but at the same time it contains a value ofnewFirmwareStatusInfo
for the current thing UID. Further ahead, e.g. after some timeprocessFirmwareStatusInfo(...)
is called again with the same value fornewFirmwareStatusInfo
, but the checkpreviousFirmwareStatusInfo == null || !previousFirmwareStatusInfo.equals(newFirmwareStatusInfo)
is not fulfilled, becausepreviousFirmwareStatusInfo
equalsnewFirmwareStatusInfo
and is notnull
. In this situation, the code that is responsible for transferring the firmware is never executed and the update hangs on.In order to prevent this, the change done in #6859 is now extended to remove the stored value for the current thing UID from
firmwareStatusInfoMap
if in case of an exception thepreviousFirmwareStatusInfo
isnull
.