Kaydet (Commit) 51ee7d2d authored tarafından Noel Power's avatar Noel Power

ScriptBinding.xba, enabled dynamic config changes

ExecCmd, put close of streams in final block
üst 60c8e64e
...@@ -588,7 +588,8 @@ Sub WriteXMLFromArray() ...@@ -588,7 +588,8 @@ Sub WriteXMLFromArray()
On Error Goto ErrorHandler On Error Goto ErrorHandler
cfgFile = GetOfficePath() + "user/config/soffice.cfg/" + xmlFileName cfgFile = GetOfficePath() + "user/config/soffice.cfg/" + xmlFileName
updateCfgFile( cfgFile ) updateCfgFile( cfgFile )
if ( false ) then' config stuff not in build yet 'if ( false ) then' config stuff not in build yet
if ( true ) then
updateConfig( xmlFileName ) updateConfig( xmlFileName )
else else
msgbox ("Office must be restarted before your changes will take effect."+ chr$(10)+"Also close the Office QuickStarter (Windows and Linux)", 48, "Assign Script (Java) To Menu" ) msgbox ("Office must be restarted before your changes will take effect."+ chr$(10)+"Also close the Office QuickStarter (Windows and Linux)", 48, "Assign Script (Java) To Menu" )
......
...@@ -16,9 +16,10 @@ public class ExecCmd ...@@ -16,9 +16,10 @@ public class ExecCmd
new Thread(new Runnable() { new Thread(new Runnable() {
public void run() public void run()
{ {
BufferedReader br_in = null;
try try
{ {
BufferedReader br_in = new BufferedReader(new InputStreamReader(p.getInputStream())); br_in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String buff = null; String buff = null;
while ((buff = br_in.readLine()) != null) while ((buff = br_in.readLine()) != null)
{ {
...@@ -29,7 +30,6 @@ public class ExecCmd ...@@ -29,7 +30,6 @@ public class ExecCmd
} }
catch(Exception e) {}*/ catch(Exception e) {}*/
} }
br_in.close();
System.out.println("finished reading out"); System.out.println("finished reading out");
} }
catch (IOException ioe) catch (IOException ioe)
...@@ -37,23 +37,45 @@ public class ExecCmd ...@@ -37,23 +37,45 @@ public class ExecCmd
System.out.println("Exception caught printing javac result"); System.out.println("Exception caught printing javac result");
ioe.printStackTrace(); ioe.printStackTrace();
} }
finally
{
if ( br_in != null )
{
try
{
br_in.close();
}
catch( Exception e ) {} // nothing can be done
}
}
} } ).start(); } } ).start();
new Thread(new Runnable() { new Thread(new Runnable() {
public void run() { public void run() {
BufferedReader br_err = null;
try { try {
BufferedReader br_err = new BufferedReader(new InputStreamReader(p.getErrorStream())); br_err = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String buff = null; String buff = null;
while ((buff = br_err.readLine()) != null) { while ((buff = br_err.readLine()) != null) {
System.out.println("Process err :" + buff); System.out.println("Process err :" + buff);
/*try {Thread.sleep(100); } catch(Exception e) {}*/ /*try {Thread.sleep(100); } catch(Exception e) {}*/
} }
br_err.close();
System.out.println("finished reading err"); System.out.println("finished reading err");
} catch (IOException ioe) { } catch (IOException ioe) {
System.out.println("Exception caught printing javac result"); System.out.println("Exception caught printing javac result");
ioe.printStackTrace(); ioe.printStackTrace();
} }
finally
{
if ( br_err != null )
{
try
{
br_err.close();
}
catch( Exception e ) {} // nothing can be done
}
}
} }).start(); } }).start();
int exitcode = p.waitFor(); int exitcode = p.waitFor();
if ( exitcode != 0 ) if ( exitcode != 0 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment