Changeset 20899 for greenstone3
- Timestamp:
- 2009-11-03T19:49:03+13:00 (14 years ago)
- Location:
- greenstone3/trunk/src/java/org/greenstone/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
greenstone3/trunk/src/java/org/greenstone/server/BaseServer.java
r20687 r20899 190 190 String url = getBrowserURL(); 191 191 //recordError("**** browserURL: " + url); 192 BrowserLauncher launcher = new BrowserLauncher(config_properties.getProperty(BaseServer.Property.BROWSER_PATH, ""),url); 192 BrowserLauncher launcher = new BrowserLauncher(config_properties.getProperty(BaseServer.Property.BROWSER_PATH, ""), 193 url, 194 dictionary.get("ServerSettings.NoBrowserFound"), 195 dictionary.get("ServerSettings.BrowserLaunchFailed")); 193 196 logger_.info(message); 194 197 -
greenstone3/trunk/src/java/org/greenstone/server/BrowserLauncher.java
r18969 r20899 1 1 package org.greenstone.server; 2 2 3 import javax.swing.JOptionPane; 3 4 import java.io.BufferedReader; 4 5 import java.io.InputStream; … … 10 11 public class BrowserLauncher 11 12 extends Thread { 13 private String browserNotFound; 14 private String browserLaunchFailed; 12 15 13 16 private String url = "about:blank" ; … … 20 23 private String browserPath = ""; 21 24 22 public BrowserLauncher(String browserPath, String url ) {25 public BrowserLauncher(String browserPath, String url, String browserNotFound, String browserLaunchFailed) { 23 26 this.url = url; 27 this.browserNotFound = browserNotFound; 28 this.browserLaunchFailed = browserLaunchFailed; 24 29 this.browserPath = browserPath; 25 30 //use the default browser … … 86 91 if(command.equals("")) { 87 92 state = LAUNCHFAILED; 88 logger.error("launching command is empty"); 93 logger.error("launching command is empty: no browser found."); 94 JOptionPane.showMessageDialog(null, browserNotFound, "Warning", JOptionPane.WARNING_MESSAGE); 89 95 return; 90 96 } 91 97 92 98 try { 99 int exitCode = 0; 93 100 String prog_name = this.command.substring(0,this.command.indexOf(" ")); 94 101 String lower_name = prog_name.toLowerCase(); … … 101 108 Process process = rt.exec(new_command); 102 109 state = LAUNCHSUCCESS; 103 intexitCode = process.waitFor();110 exitCode = process.waitFor(); 104 111 logger.info("ExitCode:" + exitCode); 105 112 if (exitCode != 0) { // if Netscape or mozilla was not open … … 108 115 process = rt.exec(this.command); // try the original command 109 116 state = LAUNCHSUCCESS; 110 //for some re seaons the following part is not executed somtimes.117 //for some reason the following part is not executed sometimes. 111 118 exitCode = process.waitFor(); 112 logger.info("ExitCode:" + exitCode);113 119 } 114 120 } else { … … 117 123 Process process = rt.exec(this.command); 118 124 state = LAUNCHSUCCESS; 119 //for some reseaons the following part is not executed sometimes. 120 int exitCode = process.waitFor(); 121 logger.info("ExitCode:" + exitCode); 122 125 //for some reason the following part is not executed sometimes. 126 exitCode = process.waitFor(); 127 } 128 129 logger.info("ExitCode:" + exitCode); 130 if (exitCode != 0) { // if trying to launch the browser above failed 131 logger.info(browserLaunchFailed); 132 JOptionPane.showMessageDialog(null, browserLaunchFailed, "Warning", JOptionPane.WARNING_MESSAGE); 123 133 } 124 134 }
Note:
See TracChangeset
for help on using the changeset viewer.