Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Viktor Khon
Viktor Khon
2,798 Points

Common problems of TreeStory2 and how to [Solve] them

Hello everyone,

I have just completed the last challenge of the Tree Story 2 and I think that the directions could be a little better as I struggled myself until I figured out that a few items were just not mentioned, which would be nice. Few things that you may encounter and how to solve them:

1) Forgot to remove TODO's

  • I believe that this error is from the comments that were left their initially, once you start the quiz. Erase the comments from both files, so there are no "TODO" left in comments and it should work

2) java.lang.NullPointerException (Look around Prompter.java line 85) or similar:

  • This error is generated within promptForWord() method when you use mReader.readLine(); I'm not 100% sure why it does that even though I personally included the "throws IOException" in the method, BUT in order to fix this you may need to use try/catch block within the mReader.readLine(); Again, I don't know if this is required in the real world apps, but this solved the problem for me. Also, make sure to use a while loop to check if the entered word is contained within the mCensoredWords

3) Did you prompt for story(1)?

  • This one was a little tricky as I did not understand from the TODOs that a unique story needed to be passed. Anyway, basically what this means is that you cannot use the default 'String story' with hard coded text. The challenge wants to have an ability to enter the new text with the story.
  • One way to solve it is by creating a new method within Prompter class that returns a String. Create a new String that will ask for an input and return it. You may even use a System.out to ask for what you want, but it is not necessary to complete the challenge.
  • Then in the Main, delete the 'String story' and instead pass the newly created Prompter method into the new Template object
  • Of course don't forget to use prompter.run() command that was required initially

These are the problems that I have personally encountered and after searching the forum, I saw most other students have encountered as well. Hopefully these tips will help you pass the test without too much frustration.


Mike Papamichail
Mike Papamichail
4,883 Points

I'll second all of these. Great job Viktor Khon , i encountered most of them and especially the 1st one. Your solution was the answer to my question. The pre-written comments inside the challenge(which contain the word TODO's) are the ones that create this problem. Thank you so much for making this post, i just wish there was a way to make it so that more students could see your post since it took me soo long to find this.

Craig Dennis , sir have you read this post? I believe he stands correct. Isn't there a way to fix these errors and/or add some clarifications for the challenge?Thanks in advance!