NullPointerException in annual-return-app


Error not resolved yet.

annual-return-app cannot have any errors because it is a stub that you have pulled. Please check the first two lines of ‘trace’. I think that’s the issue that you are facing.
./gradlew test and,/gradlew build are successful because it is just mocking api calls and not making actual api call. When we try to run the UI, the front end make a real api call.

Yeah I get that, but I fail to understand why NullPointerException is coming :slightly_frowning_face:

Because the response you are getting might be null thats why it throws Nullpointerexception

Yeah of course I know what the exception means, but I implemented it the way I implemented tiingo service and I didn’t expect that. Now I want to know how can I resolve that.

its probably coming from the candles you fetch from tiing/alpha api, try checking if they re null and change your return values accordingly

Hi @rg99, I also had this same error. Check how your getService() method in StockQuoteServiceFactory is called from annual-return-app.

1 Like

Thanks for the reference @dotslash21

2 Likes

How do you solve this ? @rg99

Are you using String.equals() method anywhere in your code?

Yeah. Solved it. Thanks anyways.

Fantastic clue. Thank you for the help

I am not able to figure out a solution for this issue and I am not using string.equals() in the getService() method of StockQuoteServiceFactory.
Can anyone help me with this?

Thanks