for (File dataFile : files) {
LogFile.SequentialReader reader =
new LogFileV3.SequentialReader(dataFile, null, true);
RandomAccessFile handle = new RandomAccessFile(dataFile, "rw");
long eventPosition1 = reader.getPosition();
LogRecord rec = reader.next();
//No point corrupting commits, so ignore them
if(rec == null ||
rec.getEvent().getClass().getName().
equals("org.apache.flume.channel.file.Commit")) {
handle.close();
reader.close();
continue;
}
long eventPosition2 = reader.getPosition();
rec = reader.next();
handle.seek(eventPosition1 + 100);
handle.writeInt(random.nextInt());
corrupted++;
corruptFiles.add(dataFile.getName());
if (rec == null ||
rec.getEvent().getClass().getName().
equals("org.apache.flume.channel.file.Commit")) {
handle.close();
reader.close();
continue;
}