diff --git a/pom.xml b/pom.xml index f311b42..b1e4fca 100644 --- a/pom.xml +++ b/pom.xml @@ -1,15 +1,15 @@ 4.0.0 - com.profesorfalken + net.synedra WMI4Java - 1.6.3 + 1.6.4 jar WMI4Java API to query WMI from Java - https://github.com/profesorfalken/WMI4Java + https://github.com/effad/WMI4Java @@ -26,10 +26,18 @@ ProfesorFalken http://www.profesorfalken.com + + Robert Lichtenberger + r.lichtenberger@synedra.com + synedra + http://www.synedra.com + + - https://github.com/profesorfalken/WMI4Java.git + scm:git:file:///home/rli/PWEs/WMI4Java + https://github.com/effad/WMI4Java.git @@ -56,10 +64,39 @@ ossrh https://oss.sonatype.org/ - true + false - + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + 8 + + 2.9.1 + + + attach-javadocs + + jar + + + + + org.apache.maven.plugins maven-gpg-plugin 1.5 @@ -123,8 +160,8 @@ UTF-8 - 1.5 - 1.5 - 1.5 + 1.8 + 1.8 + 1.8 diff --git a/src/main/java/com/profesorfalken/wmi4java/WMIVBScript.java b/src/main/java/com/profesorfalken/wmi4java/WMIVBScript.java index 1d8b9c8..43a1f4a 100644 --- a/src/main/java/com/profesorfalken/wmi4java/WMIVBScript.java +++ b/src/main/java/com/profesorfalken/wmi4java/WMIVBScript.java @@ -42,6 +42,7 @@ private static String executeScript(String scriptCode) throws WMIException { File tmpFile = null; FileWriter writer = null; BufferedReader errorOutput = null; + Process process = null; try { tmpFile = File.createTempFile("wmi4java" + new Date().getTime(), ".vbs"); @@ -50,7 +51,7 @@ private static String executeScript(String scriptCode) throws WMIException { writer.flush(); writer.close(); - Process process = Runtime.getRuntime().exec( + process = Runtime.getRuntime().exec( new String[]{"cmd.exe", "/C", "cscript.exe", "/NoLogo", tmpFile.getAbsolutePath()}); BufferedReader processOutput = new BufferedReader(new InputStreamReader(process.getInputStream())); @@ -89,6 +90,11 @@ private static String executeScript(String scriptCode) throws WMIException { if (errorOutput != null) { errorOutput.close(); } + if (process != null) { + process.getInputStream().close(); + process.getOutputStream().close(); + process.getErrorStream().close(); + } } catch (IOException ioe) { Logger.getLogger(WMI4Java.class.getName()).log(Level.SEVERE, "Exception closing in finally", ioe); }