From b3078dca919d5341dcc8e2367db28a5203204e06 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 21 Apr 2010 15:02:01 -0700 Subject: [PATCH] bring back closeSigar() call in shutdown (commented out in cd42290) --- .../java/src/org/hyperic/sigar/cmd/Shell.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bindings/java/src/org/hyperic/sigar/cmd/Shell.java b/bindings/java/src/org/hyperic/sigar/cmd/Shell.java index ee0b9069..2314c2a4 100644 --- a/bindings/java/src/org/hyperic/sigar/cmd/Shell.java +++ b/bindings/java/src/org/hyperic/sigar/cmd/Shell.java @@ -199,9 +199,18 @@ public class Shell extends ShellBase { public void shutdown() { this.sigar.close(); - //avoid possible Class Not Found: junit/framework/TestCase - if (System.getProperty("jni.dmalloc") != null) { - //org.hyperic.sigar.test.SigarTestCase.closeSigar(); //shutup dmalloc + //cleanup for dmalloc + //using reflection incase junit.jar is not present + try { + //SigarTestCase.closeSigar(); + Class.forName("org.hyperic.sigar.test.SigarTestCase"). + getMethod("closeSigar", new Class[0]).invoke(null, new Object[0]); + } catch (ClassNotFoundException e) { + //SigarTestCase.java not compiled w/o junit.jar + } catch (Exception e) { + e.printStackTrace(); + } catch (NoClassDefFoundError e) { + //avoiding possible Class Not Found: junit/framework/TestCase } super.shutdown(); }