[tek-cvs] tek/client/proxy/proxyutils TEKCommands.java,1.50,1.51
Status: Beta
Brought to you by:
billthies
From: Bill T. <bil...@us...> - 2006-07-24 02:11:40
|
Update of /cvsroot/tek/tek/client/proxy/proxyutils In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv22011/proxy/proxyutils Modified Files: TEKCommands.java Log Message: For internationalization, use PrintWriter's configured with the appropriate character set rather then using raw PrintStream's. Index: TEKCommands.java =================================================================== RCS file: /cvsroot/tek/tek/client/proxy/proxyutils/TEKCommands.java,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- TEKCommands.java 14 Apr 2006 21:33:05 -0000 1.50 +++ TEKCommands.java 24 Jul 2006 02:11:36 -0000 1.51 @@ -18,8 +18,7 @@ package tek.client.proxy.proxyutils; -import java.io.File; -import java.io.PrintStream; +import java.io.*; import java.net.MalformedURLException; import java.net.NetworkInterface; import java.net.URL; @@ -124,7 +123,7 @@ * commands */ public static void executeCommand(String command, Hashtable fields, - PrintStream out, SessionLog log) { + PrintWriter out, SessionLog log) { String user = log.getUser(); if (command.equals(LOGIN)) @@ -214,7 +213,7 @@ return "window.location.replace('" + url + "');"; } - private static void help(String helpSubject, PrintStream out) { + private static void help(String helpSubject, PrintWriter out) { // some help scripts have customization by version if (helpSubject.equals("mainmenu")) { helpSubject = getDirPrefix() + "/" + helpSubject; @@ -241,7 +240,7 @@ String eaddress, String clientorg, String clientcountry, String regopsys, String regmodem, String regmemory, String reglanguage, String smtpserver, String sendquery, - PrintStream out) { + PrintWriter out) { // set some values so that we remember them String message = ""; // if wavemail or manual, put method in place of smtpserver @@ -354,8 +353,8 @@ * @effects : try different prepending strings to email account of client * such as smtp, outgoing, mail, smtpout, smtp.email, smtp.mail */ - private static void smtpPrepend(PrintStream out) { - PrintStream print = new PrintStream(out); + private static void smtpPrepend(PrintWriter out) { + PrintWriter print = new PrintWriter(out); File idFile = new File(ClientConstants.ClientIDFileName); // loads the queryloading.html when waiting to find correct smtp server try { @@ -433,7 +432,7 @@ * unsuccessful login, or redirects to a page if successfull */ private static void login(String user, String password, String mode, - PrintStream out) { + PrintWriter out) { if (password == null) password = ""; String loginStatus = UsersHandler.login(user, password); @@ -457,14 +456,14 @@ Display.internalError("ERROR IN TEKCOMMANDS"); } - private static void logout(SessionLog log, PrintStream out) { + private static void logout(SessionLog log, PrintWriter out) { out.println("<SCRIPT> document.cookie='" + SessionLog.DEFAULT + "';" + replace("http://tek/search.html") + "</SCRIPT>"); } /** command to delete queries that the client specified to delete */ private static void deleteOldQuery(String name, String type, - String dirName, String lastMod, String status, PrintStream out, + String dirName, String lastMod, String status, PrintWriter out, String user) { Display.debugMessage("deleteOldQuery: " + dirName); @@ -484,7 +483,7 @@ * 6.13.05 changed to allow for temp and pending files */ private static void processSearch(String terms, String not, String type, - String mode, Hashtable fields, PrintStream out, String user) { + String mode, Hashtable fields, PrintWriter out, String user) { if (terms != null) terms = terms.trim(); if (not != null) @@ -528,7 +527,7 @@ /** * @effects: creates the outgoing file */ - private static void createoutgoing(PrintStream out) { + private static void createoutgoing(PrintWriter out) { File f = new File(ClientConstants.OutgoingList); if (f.exists()) { f.delete(); @@ -575,7 +574,7 @@ * @effects: makes temp files into pending files. */ - private static int sendAll(PrintStream out, String mail) { + private static int sendAll(PrintWriter out, String mail) { deleteOutgoing(); boolean sent; Display.debugMessage("Set up search"); @@ -639,7 +638,7 @@ /** * deletes the outgoing file and redirects to another page */ - private static void deleteOutgoingAll(PrintStream out) { + private static void deleteOutgoingAll(PrintWriter out) { deleteOutgoing(); out.print("<SCRIPT> window.history.go(-2); </SCRIPT>"); } @@ -647,7 +646,7 @@ /** * @effects : makes all temp file into pending */ - private static void tempToPend(PrintStream out) { + private static void tempToPend(PrintWriter out) { File allUsers = new File(ProxyConstants.UsersDirectory + File.separator); File[] user = allUsers.listFiles(); for (int i = 0; i < user.length; i++) { @@ -672,7 +671,7 @@ } /** command to send the search */ - private static void sendSearch(String terms, PrintStream out, String user, + private static void sendSearch(String terms, PrintWriter out, String user, String notTerms) { QuerySearchHandler.sendSearch(user, terms, notTerms); Display.debugMessage("set up search"); @@ -685,7 +684,7 @@ * @effects: outputs a the editsearch button for temp queries */ - private static void editSearch(String terms, String mode, PrintStream out, + private static void editSearch(String terms, String mode, PrintWriter out, String user) { String output = ""; @@ -724,7 +723,7 @@ /** 6.20.05 changed to different edit mode * */ private static void refineSearch(String query, String type, String dirName, - String mode, PrintStream out, String user) { + String mode, PrintWriter out, String user) { String output = ""; if (mode.equals("bas")) { @@ -749,7 +748,7 @@ } /** command to delete the search */ - private static void deleteSearch(String terms, PrintStream out, String user) { + private static void deleteSearch(String terms, PrintWriter out, String user) { File tempFile = QuerySearchHandler.getSummaryFile(user, terms, true); try { tempFile.createNewFile(); @@ -768,7 +767,7 @@ * search.html */ private static void makeUrlRequest(String url, String from, - PrintStream out, String user) { + PrintWriter out, String user) { if (user == null) user = SessionLog.DEFAULT; @@ -817,9 +816,9 @@ /** command to delete urls */ /** 6.14.05 instead of using checkboxes, use main* */ - //private static void deleteUrls(Hashtable fields, PrintStream out, + //private static void deleteUrls(Hashtable fields, PrintWriter out, // String user) { - private static void deleteUrls(String http, PrintStream out, String user) { + private static void deleteUrls(String http, PrintWriter out, String user) { Vector urlsToDelete = new Vector(); urlsToDelete.add(URLDecoder.decode(http)); @@ -831,7 +830,7 @@ /** command to create a new user */ private static void createUser(String first, String last, String user, - String pass, String pass2, PrintStream out) { + String pass, String pass2, PrintWriter out) { int status = UsersHandler.getCreateUserStatus(first, last, user, pass, pass2); if (status == UsersHandler.SUCCESSFUL) { //if successful @@ -844,7 +843,7 @@ /** method to print the createUser errors */ private static void printUserError(String first, String last, String user, - int error, PrintStream out) { + int error, PrintWriter out) { String alert = ""; //diff types of errors if (error == UsersHandler.BLANK_FIELD) @@ -891,7 +890,7 @@ * goes to the url (in the query results list) and marks it old if it is new */ private static void goToUrl(String type, String mode, String url, - String dirName, PrintStream out, String user, String not) { + String dirName, PrintWriter out, String user, String not) { if (mode.equals("url")) { if (type.equals("new")) { QueryResultsHandler.putOldMarkerInUrl(user, type, url); @@ -938,7 +937,7 @@ * email or cannot find SMTP server; Exception for when cannot find * Network Interface */ - private static boolean adminSend(PrintStream out) { + private static boolean adminSend(PrintWriter out) { boolean sent; // message to user String message = ""; @@ -1024,7 +1023,7 @@ * Network Interface */ private static void SMTPAdminSend(String SMTPusername, String SMTPpassword, - String status, PrintStream out, String user) { + String status, PrintWriter out, String user) { Display.debug("status " + status + "name " + SMTPusername); if (status != null && Integer.parseInt(status) == 2) sendAll(out, "SMTP"); @@ -1076,7 +1075,7 @@ * @effects : deletes the id file so that if cancelled, it would look like * re-registering */ - private static void SMTPcancel(PrintStream out) { + private static void SMTPcancel(PrintWriter out) { File idfile = new File(ClientConstants.ClientIDFileName); idfile.delete(); deleteOutgoing(); @@ -1087,7 +1086,7 @@ * Restarts registration by deleting client id file and pointing browser to * main menu. */ - private static void restartRegister(PrintStream out) { + private static void restartRegister(PrintWriter out) { // File id = new File(ClientConstants.ClientIDFileName); // if (id.exists()) // id.delete(); @@ -1096,7 +1095,7 @@ } /** method to print the createUser errors */ - private static void printRegisterError(int error, PrintStream out) { + private static void printRegisterError(int error, PrintWriter out) { String alert = ""; //diff types of errors Display.debug("error " + error); @@ -1119,7 +1118,7 @@ /** command to register the client 7.21.05 * */ private static void registering(String eaddress, String clientcountry, String smtpserver, String othersmtpserver, String lang, - String sendquery, PrintStream out) { + String sendquery, PrintWriter out) { File id = new File(ClientConstants.ClientIDFileName); if (id.exists()) id.delete(); @@ -1179,7 +1178,7 @@ } - private static void SMTPregister(PrintStream out) { + private static void SMTPregister(PrintWriter out) { if (ClientConstants.UseWaveMail == false) { // get the list of candidate SMTP Servers Display.debugMessage("using SMTP sending message"); @@ -1243,7 +1242,7 @@ * @effects: prints out the language choices depending on if sirus or google * is used */ - private static void teklangchoices(PrintStream out) { + private static void teklangchoices(PrintWriter out) { Display.debugMessage("printing out language choices"); if (ClientConstants.isScirus()) out.println("<OPTION>English " + "<OPTION>Spanish " |