From a6b5f3f30bc8c6107ccc936a64a288788cd0128b Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sat, 13 Sep 2008 01:37:19 +0000 Subject: [PATCH] check getNumberOfRecords != 0 before calling getOldestRecord --- .../java/src/org/hyperic/sigar/win32/test/TestEventLog.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bindings/java/src/org/hyperic/sigar/win32/test/TestEventLog.java b/bindings/java/src/org/hyperic/sigar/win32/test/TestEventLog.java index 3a4afb0f..a9cdc770 100644 --- a/bindings/java/src/org/hyperic/sigar/win32/test/TestEventLog.java +++ b/bindings/java/src/org/hyperic/sigar/win32/test/TestEventLog.java @@ -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 +