From 1468c657d8c3a9e7a0c161168c82fa59e9f49be3 Mon Sep 17 00:00:00 2001 From: Martin Oberhuber < martin.oberhuber@windriver.com> Date: Thu, 9 Nov 2006 11:30:28 +0000 Subject: [PATCH] [cleanup] fix NON-NLS-1 tags --- .../dstore/core/server/ServerLauncher.java | 87 +++++++++---------- .../miners/command/ProcessTracker.java | 44 +++++----- .../local/shells/LocalShellThread.java | 52 ++++++----- .../local/shells/LocalShellService.java | 22 ++--- 4 files changed, 101 insertions(+), 104 deletions(-) diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerLauncher.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerLauncher.java index b8afd84e821..5e3cb91dc95 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerLauncher.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerLauncher.java @@ -90,7 +90,7 @@ public class ServerLauncher extends Thread { _reader = new BufferedReader(new InputStreamReader(_socket .getInputStream(), DE.ENCODING_UTF_8)); } catch (java.io.IOException e) { - System.out.println("ServerLauncher:" + e); + System.out.println("ServerLauncher:" + e); //$NON-NLS-1$ } } @@ -135,11 +135,11 @@ public class ServerLauncher extends Thread { _serverProcess.waitFor(); } catch (Exception e) { - System.out.println("ServerLauncher:" + e); + System.out.println("ServerLauncher:" + e); //$NON-NLS-1$ } } - System.out.println("finished on port " + _port); + System.out.println("finished on port " + _port); //$NON-NLS-1$ _outReader = null; _errReader = null; _serverProcess = null; @@ -169,7 +169,7 @@ public class ServerLauncher extends Thread { private boolean isPortInRange(String portStr, String portRange) { if (portRange != null) { - String[] range = portRange.split("-"); + String[] range = portRange.split("-"); //$NON-NLS-1$ if (range.length == 2) { int lPort = 0; int hPort = 0; @@ -211,12 +211,12 @@ public class ServerLauncher extends Thread { catch (IOException e) { e.printStackTrace(); - _port = "0"; + _port = "0"; //$NON-NLS-1$ } - if (_serverPortRange != null && (_port == null || _port.equals("0"))) + if (_serverPortRange != null && (_port == null || _port.equals("0"))) //$NON-NLS-1$ { _port = _serverPortRange; } @@ -239,13 +239,13 @@ public class ServerLauncher extends Thread { try { String launchStatus = null; - String ticket = new String("" + System.currentTimeMillis()); + String ticket = new String("" + System.currentTimeMillis()); //$NON-NLS-1$ - String theOS = System.getProperty("os.name"); - String timeout = "120000"; + String theOS = System.getProperty("os.name"); //$NON-NLS-1$ + String timeout = "120000"; //$NON-NLS-1$ - if (!theOS.toLowerCase().startsWith("win")) + if (!theOS.toLowerCase().startsWith("win")) //$NON-NLS-1$ { // assuming unix compatable // @@ -253,7 +253,7 @@ public class ServerLauncher extends Thread { // contains the authorization // script path // - String authPath = System.getProperty("RSE.AUTH"); + String authPath = System.getProperty("RSE.AUTH"); //$NON-NLS-1$ File authFile = null; if (authPath != null && authPath.length() > 0) { @@ -261,26 +261,26 @@ public class ServerLauncher extends Thread { } if (authFile == null || !authFile.exists()) { - authPath = "perl " + _path + File.separator + "auth.pl"; + authPath = "perl " + _path + File.separator + "auth.pl"; //$NON-NLS-1$ //$NON-NLS-2$ } String authString = authPath - + " " + + " " //$NON-NLS-1$ + user - + " " + + " " //$NON-NLS-1$ + _path - + " " + + " " //$NON-NLS-1$ + _port - + " " + + " " //$NON-NLS-1$ + timeout - + " " + + " " //$NON-NLS-1$ + ticket + " " //$NON-NLS-1$ - + System.getProperty("java.home"); //$NON-NLS-1$ + + System.getProperty("java.home") //$NON-NLS-1$ ; - String[] authArray = { "sh", "-c", authString }; + String[] authArray = { "sh", "-c", authString }; //$NON-NLS-1$ //$NON-NLS-2$ // test password _serverProcess = Runtime.getRuntime().exec(authArray); @@ -301,9 +301,9 @@ public class ServerLauncher extends Thread { // launch new server String[] cmdArray = { - "java", - "-DA_PLUGIN_PATH=" + _path, - "org.eclipse.dstore.core.server.Server", + "java", //$NON-NLS-1$ + "-DA_PLUGIN_PATH=" + _path, //$NON-NLS-1$ + "org.eclipse.dstore.core.server.Server", //$NON-NLS-1$ _port, timeout, ticket}; @@ -312,10 +312,10 @@ public class ServerLauncher extends Thread { _outReader = new BufferedReader(new InputStreamReader(_serverProcess.getInputStream())); _errReader = new BufferedReader(new InputStreamReader(_serverProcess.getErrorStream())); - launchStatus = "success"; + launchStatus = "success"; //$NON-NLS-1$ } - if ((launchStatus == null) || !launchStatus.equals("success")) + if ((launchStatus == null) || !launchStatus.equals("success")) //$NON-NLS-1$ { _writer.println(IDataStoreConstants.AUTHENTICATION_FAILED); } @@ -341,7 +341,7 @@ public class ServerLauncher extends Thread { _writer.println(_port); _writer.println(ticket); - System.out.println("launched new server on " + _port); + System.out.println("launched new server on " + _port); //$NON-NLS-1$ connected = true; } else @@ -381,14 +381,14 @@ public class ServerLauncher extends Thread { } catch (IOException e) { - System.out.println("ServerLauncher:" + e); + System.out.println("ServerLauncher:" + e); //$NON-NLS-1$ } return connected; } public void handshakeCompleted(HandshakeCompletedEvent event) { - System.out.println("handshake completed"); + System.out.println("handshake completed"); //$NON-NLS-1$ System.out.println(event); } @@ -410,9 +410,9 @@ public class ServerLauncher extends Thread { * Constructor */ public ServerLauncher() { - String pluginPath = System.getProperty("A_PLUGIN_PATH"); + String pluginPath = System.getProperty("A_PLUGIN_PATH"); //$NON-NLS-1$ if (pluginPath == null) { - System.out.println("A_PLUGIN_PATH is not defined"); + System.out.println("A_PLUGIN_PATH is not defined"); //$NON-NLS-1$ System.exit(-1); } @@ -420,7 +420,7 @@ public class ServerLauncher extends Thread { _connections = new ArrayList(); - init(DEFAULT_DAEMON_PORT + ""); + init(DEFAULT_DAEMON_PORT + ""); //$NON-NLS-1$ } /** @@ -430,9 +430,9 @@ public class ServerLauncher extends Thread { * the port for the daemon socket to run on */ public ServerLauncher(String portStr) { - String pluginPath = System.getProperty("A_PLUGIN_PATH"); + String pluginPath = System.getProperty("A_PLUGIN_PATH"); //$NON-NLS-1$ if (pluginPath == null) { - System.out.println("A_PLUGIN_PATH is not defined"); + System.out.println("A_PLUGIN_PATH is not defined"); //$NON-NLS-1$ System.exit(-1); } @@ -451,9 +451,9 @@ public class ServerLauncher extends Thread { * the port range for launched servers */ public ServerLauncher(String portStr, String serverPortRange) { - String pluginPath = System.getProperty("A_PLUGIN_PATH"); + String pluginPath = System.getProperty("A_PLUGIN_PATH"); //$NON-NLS-1$ if (pluginPath == null) { - System.out.println("A_PLUGIN_PATH is not defined"); + System.out.println("A_PLUGIN_PATH is not defined"); //$NON-NLS-1$ System.exit(-1); } @@ -475,15 +475,14 @@ public class ServerLauncher extends Thread { /** * initializes the DataStore daemon * - * @param port - * the daemon port + * @param portStr the daemon port */ public void init(String portStr) { // create server socket from port _sslProperties = new ServerSSLProperties(); // determine if portStr is a port range or just a port - String[] range = portStr.split("-"); + String[] range = portStr.split("-"); //$NON-NLS-1$ if (range.length == 2) { int lPort = 0; int hPort = 0; @@ -517,9 +516,9 @@ public class ServerLauncher extends Thread { if (_serverSocket != null && _serverSocket.getLocalPort() > 0) { socketBound = true; - System.out.println("Daemon running on: " + System.out.println("Daemon running on: " //$NON-NLS-1$ + InetAddress.getLocalHost().getHostName() - + ", port: " + i); + + ", port: " + i); //$NON-NLS-1$ } } catch (UnknownHostException e) { System.err @@ -527,7 +526,7 @@ public class ServerLauncher extends Thread { e.printStackTrace(); System.exit(-1); } catch (BindException e) { - System.err.println("socket taken on " + i); + System.err.println("socket taken on " + i); //$NON-NLS-1$ // keep going } catch (IOException e) { System.err.println("Failure to create ServerSocket"); @@ -556,8 +555,8 @@ public class ServerLauncher extends Thread { } else { _serverSocket = new ServerSocket(port); } - System.out.println("Daemon running on: " - + InetAddress.getLocalHost().getHostName() + ", port: " + System.out.println("Daemon running on: " //$NON-NLS-1$ + + InetAddress.getLocalHost().getHostName() + ", port: " //$NON-NLS-1$ + port); } catch (UnknownHostException e) { System.err @@ -607,13 +606,13 @@ public class ServerLauncher extends Thread { public void handshakeCompleted( HandshakeCompletedEvent event) { - System.out.println("handshake completed"); + System.out.println("handshake completed"); //$NON-NLS-1$ } }); SSLSession session = sslSocket.getSession(); if (session == null) { - System.out.println("handshake failed"); + System.out.println("handshake failed"); //$NON-NLS-1$ sslSocket.close(); connectionOkay = false; diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/command/ProcessTracker.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/command/ProcessTracker.java index 89b751492e4..cac9debcf2e 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/command/ProcessTracker.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/command/ProcessTracker.java @@ -56,17 +56,17 @@ public class ProcessTracker extends Handler public String toString() { - String result = getPID() + " " + getCMD(); + String result = getPID() + " " + getCMD(); //$NON-NLS-1$ if (ProcessDescriptor.this == _newestProcess) { - result += " *"; + result += " *"; //$NON-NLS-1$ } return result; } public boolean hasCMD(String cmdname) { - StringTokenizer tokenizer = new StringTokenizer(_cmd, "/"); + StringTokenizer tokenizer = new StringTokenizer(_cmd, "/"); //$NON-NLS-1$ while (tokenizer.hasMoreTokens()) { @@ -117,28 +117,28 @@ public class ProcessTracker extends Handler private String getFormatOptions(String theOS) { - String formatOptions = ""; - if (theOS.startsWith("z")) + String formatOptions = ""; //$NON-NLS-1$ + if (theOS.startsWith("z")) //$NON-NLS-1$ { - formatOptions = "-o pid,comm"; + formatOptions = "-o pid,comm"; //$NON-NLS-1$ } - else if (theOS.startsWith("linux")) + else if (theOS.startsWith("linux")) //$NON-NLS-1$ { - formatOptions = "--format pid,ucomm"; + formatOptions = "--format pid,ucomm"; //$NON-NLS-1$ } - else if (theOS.startsWith("aix")) + else if (theOS.startsWith("aix")) //$NON-NLS-1$ { - formatOptions = "-F pid,ucomm"; + formatOptions = "-F pid,ucomm"; //$NON-NLS-1$ } return formatOptions; } private void init() { - String userID = System.getProperty("user.name"); - String userOptions = "-u " + userID; + String userID = System.getProperty("user.name"); //$NON-NLS-1$ + String userOptions = "-u " + userID; //$NON-NLS-1$ - String theOS = System.getProperty("os.name").toLowerCase(); + String theOS = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$ String formatOptions = getFormatOptions(theOS); if (formatOptions.length() == 0) { @@ -151,15 +151,15 @@ public class ProcessTracker extends Handler if (_isEnabled) { - _psCommand = "ps " + userOptions + " " + formatOptions; + _psCommand = "ps " + userOptions + " " + formatOptions; //$NON-NLS-1$ //$NON-NLS-2$ try { if (_psShell == null) { - _psShell = Runtime.getRuntime().exec("sh"); + _psShell = Runtime.getRuntime().exec("sh"); //$NON-NLS-1$ - String specialEncoding = System.getProperty("dstore.stdin.encoding"); + String specialEncoding = System.getProperty("dstore.stdin.encoding"); //$NON-NLS-1$ if (specialEncoding != null) { _psReader = new BufferedReader(new InputStreamReader(_psShell.getInputStream(), specialEncoding)); @@ -255,7 +255,7 @@ public class ProcessTracker extends Handler try { _psWriter.write(_psCommand); - _psWriter.write("\n"); + _psWriter.write("\n"); //$NON-NLS-1$ _psWriter.flush(); // skip first line @@ -271,7 +271,7 @@ public class ProcessTracker extends Handler String pid = line.substring(0, firstBlank); String cmd = line.substring(firstBlank + 1, line.length()); ProcessDescriptor descriptor = new ProcessDescriptor(pid, cmd); - if (!descriptor.hasCMD("ps")) + if (!descriptor.hasCMD("ps")) //$NON-NLS-1$ { newPIDs.add(descriptor); } @@ -333,8 +333,8 @@ public class ProcessTracker extends Handler { try { - _psWriter.write("exit"); - _psWriter.write("\n"); + _psWriter.write("exit"); //$NON-NLS-1$ + _psWriter.write("\n"); //$NON-NLS-1$ _psWriter.flush(); _psReader.close(); @@ -392,8 +392,8 @@ public class ProcessTracker extends Handler { try { - _psWriter.write("kill " + descriptor.getPID()); - _psWriter.write("\n"); + _psWriter.write("kill " + descriptor.getPID()); //$NON-NLS-1$ + _psWriter.write("\n"); //$NON-NLS-1$ _psWriter.flush(); _psReader.reset(); } diff --git a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/shells/LocalShellThread.java b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/shells/LocalShellThread.java index 4e9b1fe9aa4..8eb6dd9800f 100644 --- a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/shells/LocalShellThread.java +++ b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/shells/LocalShellThread.java @@ -60,11 +60,9 @@ public class LocalShellThread extends Thread /** * consturtor for local command shell monitor - * @param fileSubSystem associated local file subsystem * @param cwd initial working directory * @param invocation launch shell command * @param encoding - * @param patterns patterns file for output interpretation * @param envVars user and system environment variables to launch shell with */ public LocalShellThread(String cwd, String invocation, String encoding, String[] envVars) @@ -79,7 +77,7 @@ public class LocalShellThread extends Thread // then the rse.pty property will have been set // by the contributor of the pty exectuable // on linux client this is a likely scenario - PSEUDO_TERMINAL = System.getProperty("rse.pty"); + PSEUDO_TERMINAL = System.getProperty("rse.pty"); //$NON-NLS-1$ try { PSEUDO_TERMINAL = Platform.resolve(new URL(PSEUDO_TERMINAL)).getPath(); @@ -130,8 +128,8 @@ public class LocalShellThread extends Thread File theDirectory = new File(_cwd); if (!theDirectory.isDirectory()) theDirectory = theDirectory.getParentFile(); - String theOS = System.getProperty("os.name"); - _isWindows = theOS.toLowerCase().startsWith("win"); + String theOS = System.getProperty("os.name"); //$NON-NLS-1$ + _isWindows = theOS.toLowerCase().startsWith("win"); //$NON-NLS-1$ _isTTY = PSEUDO_TERMINAL != null && (new File(PSEUDO_TERMINAL).exists()); String theShell = null; @@ -142,7 +140,7 @@ public class LocalShellThread extends Thread if (theShell == null) { - String property = "SHELL="; + String property = "SHELL="; //$NON-NLS-1$ for (int i = 0; i < envVars.length; i++) { @@ -151,9 +149,9 @@ public class LocalShellThread extends Thread { theShell = var.substring(property.length(), var.length()); - if (theShell.endsWith("bash")) + if (theShell.endsWith("bash")) //$NON-NLS-1$ { - theShell = "sh"; + theShell = "sh"; //$NON-NLS-1$ } } @@ -161,13 +159,13 @@ public class LocalShellThread extends Thread if (theShell == null) { - theShell = "sh"; + theShell = "sh"; //$NON-NLS-1$ } if (_isTTY) { - if (_invocation.equals(">")) + if (_invocation.equals(">")) //$NON-NLS-1$ { _invocation = theShell; _isShell = true; @@ -181,7 +179,7 @@ public class LocalShellThread extends Thread } else { - if (_invocation.equals(">")) + if (_invocation.equals(">")) //$NON-NLS-1$ { _invocation = theShell; _isShell = true; @@ -197,7 +195,7 @@ public class LocalShellThread extends Thread { if (_isTTY) { - if (_invocation.equals(">")) + if (_invocation.equals(">")) //$NON-NLS-1$ { _invocation = theShell; _isShell = true; @@ -206,14 +204,14 @@ public class LocalShellThread extends Thread String args[] = new String[4]; args[0] = PSEUDO_TERMINAL; args[1] = theShell; - args[2] = "-c"; + args[2] = "-c"; //$NON-NLS-1$ args[3] = _invocation; _theProcess = Runtime.getRuntime().exec(args, envVars, theDirectory); } else { - if (_invocation.equals(">")) + if (_invocation.equals(">")) //$NON-NLS-1$ { _invocation = theShell; _isShell = true; @@ -221,7 +219,7 @@ public class LocalShellThread extends Thread String args[] = new String[3]; args[0] = theShell; - args[1] = "-c"; + args[1] = "-c"; //$NON-NLS-1$ args[2] = _invocation; _theProcess = Runtime.getRuntime().exec(args, envVars, theDirectory); @@ -232,28 +230,28 @@ public class LocalShellThread extends Thread else { String[] envVars = getEnvironmentVariables(true); - if ((theOS.indexOf("95") >= 0) || (theOS.indexOf("98") >= 0) || (theOS.indexOf("ME") >= 0)) + if ((theOS.indexOf("95") >= 0) || (theOS.indexOf("98") >= 0) || (theOS.indexOf("ME") >= 0)) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ { - theShell = "start"; + theShell = "start"; //$NON-NLS-1$ } else { - theShell = "cmd"; + theShell = "cmd"; //$NON-NLS-1$ } - if (_invocation.equals(">")) + if (_invocation.equals(">")) //$NON-NLS-1$ { _invocation = theShell; _isShell = true; } - if (theShell.equals("start")) + if (theShell.equals("start")) //$NON-NLS-1$ { - theShell += " /B "; + theShell += " /B "; //$NON-NLS-1$ } else { - theShell += " /C "; + theShell += " /C "; //$NON-NLS-1$ } _theProcess = Runtime.getRuntime().exec(theShell + _invocation, envVars, theDirectory); @@ -277,7 +275,7 @@ public class LocalShellThread extends Thread { if (_encoding == null || _encoding.length() == 0) { - _encoding = System.getProperty("file.encoding"); + _encoding = System.getProperty("file.encoding"); //$NON-NLS-1$ } } } @@ -309,7 +307,7 @@ public class LocalShellThread extends Thread try { - writer.write("echo $PWD'>'"); + writer.write("echo $PWD'>'"); //$NON-NLS-1$ writer.write('\n'); writer.flush(); } @@ -455,7 +453,7 @@ public class LocalShellThread extends Thread { if (_isShell) { - sendInput("exit"); + sendInput("exit"); //$NON-NLS-1$ } _isDone = true; @@ -504,7 +502,7 @@ public class LocalShellThread extends Thread for (int i = 0; i < vars.length; i++) { String var = vars[i].toUpperCase(); - if (var.startsWith("PATH=")) + if (var.startsWith("PATH=")) //$NON-NLS-1$ { return var; } @@ -528,7 +526,7 @@ public class LocalShellThread extends Thread String[] newEnv = new String[_envVars.length + 1]; for (int i = 0; i < _envVars.length; i++) newEnv[i] = _envVars[i]; - newEnv[_envVars.length] = "PS1=$PWD/>"; + newEnv[_envVars.length] = "PS1=$PWD/>"; //$NON-NLS-1$ _envVars = newEnv; } return _envVars; diff --git a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/shells/LocalShellService.java b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/shells/LocalShellService.java index afe9ac05772..86e425ffa40 100644 --- a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/shells/LocalShellService.java +++ b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/shells/LocalShellService.java @@ -31,7 +31,7 @@ import org.eclipse.rse.services.shells.IShellService; public class LocalShellService implements IShellService, ILocalService { - private static final String SHELL_INVOCATION = ">"; + private static final String SHELL_INVOCATION = ">"; //$NON-NLS-1$ private String[] _envVars; public LocalShellService() @@ -50,7 +50,7 @@ public class LocalShellService implements IShellService, ILocalService public IHostShell launchShell(IProgressMonitor monitor, String initialWorkingDirectory, String[] environment) { - String defaultEncoding = System.getProperty("file.encoding"); + String defaultEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$ return launchShell(monitor, initialWorkingDirectory, defaultEncoding, environment); } @@ -63,7 +63,7 @@ public class LocalShellService implements IShellService, ILocalService public IHostShell runCommand(IProgressMonitor monitor, String initialWorkingDirectory, String command, String[] environment) { - String defaultEncoding = System.getProperty("file.encoding"); + String defaultEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$ return runCommand(monitor, initialWorkingDirectory, command, defaultEncoding, environment); } @@ -82,17 +82,17 @@ public class LocalShellService implements IShellService, ILocalService String[] envCommand = new String[3]; //If we're on windows, change the envCommand. - if (System.getProperty("os.name").toLowerCase().startsWith("win")) + if (System.getProperty("os.name").toLowerCase().startsWith("win")) //$NON-NLS-1$ //$NON-NLS-2$ { - envCommand[0] = "cmd"; - envCommand[1] = "/c"; - envCommand[2] = "set"; + envCommand[0] = "cmd"; //$NON-NLS-1$ + envCommand[1] = "/c"; //$NON-NLS-1$ + envCommand[2] = "set"; //$NON-NLS-1$ } else { - envCommand[0] = "sh"; - envCommand[1] = "-c"; - envCommand[2] = "env"; + envCommand[0] = "sh"; //$NON-NLS-1$ + envCommand[1] = "-c"; //$NON-NLS-1$ + envCommand[2] = "env"; //$NON-NLS-1$ } BufferedReader reader = null; @@ -106,7 +106,7 @@ public class LocalShellService implements IShellService, ILocalService String curLine = null; while ((curLine = reader.readLine()) != null) { - if (curLine.indexOf("=") > 0) + if (curLine.indexOf("=") > 0) //$NON-NLS-1$ { envVars.add(curLine); }