Adding catch for java.io.IOException