Update comment - NPE

Hi guys,

I’m unable to get the validation code for the Create/Update comments ticket, even though the tests pass. I’ve found that the cause for this is a NPE in the MoviesService, line 244. It appears my frontend does not send a “comment_id”, which is used to create the comment object. Do I need to update my application code from somewhere before attempting this ticket, or did I do something wrong?


Hi @JoranBergfeld,

The line you are mentioning is related with the updateMovieComment method, to which we do pass a comment_id value from the front-end.
Are conflating the create with update ?


The exception I see is based on the call updateComment.setId(commentBody.get("comment_id"));, which will try to create a new ObjectId based on the id value passed. What I am observing is that the @RequestBody annotated Map<String, String> in the MovieController.updateMovieComment() method does not hold a “comment_id” value, resulting in this NPE. When I am looking at the front end, it appears to be sending “movie_id” and “updated_comment”.

I’m currently at work, so I sadly cannot provide you with screenshots of this. I’ll add some debug screenshots when I get home.

Edit: Added two screenshots.