tn5250j/src/org/tn5250j/tools/system OperatingSystem.java,1.7,1.8
"Kenneth J. Pouncey" <[email protected]> Thu, 09 Jun 2005 04:54:47 +0000
| Newsgroups | gmane.comp.java.tn5250j.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tn5250j/tn5250j/src/org/tn5250j/tools/system
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28206
Modified Files:
OperatingSystem.java
Log Message:
mass update of harddrive
Index: OperatingSystem.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/tools/system/OperatingSystem.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** OperatingSystem.java 11 Aug 2004 06:15:07 -0000 1.7
--- OperatingSystem.java 9 Jun 2005 04:54:45 -0000 1.8
***************
*** 198,205 ****
String commandTemplate = props.getProperty(
"emul.protocol." + protocol, ConfigureFactory.SESSIONS).trim();
! java.text.MessageFormat format = new java.text.MessageFormat(
! commandTemplate);
try {
! command = format.format(url);
}
catch (Exception exx) {
--- 198,208 ----
String commandTemplate = props.getProperty(
"emul.protocol." + protocol, ConfigureFactory.SESSIONS).trim();
! Object[] urlParm = new Object[1];
! urlParm[0] = url;
! if (commandTemplate.lastIndexOf("{0}") == -1)
! commandTemplate += " {0}";
! java.text.MessageFormat format = new java.text.MessageFormat(commandTemplate);
try {
! command = format.format(urlParm);
}
catch (Exception exx) {
***************
*** 211,231 ****
if (command != null && command.length() > 0) {
! try {
! Process p = Runtime.getRuntime().exec(command);
! // wait for exit code -- if it's 0, command worked,
! // otherwise we need to start the browser up.
! int exitCode = p.waitFor();
! if (exitCode != 0) {
! log.warn("Error processing protocol, command='" + command + "'");
! }
! }
! catch (InterruptedException exc) {
! log.warn("Error processing protocol, command='" + command + "'");
! log.warn("Caught: " + exc.getMessage());
! }
! catch (IOException ioe) {
! log.warn("Error processing protocol, command='" + command + "'");
! log.warn("Caught: " + ioe.getMessage());
! }
}
else {
--- 214,219 ----
if (command != null && command.length() > 0) {
! execute(command);
!
}
else {
***************
*** 271,274 ****
--- 259,284 ----
}
+ public static int execute(String command) {
+
+ int exitCode = -1;
+
+ try {
+ Process p = Runtime.getRuntime().exec(command);
+ // wait for exit code -- if it's 0, command worked,
+ exitCode = p.waitFor();
+ if (exitCode != 0) {
+ log.warn("Error processing command, command='" + command + "'");
+ }
+ }
+ catch (InterruptedException exc) {
+ log.warn("Error processing command, command='" + command + "'");
+ log.warn("Caught: " + exc.getMessage());
+ }
+ catch (IOException ioe) {
+ log.warn("Error processing command, command='" + command + "'");
+ log.warn("Caught: " + ioe.getMessage());
+ }
+ return exitCode;
+ }
//}}}
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20