I have found a problem when RosieUseCase.notifyError is called, a null pointer exception sometimes occurs in RosieUseCase L.77. The exception is only thrown when onErrorCallback.get() returns null, because this weak reference is empty.
I have been looking into and I have been able to see that the only class that call setOnErrorCallback() is UseCaseHandler when it is executed, and the method is called with a OnErrorCallbackToErrorHandlerAdapter, which is instantiated in the execute method and it is not saved in a strong reference.
To fix this in my application I have replaced UseCaseHandler with a class called com.karumi.rosie.domain.usecase.MyUseCaseHandler, which extends UseCaseHandler but it does not call UseCaseHandler methods.
There is an open issue about a NullPointerException in use case notifyError, but I do not know if it is the same problem, because my problem occurs in all android versions and only sometimes.
I am using Rosie in an app available in Google Play, everything is working fine except for a few crashes caused by this issue.
I have found a problem when RosieUseCase.notifyError is called, a null pointer exception sometimes occurs in RosieUseCase L.77. The exception is only thrown when onErrorCallback.get() returns null, because this weak reference is empty.
I have been looking into and I have been able to see that the only class that call setOnErrorCallback() is UseCaseHandler when it is executed, and the method is called with a OnErrorCallbackToErrorHandlerAdapter, which is instantiated in the execute method and it is not saved in a strong reference.
I have been able to fix this problem with some changes in UseCaseHandler, I have created this Pull Request: https://github.com/Karumi/Rosie/pull/84
To fix this in my application I have replaced UseCaseHandler with a class called com.karumi.rosie.domain.usecase.MyUseCaseHandler, which extends UseCaseHandler but it does not call UseCaseHandler methods.
There is an open issue about a NullPointerException in use case notifyError, but I do not know if it is the same problem, because my problem occurs in all android versions and only sometimes.
I am using Rosie in an app available in Google Play, everything is working fine except for a few crashes caused by this issue.