An OutOfBoundsException can only occur if the file is empty. This would also explain why it worked with a different filename (because a new file was created that is not empty). I will change the code again so that this exception cannot be thrown again.
1 Like