why not have the try/catch logic (at least for IOException) inside the loop?