Spotbug DLS_DEAD_LOCAL_STORE error

My previous topic link :

I went through all the links which you had provided. I still got
com.crio.warmup.stock.portfolio.PortfolioManagerTest > calculateExtrapolatedAnnualizedReturn() FAILED
java.lang.NullPointerException at PortfolioManagerTest.java:117

So, i did null check for restTemplate in “getStockQuote()” and if null, delegated to AlphavantageService. After that build is successful but I am getting spotbug error, which says “Bug type DLS_DEAD_LOCAL_STORE”. But i could see the local variable being used.

Hey, I can see you are getting a DLS spotbug, refactor and extract it to a method.
it should look like:

arraylist obj = extracted(parameter, parameter);
You can see the extracted method in your class somewhere

Hi @Sakshat-Crio.Do

I have extraced to method. Now i am getting “Error - Request failed with status code 500” in UI. Referred other threads regarding the similar issue. I have handled null check in StockQuoteServiceFactory. What else to be done ?

Run the spring server and run the annual return app. Check the stack trace and specifically check the last lines in the stack trace it might give you more insight regarding the error. There are multiple reasons for the error 500 to crop up. Please create a new topic if your spotbug issue is resolved.

Closing this topic as it has been solved by you yourself. Great job, keep working hard. if its not resolved feel free to un-mark the accepted solution to re-open the topic.

Re-opening this topic as the previously accepted solution was just Un-marked.

Closing this topic as your issue is resolved by the mentor. If it is still not resolved, Kindly un-mark the accepted solution or create a new topic and post this question as a reference link in the description of the new topic.