How can I resolve this SpotBug Error?

Error Description says that you must check for null before returning it.
But even if I check for null it always throws the same error.
How can I resolve this?

Hey, you have to make use of getStockQuote in Portfolio ManagerImpl, because somewhere in your logic, there is a mistake and hence this particular spotbug has been raised, can you check again?

when I Test my code all test cases are passed.
problem is occurring only when I build the code using ./gradlew build command.

Hey, yes your local testcases might pass, but you also have to consider the possibility that somewhere in your code at certain time, a null pointer would be raised, spotbug errors are used to improve the quality of your code. Just check your logic again , it’s probable when you’re calling an API somewhere in your function, you haven’t handled it properly.

Thanks for Your Help
I resolved this by null check.