Ignore:
Timestamp:
2004-10-08T09:46:12+13:00 (20 years ago)
Author:
mdewsnip
Message:

Replaced all Gatherer.print* with DebugStream.print*.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r8235 r8236  
    220220        // Having loaded the configuration (necessary to determine if certain warnings have been disabled) and dictionary, we now check if the necessary path variables have been provided.
    221221        if (Configuration.exec_file == null && Configuration.exec_address == null) {
    222         Gatherer.println("config.exec_file is null");
    223         Gatherer.println("config.exec_address is null");
     222        DebugStream.println("config.exec_file is null");
     223        DebugStream.println("config.exec_address is null");
    224224        missingEXEC();
    225225        }
    226226
    227227        if (Gatherer.isGsdlRemote) {
    228         Gatherer.println("Not checking for perl path/exe");
     228        DebugStream.println("Not checking for perl path/exe");
    229229        }
    230230        else {
     
    326326
    327327    }
    328     catch (Exception error) {
    329         error.printStackTrace();
     328    catch (Exception exception) {
     329        DebugStream.printStackTrace(exception);
    330330    }
    331331
     
    472472        String raw_url = Configuration.exec_address.toString() + command;
    473473        URL url = new URL(raw_url);
    474         Gatherer.println("Action: " + raw_url);
     474        DebugStream.println("Action: " + raw_url);
    475475        HttpURLConnection library_connection = (HttpURLConnection) url.openConnection();
    476476        int response_code = library_connection.getResponseCode();
    477477        if(HttpURLConnection.HTTP_OK <= response_code && response_code < HttpURLConnection.HTTP_MULT_CHOICE) {
    478         Gatherer.println("200 - Complete.");
     478        DebugStream.println("200 - Complete.");
    479479        }
    480480        else {
    481         Gatherer.println("404 - Failed.");
     481        DebugStream.println("404 - Failed.");
    482482        }
    483483        url = null;
    484484    }
    485485    catch (Exception ex) {
    486         ex.printStackTrace();
    487         Gatherer.printStackTrace(ex);
     486        DebugStream.printStackTrace(ex);
    488487    }
    489488    }
     
    496495        String raw_url = Configuration.exec_address.toString() + Configuration.getServletPath() + command;
    497496        URL url = new URL(raw_url);
    498         Gatherer.println("Action: " + raw_url);
     497        DebugStream.println("Action: " + raw_url);
    499498        HttpURLConnection library_connection = (HttpURLConnection) url.openConnection();
    500499        int response_code = library_connection.getResponseCode();
    501500        if(HttpURLConnection.HTTP_OK <= response_code && response_code < HttpURLConnection.HTTP_MULT_CHOICE) {
    502         Gatherer.println("200 - Complete.");
     501        DebugStream.println("200 - Complete.");
    503502        }
    504503        else {
    505         Gatherer.println("404 - Failed.");
     504        DebugStream.println("404 - Failed.");
    506505        }
    507506        url = null;
    508507    }
    509508    catch(Exception exception) {
    510         Gatherer.printStackTrace(exception);
     509        DebugStream.printStackTrace(exception);
    511510        ///ystem.err.println("Bad URL.");
    512511    }
     
    613612    dialog = null;
    614613    }
    615     /** Print a message to the debug stream. */
    616     static synchronized public void print(String message) {
    617     DebugStream.print(message);
    618     }
    619     /** Print a message to the debug stream. */
    620     static synchronized public void println(String message) {
    621     DebugStream.println(message);
    622     }
    623 
    624     /** Print a stack trace to the debug stream. */
    625     static synchronized public void printStackTrace(Exception exception) {
    626     DebugStream.printStackTrace(exception);
    627     }
    628 
    629     /** Prints a usage message to screen.
    630      */
    631     static public void printUsage(Dictionary dictionary) {
    632     System.out.println(Dictionary.get("General.Usage"));
    633     }
     614
    634615
    635616    /** Sets up the proxy connection by setting JVM Environment flags and creating a new Authenticator.
     
    651632        }
    652633    } catch (Exception error) {
    653         Gatherer.println("Error in Gatherer.initProxy(): " + error);
    654         Gatherer.printStackTrace(error);
     634        DebugStream.println("Error in Gatherer.initProxy(): " + error);
     635        DebugStream.printStackTrace(error);
    655636    }
    656637    }
     
    695676    }
    696677    catch (Exception error) {
    697         Gatherer.println(Configuration.CONFIG_XML+" is not a well formed XML document.");
    698         Gatherer.printStackTrace(error);
     678        DebugStream.println(Configuration.CONFIG_XML+" is not a well formed XML document.");
     679        DebugStream.printStackTrace(error);
    699680    }
    700681    if (GS3) {
    701682        try {
    702683        servlet_config = new ServletConfiguration(gsdl3_path);
    703         } catch (Exception error) {
    704         error.printStackTrace();
     684        } catch (Exception exception) {
     685        DebugStream.printStackTrace(exception);
    705686        }
    706687    }
     
    711692    try {
    712693        Configuration.save();
    713     } catch (Exception error) {
    714         Gatherer.printStackTrace(error);
     694    } catch (Exception exception) {
     695        DebugStream.printStackTrace(exception);
    715696    }
    716697    }
     
    766747            // A quick test involves opening a connection to get the home page  for this collection. If this fails then we try changing the url to be localhost.
    767748            try {
    768                 Gatherer.println("Try connecting to server on config url: '" + Configuration.exec_address + "'");
     749                DebugStream.println("Try connecting to server on config url: '" + Configuration.exec_address + "'");
    769750                URLConnection connection = Configuration.exec_address.openConnection();
    770751                connection.getContent();
     
    772753            catch(IOException bad_url_connection) {
    773754                try {
    774                 Gatherer.println("Try connecting to server on local host: '" + gsdlsite_cfg.getLocalHostURL() + "'");
     755                DebugStream.println("Try connecting to server on local host: '" + gsdlsite_cfg.getLocalHostURL() + "'");
    775756                Configuration.exec_address = new URL(gsdlsite_cfg.getLocalHostURL   ());
    776757                URLConnection connection = Configuration.exec_address.openConnection();
     
    778759                }
    779760                catch(IOException worse_url_connection) {
    780                 Gatherer.println("Can't connect to server on either address.");
     761                DebugStream.println("Can't connect to server on either address.");
    781762                Configuration.exec_address = null;
    782763                Configuration.exec_file = null;
     
    789770            }
    790771        }
    791         catch (Exception error) {
    792             error.printStackTrace();
     772        catch (Exception exception) {
     773            DebugStream.printStackTrace(exception);
    793774        }
    794775        }
    795776        // Can't do a damb thing.
    796777    }
    797     Gatherer.println("Having started server.exe, exec_address is: " + Configuration.exec_address);
     778    DebugStream.println("Having started server.exe, exec_address is: " + Configuration.exec_address);
    798779    }
    799780
     
    827808            //}
    828809        }
    829         catch (Exception error) {
    830             error.printStackTrace();
     810        catch (Exception exception) {
     811            DebugStream.printStackTrace(exception);
    831812        }
    832813        }
     
    882863            whole_command.append(" ");
    883864            }
    884             println("Running " + whole_command.toString());
     865            DebugStream.println("Running " + whole_command.toString());
    885866            Runtime rt = Runtime.getRuntime();
    886867            process = rt.exec(commands);
     
    888869        }
    889870        else {
    890             println("Running " + command);
     871            DebugStream.println("Running " + command);
    891872            Runtime rt = Runtime.getRuntime();
    892873            process = rt.exec(command);
     
    894875        }
    895876        }
    896         catch (Exception error) {
    897         println("Error in ExternalApplication.run(): " + error);
    898         printStackTrace(error);
     877        catch (Exception exception) {
     878        DebugStream.printStackTrace(exception);
    899879        }
    900880        // Remove ourself from Gatherer list of threads.
     
    956936        String lower_name = prog_name.toLowerCase();
    957937        if (lower_name.indexOf("mozilla") != -1 || lower_name.indexOf("netscape") != -1) {
    958             Gatherer.println("found mozilla or netscape, trying remote it");
     938            DebugStream.println("found mozilla or netscape, trying remote it");
    959939            // mozilla and netscape, try using a remote command to get things in the same window
    960940            String [] new_commands = new String[] {prog_name, "-raise", "-remote", "openURL("+url+",new-tab)"};
     
    965945            int exitCode = process.waitFor();
    966946            if (exitCode != 0) { // if Netscape or mozilla was not open
    967             Gatherer.println("couldn't do remote, trying original command");
     947            DebugStream.println("couldn't do remote, trying original command");
    968948            printArray(commands);
    969949            process = rt.exec(commands); // try the original command
     
    976956            whole_command.append(" ");
    977957            }
    978             println("Running " + whole_command.toString());
     958            DebugStream.println("Running " + whole_command.toString());
    979959            Runtime rt = Runtime.getRuntime();
    980960            process = rt.exec(commands);
     
    983963        }
    984964       
    985         catch (Exception error) {
    986         println("Error in BrowserApplication.run(): " + error);
    987         printStackTrace(error);
     965        catch (Exception exception) {
     966        DebugStream.printStackTrace(exception);
    988967        }
    989968        // Remove ourself from Gatherer list of threads.
Note: See TracChangeset for help on using the changeset viewer.