I have split this post from an old thread because it didn’t fit the previous subject.
You cannot tell what is happening because the cath block does not display the full details. You cannot tell what sort of Exception is happening, nor why. It is generally a bad idea to catch plain simple Exception. You should catch more specific Exceptions; for example the code you are using might throw IOException or FileNotFoundException. I would suggest replace the catch with the following code:Then you can see what sort of Exception is happening. When you have that knowledge, you can start working out what is happening. Please show us the stack traces.