summaryrefslogtreecommitdiff
path: root/scripting/workben/installer
diff options
context:
space:
mode:
authorNoel Power <npower@openoffice.org>2003-02-25 15:15:43 +0000
committerNoel Power <npower@openoffice.org>2003-02-25 15:15:43 +0000
commit51ee7d2de5353ae0f43226400a884b00241887e3 (patch)
tree1e77889d66c6cb452880e2a58f67dd113adb1002 /scripting/workben/installer
parent60c8e64eef4ca17909c001d797225b44b8a113e1 (diff)
ScriptBinding.xba, enabled dynamic config changes
ExecCmd, put close of streams in final block
Diffstat (limited to 'scripting/workben/installer')
-rw-r--r--scripting/workben/installer/ExecCmd.java30
1 files changed, 26 insertions, 4 deletions
diff --git a/scripting/workben/installer/ExecCmd.java b/scripting/workben/installer/ExecCmd.java
index 416d644fe126..fa5f9a8b2dcd 100644
--- a/scripting/workben/installer/ExecCmd.java
+++ b/scripting/workben/installer/ExecCmd.java
@@ -16,9 +16,10 @@ public class ExecCmd
new Thread(new Runnable() {
public void run()
{
+ BufferedReader br_in = null;
try
{
- BufferedReader br_in = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ br_in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String buff = null;
while ((buff = br_in.readLine()) != null)
{
@@ -29,7 +30,6 @@ public class ExecCmd
}
catch(Exception e) {}*/
}
- br_in.close();
System.out.println("finished reading out");
}
catch (IOException ioe)
@@ -37,23 +37,45 @@ public class ExecCmd
System.out.println("Exception caught printing javac result");
ioe.printStackTrace();
}
+ finally
+ {
+ if ( br_in != null )
+ {
+ try
+ {
+ br_in.close();
+ }
+ catch( Exception e ) {} // nothing can be done
+ }
+ }
} } ).start();
new Thread(new Runnable() {
public void run() {
+ BufferedReader br_err = null;
try {
- BufferedReader br_err = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+ br_err = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String buff = null;
while ((buff = br_err.readLine()) != null) {
System.out.println("Process err :" + buff);
/*try {Thread.sleep(100); } catch(Exception e) {}*/
}
- br_err.close();
System.out.println("finished reading err");
} catch (IOException ioe) {
System.out.println("Exception caught printing javac result");
ioe.printStackTrace();
}
+ finally
+ {
+ if ( br_err != null )
+ {
+ try
+ {
+ br_err.close();
+ }
+ catch( Exception e ) {} // nothing can be done
+ }
+ }
} }).start();
int exitcode = p.waitFor();
if ( exitcode != 0 )