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! While you're at it, check out some resources Treehouse students have shared here.

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

Android Android Data Persistence Introduction to Data Persistence Handling an Exception

Zubeyr Aciksari
Zubeyr Aciksari
21,074 Points

The code below has the potential to throw an exception. Wrap this code in a try/catch so it can gracefully react to an e

Stuck in here, please help, don't know what to do? Thanks!

// assetManager, assetName, and fileToWrite have been initialized elsewhere
try {
InputStream in = assetManager.open(assetName);
FileOutputStream out = new FileOutputStream(fileToWrite);
copyFile(in, out);
catch(Exception e) {

3 Answers

I'm going to quote Harry James' on this one as my official answer,

{" I'm getting the same problem on my side as well - there must be an issue with this Code Challenge.

I've gone ahead and reported this to the Treehouse Support team and will post back onto here if I get any updates about this for you (It shouldn't be long - they usually respond pretty quickly)

Speak to you soon and sorry about the issue! "}

Zubeyr Aciksari
Zubeyr Aciksari
21,074 Points

The thing is i cant pass to the next level without correcting this.. All i want is to move on to the next levels.. Thanks for the response anyway!

You should contact support directly to have them bump you on by this till they fix it. Here is the link for convenience.


Don't forget to add the link


in your request. It has the MOD's answer saying this challenge has an error. This may speed your progress to other levels as they fix it.