/** * @param file File being scanned and validated. * @param maxTxIdToScan Maximum Tx ID to try to scan. * The scan returns after reading this or a higher * ID. The file portion beyond this ID is * potentially being updated. * @return Result of the validation * @throws IOException */ static LogValidation scanEditLog(File file, long maxTxIdToScan) throws IOException { LogInputStream in; try { in = new LogInputStream(file, INVALID_LOG_INDEX, INVALID_LOG_INDEX, false); // read the header, initialize the inputstream in.init(); } catch (EOFException e) { LOG.warn("Log file " + file + " has no valid header", e); return new LogValidation(0, INVALID_LOG_INDEX, true); } try { return scanEditLog(in, maxTxIdToScan); } finally { IOUtils.cleanup(LOG, in); } }
/** * @param file File being scanned and validated. * @param maxTxIdToScan Maximum Tx ID to try to scan. * The scan returns after reading this or a higher * ID. The file portion beyond this ID is * potentially being updated. * @return Result of the validation * @throws IOException */ static LogValidation scanEditLog(File file, long maxTxIdToScan) throws IOException { LogInputStream in; try { in = new LogInputStream(file, INVALID_LOG_INDEX, INVALID_LOG_INDEX, false); // read the header, initialize the inputstream in.init(); } catch (EOFException e) { LOG.warn("Log file " + file + " has no valid header", e); return new LogValidation(0, INVALID_LOG_INDEX, true); } try { return scanEditLog(in, maxTxIdToScan); } finally { IOUtils.cleanup(LOG, in); } }
case UNINIT: try { init(); } catch (Throwable e) { LOG.error("caught exception initializing " + this, e);
public LogEntryProto nextEntry() throws IOException { if (state.isUnopened()) { try { init(); } catch (Throwable e) { LOG.error("caught exception initializing " + this, e);