if (lastException instanceof IOException) {
throw (IOException)lastException;
} else if (lastException instanceof IncorrectFormatException) {
IOException incorrectFormatException = new IOException("Incorrect format");
incorrectFormatException.initCause(lastException);
throw incorrectFormatException;
} else if (lastException instanceof ParsingErrorException) {
IOException incorrectFormatException = new IOException("Parsing error");
incorrectFormatException.initCause(lastException);
throw incorrectFormatException;