check getNumberOfRecords != 0 before calling getOldestRecord

This commit is contained in:
Doug MacEachern 2008-09-13 01:37:19 +00:00
parent 61327b9034
commit a6b5f3f30b
1 changed files with 4 additions and 0 deletions

View File

@ -102,6 +102,10 @@ public class TestEventLog extends SigarTestCase {
EventLog log = new EventLog();
log.open(logname);
if (log.getNumberOfRecords() == 0) {
log.close();
return 0; //else log.getOldestRecord() throws Exception
}
int oldestRecord = log.getOldestRecord();
int numRecords = log.getNumberOfRecords();
traceln("oldest=" + oldestRecord +