check getNumberOfRecords != 0 before calling getOldestRecord
This commit is contained in:
parent
61327b9034
commit
a6b5f3f30b
@ -102,6 +102,10 @@ public class TestEventLog extends SigarTestCase {
|
|||||||
EventLog log = new EventLog();
|
EventLog log = new EventLog();
|
||||||
|
|
||||||
log.open(logname);
|
log.open(logname);
|
||||||
|
if (log.getNumberOfRecords() == 0) {
|
||||||
|
log.close();
|
||||||
|
return 0; //else log.getOldestRecord() throws Exception
|
||||||
|
}
|
||||||
int oldestRecord = log.getOldestRecord();
|
int oldestRecord = log.getOldestRecord();
|
||||||
int numRecords = log.getNumberOfRecords();
|
int numRecords = log.getNumberOfRecords();
|
||||||
traceln("oldest=" + oldestRecord +
|
traceln("oldest=" + oldestRecord +
|
||||||
|
Loading…
Reference in New Issue
Block a user