Skip to content
Success

Changes

Summary

  1. Avoid NPE when processing response message in unit tests (details)
Commit 1d4ebbf8b0b0d3b5e12c9a510ffc6d3f2dc77164 by Simon Bernard
Avoid NPE when processing response message in unit tests

The CoapAsyncRequestObserver spawns a cleaning task when an outbound
message is ready to be sent. When invoking the onResponse method in a
unit test to trigger the processing of an incoming response, a NPE is
thrown if onReadyToSend has not been invoked before.

All other methods use the private cancelCleaningTask method to stop the
cleaning task which performs a non-null check before stopping the task.
The onResponse method has been changed to also use this method in order
to prevent the NPE.

Signed-off-by: Kai Hudalla <kai.hudalla@bosch.io>
The file was modified leshan-core-cf/src/main/java/org/eclipse/leshan/core/californium/CoapAsyncRequestObserver.java (diff)