Getting Internal Server Error

I am getting a NullPointerException and I am unable to debug it.
Though ./gradlew build and ./gradlew test are running successfully.

I think there might be an issue with buildUri method in AlphavantageService.java. Please look into that method.

It’s similar to TiingoService.java, I guess there shouldn’t be anything wrong with that. Moreover, it just returns the URL to make call to, which I checked by making a request using Postman.

Which type of method call are you using? Class based or string based?

You mean the response type of restTemplate, right? If yes, then string based.

Okay. And have you tried seeing why StockQouteServiceFactory is throwing null?

Yeah, that’s what I asked in the doubt itself! I am unable to find out why!

@Saurav_Crio.Do any other suggestions why is this happening?

verify the parameters which you receive in the StockQuoteServiceFactory.getService() method

What I meant is, did you run a debug test and find out where the exception is originating?

@shoryajain That’s what I am trying to say, I am not getting any error while running tests in debug mode. The code is passing all tests and also getting build success. But when I ran annual-return-app, I got this error.

You need to explicitly write a check for null in the factory. Checking it for empty string or length 0 string won’t work. Maybe that’s the error?

I remember this because I had the same issue.

2 Likes

@rg99 is your error resolved?

Not yet @Saurav_Crio.Do

@rg99 can you please create a new topic and add the link of this topic in description. I’m closing this topic. We will start the discussion in new topic.