Changeset 8236 for trunk/gli/src/org/greenstone/gatherer/Gatherer.java
- Timestamp:
- 2004-10-08T09:46:12+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r8235 r8236 220 220 // 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. 221 221 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"); 224 224 missingEXEC(); 225 225 } 226 226 227 227 if (Gatherer.isGsdlRemote) { 228 Gatherer.println("Not checking for perl path/exe");228 DebugStream.println("Not checking for perl path/exe"); 229 229 } 230 230 else { … … 326 326 327 327 } 328 catch (Exception e rror) {329 error.printStackTrace();328 catch (Exception exception) { 329 DebugStream.printStackTrace(exception); 330 330 } 331 331 … … 472 472 String raw_url = Configuration.exec_address.toString() + command; 473 473 URL url = new URL(raw_url); 474 Gatherer.println("Action: " + raw_url);474 DebugStream.println("Action: " + raw_url); 475 475 HttpURLConnection library_connection = (HttpURLConnection) url.openConnection(); 476 476 int response_code = library_connection.getResponseCode(); 477 477 if(HttpURLConnection.HTTP_OK <= response_code && response_code < HttpURLConnection.HTTP_MULT_CHOICE) { 478 Gatherer.println("200 - Complete.");478 DebugStream.println("200 - Complete."); 479 479 } 480 480 else { 481 Gatherer.println("404 - Failed.");481 DebugStream.println("404 - Failed."); 482 482 } 483 483 url = null; 484 484 } 485 485 catch (Exception ex) { 486 ex.printStackTrace(); 487 Gatherer.printStackTrace(ex); 486 DebugStream.printStackTrace(ex); 488 487 } 489 488 } … … 496 495 String raw_url = Configuration.exec_address.toString() + Configuration.getServletPath() + command; 497 496 URL url = new URL(raw_url); 498 Gatherer.println("Action: " + raw_url);497 DebugStream.println("Action: " + raw_url); 499 498 HttpURLConnection library_connection = (HttpURLConnection) url.openConnection(); 500 499 int response_code = library_connection.getResponseCode(); 501 500 if(HttpURLConnection.HTTP_OK <= response_code && response_code < HttpURLConnection.HTTP_MULT_CHOICE) { 502 Gatherer.println("200 - Complete.");501 DebugStream.println("200 - Complete."); 503 502 } 504 503 else { 505 Gatherer.println("404 - Failed.");504 DebugStream.println("404 - Failed."); 506 505 } 507 506 url = null; 508 507 } 509 508 catch(Exception exception) { 510 Gatherer.printStackTrace(exception);509 DebugStream.printStackTrace(exception); 511 510 ///ystem.err.println("Bad URL."); 512 511 } … … 613 612 dialog = null; 614 613 } 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 634 615 635 616 /** Sets up the proxy connection by setting JVM Environment flags and creating a new Authenticator. … … 651 632 } 652 633 } 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); 655 636 } 656 637 } … … 695 676 } 696 677 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); 699 680 } 700 681 if (GS3) { 701 682 try { 702 683 servlet_config = new ServletConfiguration(gsdl3_path); 703 } catch (Exception e rror) {704 error.printStackTrace();684 } catch (Exception exception) { 685 DebugStream.printStackTrace(exception); 705 686 } 706 687 } … … 711 692 try { 712 693 Configuration.save(); 713 } catch (Exception e rror) {714 Gatherer.printStackTrace(error);694 } catch (Exception exception) { 695 DebugStream.printStackTrace(exception); 715 696 } 716 697 } … … 766 747 // 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. 767 748 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 + "'"); 769 750 URLConnection connection = Configuration.exec_address.openConnection(); 770 751 connection.getContent(); … … 772 753 catch(IOException bad_url_connection) { 773 754 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() + "'"); 775 756 Configuration.exec_address = new URL(gsdlsite_cfg.getLocalHostURL ()); 776 757 URLConnection connection = Configuration.exec_address.openConnection(); … … 778 759 } 779 760 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."); 781 762 Configuration.exec_address = null; 782 763 Configuration.exec_file = null; … … 789 770 } 790 771 } 791 catch (Exception e rror) {792 error.printStackTrace();772 catch (Exception exception) { 773 DebugStream.printStackTrace(exception); 793 774 } 794 775 } 795 776 // Can't do a damb thing. 796 777 } 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); 798 779 } 799 780 … … 827 808 //} 828 809 } 829 catch (Exception e rror) {830 error.printStackTrace();810 catch (Exception exception) { 811 DebugStream.printStackTrace(exception); 831 812 } 832 813 } … … 882 863 whole_command.append(" "); 883 864 } 884 println("Running " + whole_command.toString());865 DebugStream.println("Running " + whole_command.toString()); 885 866 Runtime rt = Runtime.getRuntime(); 886 867 process = rt.exec(commands); … … 888 869 } 889 870 else { 890 println("Running " + command);871 DebugStream.println("Running " + command); 891 872 Runtime rt = Runtime.getRuntime(); 892 873 process = rt.exec(command); … … 894 875 } 895 876 } 896 catch (Exception error) { 897 println("Error in ExternalApplication.run(): " + error); 898 printStackTrace(error); 877 catch (Exception exception) { 878 DebugStream.printStackTrace(exception); 899 879 } 900 880 // Remove ourself from Gatherer list of threads. … … 956 936 String lower_name = prog_name.toLowerCase(); 957 937 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"); 959 939 // mozilla and netscape, try using a remote command to get things in the same window 960 940 String [] new_commands = new String[] {prog_name, "-raise", "-remote", "openURL("+url+",new-tab)"}; … … 965 945 int exitCode = process.waitFor(); 966 946 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"); 968 948 printArray(commands); 969 949 process = rt.exec(commands); // try the original command … … 976 956 whole_command.append(" "); 977 957 } 978 println("Running " + whole_command.toString());958 DebugStream.println("Running " + whole_command.toString()); 979 959 Runtime rt = Runtime.getRuntime(); 980 960 process = rt.exec(commands); … … 983 963 } 984 964 985 catch (Exception error) { 986 println("Error in BrowserApplication.run(): " + error); 987 printStackTrace(error); 965 catch (Exception exception) { 966 DebugStream.printStackTrace(exception); 988 967 } 989 968 // Remove ourself from Gatherer list of threads.
Note:
See TracChangeset
for help on using the changeset viewer.