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 8eb6dd9800f..0aaa675089f 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 @@ -137,7 +137,7 @@ public class LocalShellThread extends Thread if (!_isWindows) { String[] envVars = getEnvironmentVariables(false); - if (theShell == null) + { String property = "SHELL="; //$NON-NLS-1$ @@ -191,41 +191,7 @@ public class LocalShellThread extends Thread _theProcess = Runtime.getRuntime().exec(args[0], envVars, theDirectory); } } - else - { - if (_isTTY) - { - if (_invocation.equals(">")) //$NON-NLS-1$ - { - _invocation = theShell; - _isShell = true; - } - - String args[] = new String[4]; - args[0] = PSEUDO_TERMINAL; - args[1] = theShell; - args[2] = "-c"; //$NON-NLS-1$ - args[3] = _invocation; - - _theProcess = Runtime.getRuntime().exec(args, envVars, theDirectory); - } - else - { - if (_invocation.equals(">")) //$NON-NLS-1$ - { - _invocation = theShell; - _isShell = true; - } - - String args[] = new String[3]; - args[0] = theShell; - args[1] = "-c"; //$NON-NLS-1$ - args[2] = _invocation; - - _theProcess = Runtime.getRuntime().exec(args, envVars, theDirectory); - } - - } + } else { @@ -353,7 +319,6 @@ public class LocalShellThread extends Thread { if (!_isDone) { - byte[] intoout = input.getBytes(); OutputStream output = _theProcess.getOutputStream(); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output)); @@ -464,7 +429,7 @@ public class LocalShellThread extends Thread if (_theProcess != null) { - int exitcode; + try { if (_isCancelled) @@ -473,13 +438,12 @@ public class LocalShellThread extends Thread } else { - exitcode = _theProcess.exitValue(); + _theProcess.exitValue(); } } catch (IllegalThreadStateException e) { //e.printStackTrace(); - exitcode = -1; _theProcess.destroy(); } _theProcess = null; diff --git a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/Activator.java b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/Activator.java index 883ed38e288..0b737ea6473 100644 --- a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/Activator.java +++ b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/Activator.java @@ -66,7 +66,7 @@ public class Activator extends Plugin { public void logException(Throwable t) { ILog log = getLog(); String id = getBundle().getSymbolicName(); - IStatus status = new Status(IStatus.ERROR, id, 0, "Unexpected exception", t); + IStatus status = new Status(IStatus.ERROR, id, 0, "Unexpected exception", t); //$NON-NLS-1$ log.log(status); } } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/processes/LocalProcessService.java b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/processes/LocalProcessService.java index 7806c1a88aa..a415653f1de 100644 --- a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/processes/LocalProcessService.java +++ b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/processes/LocalProcessService.java @@ -64,7 +64,7 @@ public class LocalProcessService extends AbstractProcessService implements ILoca } catch (Exception e) { - throw new SystemMessageException(getMessage("RSEPG1301")); + throw new SystemMessageException(getMessage("RSEPG1301")); //$NON-NLS-1$ } return processes; } @@ -86,17 +86,17 @@ public class LocalProcessService extends AbstractProcessService implements ILoca } catch (InterruptedException e) { - throw new SystemMessageException(getMessage("RSEG1067")); + throw new SystemMessageException(getMessage("RSEG1067")); //$NON-NLS-1$ } catch (Exception e) { - String name = ""; + String name = ""; //$NON-NLS-1$ if (process != null) name += process.getName(); - String pid = ""; + String pid = ""; //$NON-NLS-1$ if (process != null) pid += process.getPid(); - SystemMessage msg = getMessage("RSEPG1300"); - msg.makeSubstitution(name + " (" + pid + ")", e.getMessage()); + SystemMessage msg = getMessage("RSEPG1300"); //$NON-NLS-1$ + msg.makeSubstitution(name + " (" + pid + ")", e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ throw new SystemMessageException(msg); } } @@ -124,22 +124,21 @@ public class LocalProcessService extends AbstractProcessService implements ILoca try { // use the kill command to find out the signal types - Process kill = Runtime.getRuntime().exec("kill -l"); + Process kill = Runtime.getRuntime().exec("kill -l"); //$NON-NLS-1$ InputStreamReader isr = new InputStreamReader(kill.getInputStream()); - if (isr == null) return null; BufferedReader reader = new BufferedReader(isr); - if (reader == null) return null; + String nextLine = reader.readLine(); - String output = ""; + String output = ""; //$NON-NLS-1$ while (nextLine != null) { - output = output + nextLine + "\n"; + output = output + nextLine + "\n"; //$NON-NLS-1$ nextLine = reader.readLine(); } reader.close(); isr.close(); - if (output.equals("")) throw new Exception(); - String[] lines = output.trim().split("\\s+"); + if (output.equals("")) throw new Exception(); //$NON-NLS-1$ + String[] lines = output.trim().split("\\s+"); //$NON-NLS-1$ if (lines == null) throw new Exception(); return lines; } diff --git a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/search/LocalSearchHandler.java b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/search/LocalSearchHandler.java index 6de584f1205..e0ee80aa974 100644 --- a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/search/LocalSearchHandler.java +++ b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/search/LocalSearchHandler.java @@ -235,7 +235,7 @@ public class LocalSearchHandler implements ISearchHandler // if it is not a file search, then call the handler search // method - if (!_isFileSearch) + if (!_isFileSearch && vc != null) { matches = vc.getHandler().search(vc.fullName, _stringMatcher); IHostSearchResult[] results = convert(file, matches); @@ -469,7 +469,7 @@ public class LocalSearchHandler implements ISearchHandler protected boolean doesClassificationMatch(String absolutePath) { - if (_classificationString == null || _classificationString.equals("")) + if (_classificationString == null || _classificationString.equals("")) //$NON-NLS-1$ { return true; } diff --git a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/shells/LocalHostShell.java b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/shells/LocalHostShell.java index c18bb81d65b..6440ac5d6e0 100644 --- a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/shells/LocalHostShell.java +++ b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/shells/LocalHostShell.java @@ -74,7 +74,7 @@ public class LocalHostShell extends AbstractHostShell implements IHostShell public void exit() { - writeToShell("exit"); + writeToShell("exit"); //$NON-NLS-1$ } diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/IServiceConstants.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/IServiceConstants.java index 5101d2f23e7..9a935018210 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/IServiceConstants.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/IServiceConstants.java @@ -21,14 +21,14 @@ public interface IServiceConstants public static final String TOKEN_SEPARATOR = "|"; //$NON-NLS-1$ // Unexpected Error - public static final String UNEXPECTED_ERROR = "unexpectedError"; + public static final String UNEXPECTED_ERROR = "unexpectedError"; //$NON-NLS-1$ // Failure strings - public static final String FAILED_WITH_EXIST = "failed with exist"; - public static final String FAILED_WITH_DOES_NOT_EXIST = "failed with does not exist"; - public static final String FAILED_WITH_EXCEPTION = "failed with exception"; - public static final String FAILED_WITH_SECURITY = "failed with security"; - public static final String FAILED_TO_DELETE_DIR = "failed to delete directory"; + public static final String FAILED_WITH_EXIST = "failed with exist"; //$NON-NLS-1$ + public static final String FAILED_WITH_DOES_NOT_EXIST = "failed with does not exist"; //$NON-NLS-1$ + public static final String FAILED_WITH_EXCEPTION = "failed with exception"; //$NON-NLS-1$ + public static final String FAILED_WITH_SECURITY = "failed with security"; //$NON-NLS-1$ + public static final String FAILED_TO_DELETE_DIR = "failed to delete directory"; //$NON-NLS-1$ // Status strings for communication public static final String SUCCESS = "success"; //$NON-NLS-1$ diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/NamePatternMatcher.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/NamePatternMatcher.java index 2db11c68f4e..18deb500127 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/NamePatternMatcher.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/NamePatternMatcher.java @@ -178,7 +178,7 @@ public class NamePatternMatcher implements IMatcher genericName = "*"; //$NON-NLS-1$ int len = 0; // determine if given a null name - if ((genericName == null) || (genericName.length()==0)) + if (genericName.length()==0) validName = false; else validName = true; // for now diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemEncodingUtil.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemEncodingUtil.java index 5a7b8f47e6e..137cc4fd7e6 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemEncodingUtil.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemEncodingUtil.java @@ -137,6 +137,7 @@ public class SystemEncodingUtil { // determine which of UCS-4 or other supported 32-bit encodings applies. // UCS-4, big-endian order (1234 order) + /* DKM - encodingGuess can only be null else if (temp[0] == 0x00 && temp[1] == 0x00 && temp[2] == 0x00 && temp[3] == 0x3C) { encodingGuess = null; } @@ -152,7 +153,7 @@ public class SystemEncodingUtil { else if (temp[0] == 0x00 && temp[1] == 0x3C && temp[2] == 0x00 && temp[3] == 0x00) { encodingGuess = null; } - + */ // UTF-16BE or big-endian ISO-10646-UCS-2 or other encoding with a 16-bit code unit // in big-endian order and ASCII characters encoded as ASCII values (the encoding @@ -311,9 +312,7 @@ public class SystemEncodingUtil { line = bufReader.readLine(); } - if (bufReader != null) { - bufReader.close(); - } + bufReader.close(); // if the encoding declaration was not found if (encoding == null) { diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/AbsoluteVirtualPath.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/AbsoluteVirtualPath.java index 8519cb4feed..d101f62c05c 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/AbsoluteVirtualPath.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/AbsoluteVirtualPath.java @@ -48,7 +48,7 @@ public class AbsoluteVirtualPath { // no more nesting, this is the actual container archive. _absVirtualPath = absolutePath; // fix for defect 51898 and related defects - _virtualPart = ""; + _virtualPart = ""; //$NON-NLS-1$ _realPartName = _absVirtualPath; _realPart = this; _isVirtual = false; @@ -112,7 +112,7 @@ public class AbsoluteVirtualPath public void setVirtualPart(String newVirtualPart) { _virtualPart = newVirtualPart; - if (newVirtualPart == "") + if (newVirtualPart == "") //$NON-NLS-1$ { int i = _absVirtualPath.lastIndexOf(ArchiveHandlerManager.VIRTUAL_SEPARATOR); _absVirtualPath = _absVirtualPath.substring(0, i); @@ -126,12 +126,12 @@ public class AbsoluteVirtualPath public String getName() { - return _absVirtualPath.substring(_absVirtualPath.lastIndexOf("/") + 1); + return _absVirtualPath.substring(_absVirtualPath.lastIndexOf("/") + 1); //$NON-NLS-1$ } public String getPath() { - String path = _absVirtualPath.substring(0, _absVirtualPath.lastIndexOf("/")); + String path = _absVirtualPath.substring(0, _absVirtualPath.lastIndexOf("/")); //$NON-NLS-1$ return path; } diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/ArchiveHandlerManager.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/ArchiveHandlerManager.java index d51afe4e820..a67cca01c33 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/ArchiveHandlerManager.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/ArchiveHandlerManager.java @@ -32,8 +32,8 @@ import java.util.HashMap; public class ArchiveHandlerManager { // The string that separates the virtual part of an absolute path from the real part - public static final String VIRTUAL_SEPARATOR = "#virtual#/"; - public static final String VIRTUAL_CANONICAL_SEPARATOR = "#virtual#"; + public static final String VIRTUAL_SEPARATOR = "#virtual#/"; //$NON-NLS-1$ + public static final String VIRTUAL_CANONICAL_SEPARATOR = "#virtual#"; //$NON-NLS-1$ // the singleton instance protected static ArchiveHandlerManager _instance = new ArchiveHandlerManager(); @@ -72,7 +72,7 @@ public class ArchiveHandlerManager */ public VirtualChild[] getContents(File file, String virtualpath) throws IOException { - if (virtualpath == null) virtualpath = ""; + if (virtualpath == null) virtualpath = ""; //$NON-NLS-1$ ISystemArchiveHandler handler = getRegisteredHandler(file); if (handler == null || !handler.exists()) throw new IOException(); return handler.getVirtualChildren(virtualpath); @@ -90,7 +90,7 @@ public class ArchiveHandlerManager */ public VirtualChild[] getFolderContents(File file, String virtualpath) { - if (virtualpath == null) virtualpath = ""; + if (virtualpath == null) virtualpath = ""; //$NON-NLS-1$ ISystemArchiveHandler handler = getRegisteredHandler(file); if (handler == null) return null; return handler.getVirtualChildFolders(virtualpath); @@ -148,8 +148,8 @@ public class ArchiveHandlerManager protected String getExtension(File file) { String filename = file.getName(); - int i = filename.lastIndexOf("."); - if (i == -1) return ""; + int i = filename.lastIndexOf("."); //$NON-NLS-1$ + if (i == -1) return ""; //$NON-NLS-1$ return filename.substring(i+1).toLowerCase(); } @@ -161,8 +161,8 @@ public class ArchiveHandlerManager */ protected String getExtension(String filename) { - int i = filename.lastIndexOf("."); - if (i == -1) return ""; + int i = filename.lastIndexOf("."); //$NON-NLS-1$ + if (i == -1) return ""; //$NON-NLS-1$ return filename.substring(i+1).toLowerCase(); } @@ -178,7 +178,7 @@ public class ArchiveHandlerManager { String cleanName = cleanUpVirtualPath(fullyQualifiedName); AbsoluteVirtualPath avp = new AbsoluteVirtualPath(cleanName); - if (!avp.isVirtual()) return new VirtualChild("", new File(avp.getContainingArchiveString())); + if (!avp.isVirtual()) return new VirtualChild("", new File(avp.getContainingArchiveString())); //$NON-NLS-1$ String zipfile = avp.getContainingArchiveString(); File file = new File(zipfile); ISystemArchiveHandler handler = getRegisteredHandler(file); @@ -227,14 +227,14 @@ public class ArchiveHandlerManager //Throwable target = e.getCause(); System.out.println(e.getMessage()); e.printStackTrace(); - System.out.println("Could not instantiate handler for " + file.getName()); + System.out.println("Could not instantiate handler for " + file.getName()); //$NON-NLS-1$ return null; } catch (Exception e) { System.out.println(e.getMessage()); - System.out.println("Could not instantiate handler for " + file.getName()); + System.out.println("Could not instantiate handler for " + file.getName()); //$NON-NLS-1$ return null; } _handlers.put(file, handler); @@ -272,8 +272,8 @@ public class ArchiveHandlerManager { if (!handlerHasProperConstructor(handlerType)) { - System.out.println("Cannot register archive handler " + handlerType); - System.out.println(handlerType + " does not contain a constructor whose signature is 'Constructor(File file)'"); + System.out.println("Cannot register archive handler " + handlerType); //$NON-NLS-1$ + System.out.println(handlerType + " does not contain a constructor whose signature is 'Constructor(File file)'"); //$NON-NLS-1$ return false; } if (handlerImplementsISystemArchiveHandler(handlerType)) @@ -284,8 +284,8 @@ public class ArchiveHandlerManager } else { - System.out.println("Cannot register archive handler " + handlerType); - System.out.println("Neither " + handlerType + ", nor any of its superclasses implements ISystemArchiveHandler."); + System.out.println("Cannot register archive handler " + handlerType); //$NON-NLS-1$ + System.out.println("Neither " + handlerType + ", nor any of its superclasses implements ISystemArchiveHandler."); //$NON-NLS-1$ //$NON-NLS-2$ return false; } } @@ -361,8 +361,8 @@ public class ArchiveHandlerManager public static String cleanUpVirtualPath(String fullVirtualName) { int j = fullVirtualName.indexOf(VIRTUAL_CANONICAL_SEPARATOR); - if (j == -1 && fullVirtualName.indexOf(":") != -1) return fullVirtualName; - String realPart = ""; + if (j == -1 && fullVirtualName.indexOf(":") != -1) return fullVirtualName; //$NON-NLS-1$ + String realPart = ""; //$NON-NLS-1$ String newPath = fullVirtualName; if (j != -1) { @@ -373,16 +373,16 @@ public class ArchiveHandlerManager newPath = newPath.replace('\\', '/'); //get rid of any double slashes - int i = newPath.indexOf("//"); + int i = newPath.indexOf("//"); //$NON-NLS-1$ while (i != -1) { newPath = newPath.substring(0,i) + newPath.substring(i+1); - i = newPath.indexOf("//"); + i = newPath.indexOf("//"); //$NON-NLS-1$ } // get rid of any leading or trailing slashes - if (j != -1 && newPath.startsWith("/")) newPath = newPath.substring(1); - if (newPath.endsWith("/")) newPath = newPath.substring(0, newPath.length() - 1); + if (j != -1 && newPath.startsWith("/")) newPath = newPath.substring(1); //$NON-NLS-1$ + if (newPath.endsWith("/")) newPath = newPath.substring(0, newPath.length() - 1); //$NON-NLS-1$ return realPart + newPath; } @@ -398,8 +398,8 @@ public class ArchiveHandlerManager { if (!isRegisteredArchive(newFile.getName())) { - System.out.println("Could not create new archive."); - System.out.println(newFile + " is not a registered type of archive."); + System.out.println("Could not create new archive."); //$NON-NLS-1$ + System.out.println(newFile + " is not a registered type of archive."); //$NON-NLS-1$ return false; } @@ -407,14 +407,14 @@ public class ArchiveHandlerManager { if (!newFile.isFile()) { - System.out.println("Could not create new archive."); - System.out.println(newFile + " is not a file."); + System.out.println("Could not create new archive."); //$NON-NLS-1$ + System.out.println(newFile + " is not a file."); //$NON-NLS-1$ return false; } if (!newFile.delete()) { - System.out.println("Could not create new archive."); - System.out.println(newFile + " could not be deleted."); + System.out.println("Could not create new archive."); //$NON-NLS-1$ + System.out.println(newFile + " could not be deleted."); //$NON-NLS-1$ return false; } } @@ -423,14 +423,14 @@ public class ArchiveHandlerManager { if (!newFile.createNewFile()) { - System.out.println("Could not create new archive."); - System.out.println(newFile + " could not be created."); + System.out.println("Could not create new archive."); //$NON-NLS-1$ + System.out.println(newFile + " could not be created."); //$NON-NLS-1$ return false; } } catch (IOException e) { - System.out.println("Could not create new archive."); + System.out.println("Could not create new archive."); //$NON-NLS-1$ System.out.println(e.getMessage()); return false; } @@ -457,7 +457,7 @@ public class ArchiveHandlerManager public String getComment(File archive) { ISystemArchiveHandler handler = getRegisteredHandler(archive); - if (handler == null || !handler.exists()) return ""; + if (handler == null || !handler.exists()) return ""; //$NON-NLS-1$ return handler.getArchiveComment(); } diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/ISystemArchiveHandlerConstants.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/ISystemArchiveHandlerConstants.java index 0091603918c..c945954d23e 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/ISystemArchiveHandlerConstants.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/ISystemArchiveHandlerConstants.java @@ -24,15 +24,15 @@ public interface ISystemArchiveHandlerConstants { /** * Zip archive extension, "zip". */ - public static final String ZIP_ARCHIVE_EXTENSION = "zip"; + public static final String ZIP_ARCHIVE_EXTENSION = "zip"; //$NON-NLS-1$ /** * Jar archive extension, "jar". */ - public static final String JAR_ARCHIVE_EXTENSION = "jar"; + public static final String JAR_ARCHIVE_EXTENSION = "jar"; //$NON-NLS-1$ /** * Tar archive extension, "tar". */ - public static final String TAR_ARCHIVE_EXTENSION = "tar"; + public static final String TAR_ARCHIVE_EXTENSION = "tar"; //$NON-NLS-1$ } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemTarHandler.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemTarHandler.java index 5c71200a163..4955427430d 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemTarHandler.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemTarHandler.java @@ -91,17 +91,17 @@ public class SystemTarHandler implements ISystemArchiveHandler { VirtualFileNode parentNode = rootNode; - int idx = path.indexOf("/"); + int idx = path.indexOf("/"); //$NON-NLS-1$ String name = path; - String segPath = ""; + String segPath = ""; //$NON-NLS-1$ // ensure each segment exists or is created if it does not exist while (idx > 0) { name = path.substring(0, idx); path = path.substring(idx+1); - segPath = segPath + name + "/"; + segPath = segPath + name + "/"; //$NON-NLS-1$ boolean exists = parentNode.childExists(name); @@ -115,7 +115,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { // the new parent is the child (which may have been created) parentNode = parentNode.getChild(name); - idx = path.indexOf("/"); + idx = path.indexOf("/"); //$NON-NLS-1$ } parentNode.addChild(path, new VirtualFileNode(entry), replace); @@ -291,7 +291,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { */ private VirtualFileNode getNode(String path) { - if (path.equals("")) { + if (path.equals("")) { //$NON-NLS-1$ return rootNode; } @@ -667,7 +667,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { // only add those entries that have names that begin with the parent name // also check that the entry name isn't just the parent name + '/' (i.e. still the same // as the parent) - if (entry.getName().startsWith(parent) && !entry.getName().equals(parent + "/")) { + if (entry.getName().startsWith(parent) && !entry.getName().equals(parent + "/")) { //$NON-NLS-1$ VirtualChild child = new VirtualChild(this, entry.getName()); child.isDirectory = entry.isDirectory(); v.add(child); @@ -726,7 +726,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName); - if (fullVirtualName == null || fullVirtualName.equals("")) { + if (fullVirtualName == null || fullVirtualName.equals("")) { //$NON-NLS-1$ return new VirtualChild(this); } @@ -756,7 +756,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName); - if (fullVirtualName == null || fullVirtualName.equals("")) { + if (fullVirtualName == null || fullVirtualName.equals("")) { //$NON-NLS-1$ return false; } @@ -949,7 +949,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { if (destination == null) { - if (fullVirtualName.equals("")) { + if (fullVirtualName.equals("")) { //$NON-NLS-1$ destination = destinationParent; } else { @@ -1011,8 +1011,8 @@ public class SystemTarHandler implements ISystemArchiveHandler { if (!file.isDirectory()) { // if it exists, call replace - if (exists(virtualPath + "/" + name)) { - return replace(virtualPath + "/" + name, file, name); + if (exists(virtualPath + "/" + name)) { //$NON-NLS-1$ + return replace(virtualPath + "/" + name, file, name); //$NON-NLS-1$ } else { File[] files = new File[1]; @@ -1035,16 +1035,16 @@ public class SystemTarHandler implements ISystemArchiveHandler { newNames[i] = sources[i].getAbsolutePath().substring(charsToTrim); newNames[i] = newNames[i].replace('\\','/'); - if (sources[i].isDirectory() && !newNames[i].endsWith("/")) { - newNames[i] = newNames[i] + "/"; + if (sources[i].isDirectory() && !newNames[i].endsWith("/")) { //$NON-NLS-1$ + newNames[i] = newNames[i] + "/"; //$NON-NLS-1$ } } sources[numOfChildren] = file; newNames[numOfChildren] = name; - if (!newNames[numOfChildren].endsWith("/")) { - newNames[numOfChildren] = newNames[numOfChildren] + "/"; + if (!newNames[numOfChildren].endsWith("/")) { //$NON-NLS-1$ + newNames[numOfChildren] = newNames[numOfChildren] + "/"; //$NON-NLS-1$ } return add(sources, virtualPath, newNames); @@ -1097,15 +1097,15 @@ public class SystemTarHandler implements ISystemArchiveHandler { // if the entry already exists, then we should do a replace // TODO (KM): should we simply replace and return? // I think we should check each entry and replace or create for each one - if (exists(virtualPath + "/" + names[i])) { - return replace(virtualPath + "/" + names[i], files[i], names[i]); + if (exists(virtualPath + "/" + names[i])) { //$NON-NLS-1$ + return replace(virtualPath + "/" + names[i], files[i], names[i]); //$NON-NLS-1$ } } try { // open a new temp file which will be our destination for the new tar file - File outFile = new File(file.getAbsolutePath() + "temp"); + File outFile = new File(file.getAbsolutePath() + "temp"); //$NON-NLS-1$ TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outFile)); // get all the entries in the current tar @@ -1119,7 +1119,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { // for each new file to add for (int i = 0; i < numFiles; i++) { - String childVirtualPath = virtualPath + "/" + names[i]; + String childVirtualPath = virtualPath + "/" + names[i]; //$NON-NLS-1$ TarEntry newEntry = createTarEntry(files[i], childVirtualPath); @@ -1177,7 +1177,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { if (children[i].isDirectory) { // include a '/' at the end, since it is a directory - TarEntry nextEntry = tarFile.getEntry(children[i].fullName + "/"); + TarEntry nextEntry = tarFile.getEntry(children[i].fullName + "/"); //$NON-NLS-1$ // put the entry outStream.putNextEntry(nextEntry); @@ -1263,14 +1263,14 @@ public class SystemTarHandler implements ISystemArchiveHandler { // if directory, end with a '/' if (file.isDirectory()) { - if (!fullName.endsWith("/")) { - fullName = fullName + "/"; + if (!fullName.endsWith("/")) { //$NON-NLS-1$ + fullName = fullName + "/"; //$NON-NLS-1$ } } // strip out leading '/' // TODO (KM): Why? - if (fullName.startsWith("/")) { + if (fullName.startsWith("/")) { //$NON-NLS-1$ fullName = fullName.substring(1); } @@ -1291,7 +1291,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { entry.setModificationTime(lastModified); // set the user name - String userName = System.getProperty("user.name"); + String userName = System.getProperty("user.name"); //$NON-NLS-1$ if (userName != null) { entry.setUserName(userName); @@ -1316,18 +1316,14 @@ public class SystemTarHandler implements ISystemArchiveHandler { try { // if security manager successfully created, check permission - if (sm != null) { - + // create a file permission to check execute - FilePermission permission = new FilePermission(file.getAbsolutePath(), "execute"); + FilePermission permission = new FilePermission(file.getAbsolutePath(), "execute"); //$NON-NLS-1$ // this call will throw a SecurityException if permission does not exist sm.checkPermission(permission); canExecute = true; - } - else { - canExecute = false; - } + } catch(SecurityException e) { canExecute = false; @@ -1361,14 +1357,14 @@ public class SystemTarHandler implements ISystemArchiveHandler { // if directory, end with a '/' if (file.isDirectory()) { - if (!fullName.endsWith("/")) { - fullName = fullName + "/"; + if (!fullName.endsWith("/")) { //$NON-NLS-1$ + fullName = fullName + "/"; //$NON-NLS-1$ } } // strip out leading '/' // TODO (KM): Why? - if (fullName.startsWith("/")) { + if (fullName.startsWith("/")) { //$NON-NLS-1$ fullName = fullName.substring(1); } @@ -1418,7 +1414,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { String name = file.getAbsolutePath(); // create a temp file (in case something goes wrong) - File tempFile = new File(name + ".old"); + File tempFile = new File(name + ".old"); //$NON-NLS-1$ // rename current file to tempFile file.renameTo(tempFile); @@ -1472,7 +1468,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { try { // open a new temp file which will be our destination for the new tar file - File outFile = new File(getArchive().getAbsolutePath() + "temp"); + File outFile = new File(getArchive().getAbsolutePath() + "temp"); //$NON-NLS-1$ TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outFile)); @@ -1491,19 +1487,19 @@ public class SystemTarHandler implements ISystemArchiveHandler { // now append the new file to the tar String parentVirtualPath = null; - int i = fullVirtualName.lastIndexOf("/"); + int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$ // if the virtual name has no '/', then we will replace it with the // new name if (i == -1) { - parentVirtualPath = ""; + parentVirtualPath = ""; //$NON-NLS-1$ } // otherwise, we get the parent path to which the new name will be appended else { parentVirtualPath = fullVirtualName.substring(0, i); } - String virtualPath = parentVirtualPath + "/" + name; + String virtualPath = parentVirtualPath + "/" + name; //$NON-NLS-1$ // get the existing entry for the file TarFile tarFile = getTarFile(); @@ -1568,7 +1564,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { try { // open a new temp file which will be our destination for the new tar file - File outFile = new File(file.getAbsolutePath() + "temp"); + File outFile = new File(file.getAbsolutePath() + "temp"); //$NON-NLS-1$ TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outFile)); // get all the entries in the current tar @@ -1613,7 +1609,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { */ public boolean rename(String fullVirtualName, String newName) { fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName); - int i = fullVirtualName.lastIndexOf("/"); + int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$ // if the original does not have any separator, simply rename it. if (i == -1) { @@ -1633,11 +1629,11 @@ public class SystemTarHandler implements ISystemArchiveHandler { fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName); destinationVirtualPath = ArchiveHandlerManager.cleanUpVirtualPath(destinationVirtualPath); - int i = fullVirtualName.lastIndexOf("/"); + int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$ // if the original does not have any separator, simply append it to the destination path. if (i == -1) { - return fullRename(fullVirtualName, destinationVirtualPath + "/" + fullVirtualName); + return fullRename(fullVirtualName, destinationVirtualPath + "/" + fullVirtualName); //$NON-NLS-1$ } // otherwise, get the last segment (the name) and append that to the destination path. else { @@ -1672,7 +1668,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { try { // open a new temp file which will be our destination for the new tar file - File outFile = new File(file.getAbsolutePath() + "temp"); + File outFile = new File(file.getAbsolutePath() + "temp"); //$NON-NLS-1$ TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outFile)); // get all the entries @@ -1689,7 +1685,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { // add the entry itself to the rename list // include '/' in both the old name and the new name since it is a directory - names.put(fullVirtualName + "/", newFullVirtualName + "/"); + names.put(fullVirtualName + "/", newFullVirtualName + "/"); //$NON-NLS-1$ //$NON-NLS-2$ // get all the children of the entry to be renamed VirtualChild[] childrenArray = getVirtualChildrenList(fullVirtualName); @@ -1709,7 +1705,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { // if a child is a directory, ensure that '/'s are added both for the old name // and the new name if (childrenArray[i].isDirectory) { - names.put(childrenArray[i].fullName + "/", newName + "/"); + names.put(childrenArray[i].fullName + "/", newName + "/"); //$NON-NLS-1$ //$NON-NLS-2$ } else { names.put(childrenArray[i].fullName, newName); @@ -1849,7 +1845,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { String name; String fullName = fullNames[i]; fullName = ArchiveHandlerManager.cleanUpVirtualPath(fullName); - int j = fullName.lastIndexOf("/"); + int j = fullName.lastIndexOf("/"); //$NON-NLS-1$ if (j == -1) { name = fullName; @@ -1859,7 +1855,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { } try { - files[i] = File.createTempFile(name, "virtual"); + files[i] = File.createTempFile(name, "virtual"); //$NON-NLS-1$ files[i].deleteOnExit(); extractVirtualFile(fullNames[i], files[i]); } @@ -1877,7 +1873,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { */ public boolean createFolder(String fullVirtualName) { fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName); - fullVirtualName = fullVirtualName + "/"; + fullVirtualName = fullVirtualName + "/"; //$NON-NLS-1$ return createVirtualObject(fullVirtualName); } @@ -1914,7 +1910,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { try { // open a new temp file which will be our destination for the new tar file - File outFile = new File(file.getAbsolutePath() + "temp"); + File outFile = new File(file.getAbsolutePath() + "temp"); //$NON-NLS-1$ TarOutputStream outStream = new TarOutputStream(new FileOutputStream(outFile)); // get all the entries @@ -1962,7 +1958,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { newEntry.setModificationTime(System.currentTimeMillis()); // set the user name - String userName = System.getProperty("user.name"); + String userName = System.getProperty("user.name"); //$NON-NLS-1$ if (userName != null) { newEntry.setUserName(userName); @@ -1987,18 +1983,14 @@ public class SystemTarHandler implements ISystemArchiveHandler { try { // if security manager successfully created, check permission - if (sm != null) { - + // create a file permission to check execute - FilePermission permission = new FilePermission(file.getAbsolutePath(), "execute"); + FilePermission permission = new FilePermission(file.getAbsolutePath(), "execute"); //$NON-NLS-1$ // this call will throw a SecurityException if permission does not exist sm.checkPermission(permission); canExecute = true; - } - else { - canExecute = false; - } + } catch(SecurityException e) { canExecute = false; @@ -2024,7 +2016,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { public String getStandardName(VirtualChild vc) { if (vc.isDirectory) { - return vc.fullName + "/"; + return vc.fullName + "/"; //$NON-NLS-1$ } return vc.fullName; @@ -2076,7 +2068,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { InputStream is = null; try { - tarFile.getInputStream(entry); + is = tarFile.getInputStream(entry); if (is == null) { return new SystemSearchLineMatch[0]; @@ -2110,7 +2102,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { */ public String getCommentFor(String fullVirtualName) { - return ""; + return ""; //$NON-NLS-1$ } /* (non-Javadoc) @@ -2126,7 +2118,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { */ public String getCompressionMethodFor(String fullVirtualName) { - return ""; + return ""; //$NON-NLS-1$ } @@ -2135,7 +2127,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { */ public String getArchiveComment() { - return ""; + return ""; //$NON-NLS-1$ } /** @@ -2144,7 +2136,7 @@ public class SystemTarHandler implements ISystemArchiveHandler { * @param name * @param encoding * @param registry - * @return + * @return whether the add was successful */ public boolean add(File file, String virtualPath, String name, String encoding, ISystemFileTypes registry) { @@ -2194,10 +2186,10 @@ public class SystemTarHandler implements ISystemArchiveHandler { fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName); // default type - String type = "file"; + String type = "file"; //$NON-NLS-1$ // if it's not a class file, we do not classify it - if (!fullVirtualName.endsWith(".class")) { + if (!fullVirtualName.endsWith(".class")) { //$NON-NLS-1$ return type; } @@ -2230,16 +2222,16 @@ public class SystemTarHandler implements ISystemArchiveHandler { } // if it is executable, then also get qualified class name - if (isExecutable) { - type = "executable(java"; + if (isExecutable && parser != null) { + type = "executable(java"; //$NON-NLS-1$ String qualifiedClassName = parser.getQualifiedClassName(); if (qualifiedClassName != null) { - type = type + ":" + qualifiedClassName; + type = type + ":" + qualifiedClassName; //$NON-NLS-1$ } - type = type + ")"; + type = type + ")"; //$NON-NLS-1$ } return type; diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemUniversalZipEntry.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemUniversalZipEntry.java index ae5f7a1cc39..a98ee2e8ec6 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemUniversalZipEntry.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemUniversalZipEntry.java @@ -68,7 +68,7 @@ public class SystemUniversalZipEntry { _entryFullName = _entry.getName(); } - int endOfPathPosition = _entryFullName.lastIndexOf("/"); + int endOfPathPosition = _entryFullName.lastIndexOf("/"); //$NON-NLS-1$ if (endOfPathPosition != -1) { _entryFullPath = _entryFullName.substring(0,endOfPathPosition); @@ -76,15 +76,15 @@ public class SystemUniversalZipEntry } else { - _entryFullPath = ""; + _entryFullPath = ""; //$NON-NLS-1$ _entryName = _entryFullName; } - int i = _entryFullName.lastIndexOf("."); + int i = _entryFullName.lastIndexOf("."); //$NON-NLS-1$ if (i == -1) { - _extension = ""; + _extension = ""; //$NON-NLS-1$ } else _extension = _entryFullName.substring(i + 1); - if (_entryFullName.indexOf("/") != -1) _nested = true; + if (_entryFullName.indexOf("/") != -1) _nested = true; //$NON-NLS-1$ } /** diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemZipHandler.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemZipHandler.java index 857784757b9..ea340b42241 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemZipHandler.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemZipHandler.java @@ -138,7 +138,7 @@ public class SystemZipHandler implements ISystemArchiveHandler protected void fillBranch(ZipEntry next) { VirtualChild nextChild; - if (next.getName().equals("/")) return; // dummy entry + if (next.getName().equals("/")) return; // dummy entry //$NON-NLS-1$ if (!next.isDirectory()) { SystemUniversalZipEntry nextEntry = new SystemUniversalZipEntry(next); @@ -192,18 +192,18 @@ public class SystemZipHandler implements ISystemArchiveHandler _virtualFS.put(key, newValue); // base case 2 - if (key.equals("")) + if (key.equals("")) //$NON-NLS-1$ { return; } else { - int i = key.lastIndexOf("/"); + int i = key.lastIndexOf("/"); //$NON-NLS-1$ if (i == -1) // recursive last step { VirtualChild nextValue = new VirtualChild(this, key); nextValue.isDirectory = true; - recursivePopulate("", nextValue); + recursivePopulate("", nextValue); //$NON-NLS-1$ return; } else // recursive step @@ -285,7 +285,7 @@ public class SystemZipHandler implements ISystemArchiveHandler { ZipEntry next = (ZipEntry) entries.nextElement(); String nextName = ArchiveHandlerManager.cleanUpVirtualPath(next.getName()); - if (nextName.startsWith(parent) && !nextName.equals(parent+"/")) + if (nextName.startsWith(parent) && !nextName.equals(parent+"/")) //$NON-NLS-1$ { SystemUniversalZipEntry nextEntry = new SystemUniversalZipEntry(next); VirtualChild nextChild = new VirtualChild(this, nextEntry.getFullName()); @@ -364,13 +364,13 @@ public class SystemZipHandler implements ISystemArchiveHandler if (!updateVirtualFSIfNecessary()) return new VirtualChild(this, fullVirtualName); fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName); - if (fullVirtualName == "" || fullVirtualName == null) return new VirtualChild(this); - int i = fullVirtualName.lastIndexOf("/"); + if (fullVirtualName == "" || fullVirtualName == null) return new VirtualChild(this); //$NON-NLS-1$ + int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$ String path; String name; if (i == -1) { - path = ""; + path = ""; //$NON-NLS-1$ name = fullVirtualName; } else @@ -393,16 +393,16 @@ public class SystemZipHandler implements ISystemArchiveHandler if (!_exists) return false; fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName); - if (fullVirtualName == "" || fullVirtualName == null) return false; + if (fullVirtualName == "" || fullVirtualName == null) return false; //$NON-NLS-1$ if (_vfsLastModified == _file.lastModified()) { - int i = fullVirtualName.lastIndexOf("/"); + int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$ String path; String name; if (i == -1) { - path = ""; + path = ""; //$NON-NLS-1$ name = fullVirtualName; } else @@ -430,7 +430,7 @@ public class SystemZipHandler implements ISystemArchiveHandler { try { - safeGetEntry(fullVirtualName + "/"); + safeGetEntry(fullVirtualName + "/"); //$NON-NLS-1$ retval = true; } catch (IOException f) @@ -445,7 +445,7 @@ public class SystemZipHandler implements ISystemArchiveHandler } else { - System.out.println("Could not open the ZipFile " + _file.toString()); + System.out.println("Could not open the ZipFile " + _file.toString()); //$NON-NLS-1$ return false; } } @@ -659,7 +659,7 @@ public class SystemZipHandler implements ISystemArchiveHandler String name; int charsToTrim; - int j = dir.lastIndexOf("/"); + int j = dir.lastIndexOf("/"); //$NON-NLS-1$ if (j == -1) { charsToTrim = 0; @@ -673,7 +673,7 @@ public class SystemZipHandler implements ISystemArchiveHandler if (destination == null) { - if (dir.equals("")) + if (dir.equals("")) //$NON-NLS-1$ { destination = destinationParent; } @@ -689,8 +689,8 @@ public class SystemZipHandler implements ISystemArchiveHandler { if (!SystemArchiveUtil.delete(destination)) { - System.out.println("Could not overwrite directory " + destination); - System.out.println("(Could not delete old directory)"); + System.out.println("Could not overwrite directory " + destination); //$NON-NLS-1$ + System.out.println("(Could not delete old directory)"); //$NON-NLS-1$ return false; } } @@ -699,8 +699,8 @@ public class SystemZipHandler implements ISystemArchiveHandler { if (!destination.mkdirs()) { - System.out.println("Could not overwrite directory " + destination); - System.out.println("(Could not create new directory)"); + System.out.println("Could not overwrite directory " + destination); //$NON-NLS-1$ + System.out.println("(Could not create new directory)"); //$NON-NLS-1$ return false; } } @@ -741,7 +741,7 @@ public class SystemZipHandler implements ISystemArchiveHandler { if (!nextFile.mkdirs()) { - System.out.println("Could not create folder " + nextFile.toString()); + System.out.println("Could not create folder " + nextFile.toString()); //$NON-NLS-1$ return false; } } @@ -770,7 +770,7 @@ public class SystemZipHandler implements ISystemArchiveHandler { if (!file.createNewFile()) { - System.out.println("File already exists: " + file.toString()); + System.out.println("File already exists: " + file.toString()); //$NON-NLS-1$ return false; } else @@ -786,7 +786,7 @@ public class SystemZipHandler implements ISystemArchiveHandler } else { - System.out.println("Could not create " + file.toString()); + System.out.println("Could not create " + file.toString()); //$NON-NLS-1$ System.out.println(e.getMessage()); return false; } @@ -805,10 +805,10 @@ public class SystemZipHandler implements ISystemArchiveHandler if (!_exists) return false; virtualPath = ArchiveHandlerManager.cleanUpVirtualPath(virtualPath); - if (exists(virtualPath + "/" + name)) + if (exists(virtualPath + "/" + name)) //$NON-NLS-1$ { // wrong method - return replace(virtualPath + "/" + name, stream, name, sourceEncoding, targetEncoding, isText); + return replace(virtualPath + "/" + name, stream, name, sourceEncoding, targetEncoding, isText); //$NON-NLS-1$ } else { @@ -819,7 +819,7 @@ public class SystemZipHandler implements ISystemArchiveHandler try { // Open a new tempfile which will be our destination for the new zip - outputTempFile = new File(_file.getAbsolutePath() + "temp"); + outputTempFile = new File(_file.getAbsolutePath() + "temp"); //$NON-NLS-1$ ZipOutputStream dest = new ZipOutputStream( new FileOutputStream(outputTempFile)); @@ -828,7 +828,7 @@ public class SystemZipHandler implements ISystemArchiveHandler VirtualChild[] vcList = getVirtualChildrenList(false); // if it is an empty zip file, no need to recreate it - if (!(vcList.length == 1) || !vcList[0].fullName.equals("")) + if (!(vcList.length == 1) || !vcList[0].fullName.equals("")) //$NON-NLS-1$ { recreateZipDeleteEntries(vcList, dest, null); } @@ -846,7 +846,7 @@ public class SystemZipHandler implements ISystemArchiveHandler } catch (IOException e) { - System.out.println("Could not add a file."); + System.out.println("Could not add a file."); //$NON-NLS-1$ System.out.println(e.getMessage()); closeZipFile(); return false; @@ -893,17 +893,17 @@ public class SystemZipHandler implements ISystemArchiveHandler for (int i = 0; i < numFiles; i++) { if (!files[i].exists() || !files[i].canRead()) return false; - if (exists(virtualPath + "/" + names[i])) + if (exists(virtualPath + "/" + names[i])) //$NON-NLS-1$ { // sorry, wrong method buddy - return replace(virtualPath + "/" + names[i], files[i], names[i]); + return replace(virtualPath + "/" + names[i], files[i], names[i]); //$NON-NLS-1$ } } File outputTempFile; try { // Open a new tempfile which will be our destination for the new zip - outputTempFile = new File(_file.getAbsolutePath() + "temp"); + outputTempFile = new File(_file.getAbsolutePath() + "temp"); //$NON-NLS-1$ ZipOutputStream dest = new ZipOutputStream( new FileOutputStream(outputTempFile)); @@ -912,7 +912,7 @@ public class SystemZipHandler implements ISystemArchiveHandler VirtualChild[] vcList = getVirtualChildrenList(false); // if it is an empty zip file, no need to recreate it - if (!(vcList.length == 1) || !vcList[0].fullName.equals("")) + if (!(vcList.length == 1) || !vcList[0].fullName.equals("")) //$NON-NLS-1$ { recreateZipDeleteEntries(vcList, dest, null); } @@ -933,7 +933,7 @@ public class SystemZipHandler implements ISystemArchiveHandler } catch (IOException e) { - System.out.println("Could not add a file."); + System.out.println("Could not add a file."); //$NON-NLS-1$ System.out.println(e.getMessage()); if (closeZipFile) closeZipFile(); return false; @@ -989,7 +989,7 @@ public class SystemZipHandler implements ISystemArchiveHandler { // the zip file will be empty, but it must have at least one entry, // so we will put in a dummy entry. - ZipEntry entry = new ZipEntry("/"); + ZipEntry entry = new ZipEntry("/"); //$NON-NLS-1$ dest.putNextEntry(entry); dest.closeEntry(); return; @@ -1002,7 +1002,7 @@ public class SystemZipHandler implements ISystemArchiveHandler if (omitChildren != null && omitChildren.contains(vcList[i].fullName)) continue; if (vcList[i].isDirectory) { - ZipEntry nextEntry = safeGetEntry(vcList[i].fullName + "/"); + ZipEntry nextEntry = safeGetEntry(vcList[i].fullName + "/"); //$NON-NLS-1$ dest.putNextEntry(nextEntry); dest.closeEntry(); continue; @@ -1096,13 +1096,13 @@ public class SystemZipHandler implements ISystemArchiveHandler ZipEntry newEntry; if (file.isDirectory()) { - String fullName = virtualPath + "/" + name; - if (!fullName.endsWith("/")) fullName = fullName + "/"; + String fullName = virtualPath + "/" + name; //$NON-NLS-1$ + if (!fullName.endsWith("/")) fullName = fullName + "/"; //$NON-NLS-1$ //$NON-NLS-2$ newEntry = createSafeZipEntry(fullName); } else { - newEntry = createSafeZipEntry(virtualPath + "/" + name); + newEntry = createSafeZipEntry(virtualPath + "/" + name); //$NON-NLS-1$ } newEntry.setTime(file.lastModified()); dest.putNextEntry(newEntry); @@ -1161,7 +1161,7 @@ public class SystemZipHandler implements ISystemArchiveHandler protected ZipEntry appendBytes(InputStream stream, ZipOutputStream dest, String virtualPath, String name, String sourceEncoding, String targetEncoding, boolean isText) throws IOException { ZipEntry newEntry; - newEntry = createSafeZipEntry(virtualPath + "/" + name); + newEntry = createSafeZipEntry(virtualPath + "/" + name); //$NON-NLS-1$ dest.putNextEntry(newEntry); BufferedInputStream source = new BufferedInputStream(stream); @@ -1210,7 +1210,7 @@ public class SystemZipHandler implements ISystemArchiveHandler { String oldName = _file.getAbsolutePath(); _zipfile.close(); - File oldFile = new File(oldName + "old"); + File oldFile = new File(oldName + "old"); //$NON-NLS-1$ System.out.println(_file.renameTo(oldFile)); System.out.println(outputTempFile.renameTo(_file)); _vfsLastModified = _file.lastModified(); @@ -1255,7 +1255,7 @@ public class SystemZipHandler implements ISystemArchiveHandler try { // Open a new tempfile which will be our destination for the new zip - outputTempFile = new File(_file.getAbsolutePath() + "temp"); + outputTempFile = new File(_file.getAbsolutePath() + "temp"); //$NON-NLS-1$ ZipOutputStream dest = new ZipOutputStream( new FileOutputStream(outputTempFile)); dest.setMethod(ZipOutputStream.DEFLATED); @@ -1301,7 +1301,7 @@ public class SystemZipHandler implements ISystemArchiveHandler catch (IOException e) { System.out.println(e.getMessage()); - System.out.println("Could not delete " + fullVirtualName); + System.out.println("Could not delete " + fullVirtualName); //$NON-NLS-1$ if (!(outputTempFile == null)) outputTempFile.delete(); if (closeZipFile) closeZipFile(); return false; @@ -1360,7 +1360,7 @@ public class SystemZipHandler implements ISystemArchiveHandler try { // Open a new tempfile which will be our destination for the new zip - outputTempFile = new File(_file.getAbsolutePath() + "temp"); + outputTempFile = new File(_file.getAbsolutePath() + "temp"); //$NON-NLS-1$ ZipOutputStream dest = new ZipOutputStream( new FileOutputStream(outputTempFile)); dest.setMethod(ZipOutputStream.DEFLATED); @@ -1371,17 +1371,17 @@ public class SystemZipHandler implements ISystemArchiveHandler recreateZipDeleteEntries(vcList, dest, omissions); // Now append the additional entry to the zip file. - int i = fullVirtualName.lastIndexOf("/"); + int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$ String virtualPath; if (i == -1) { - virtualPath = ""; + virtualPath = ""; //$NON-NLS-1$ } else { virtualPath = fullVirtualName.substring(0,i); } - ZipEntry newEntry = appendFile(file, dest, virtualPath, name, SystemEncodingUtil.ENCODING_UTF_8, SystemEncodingUtil.ENCODING_UTF_8, false); + appendFile(file, dest, virtualPath, name, SystemEncodingUtil.ENCODING_UTF_8, SystemEncodingUtil.ENCODING_UTF_8, false); dest.close(); // Now replace the old zip file with the new one @@ -1390,7 +1390,7 @@ public class SystemZipHandler implements ISystemArchiveHandler } catch (IOException e) { - System.out.println("Could not replace " + file.getName()); + System.out.println("Could not replace " + file.getName()); //$NON-NLS-1$ if (!(outputTempFile == null)) outputTempFile.delete(); if (closeZipFile) closeZipFile(); return false; @@ -1417,7 +1417,7 @@ public class SystemZipHandler implements ISystemArchiveHandler try { // Open a new tempfile which will be our destination for the new zip - outputTempFile = new File(_file.getAbsolutePath() + "temp"); + outputTempFile = new File(_file.getAbsolutePath() + "temp"); //$NON-NLS-1$ ZipOutputStream dest = new ZipOutputStream( new FileOutputStream(outputTempFile)); dest.setMethod(ZipOutputStream.DEFLATED); @@ -1428,17 +1428,17 @@ public class SystemZipHandler implements ISystemArchiveHandler recreateZipDeleteEntries(vcList, dest, omissions); // Now append the additional entry to the zip file. - int i = fullVirtualName.lastIndexOf("/"); + int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$ String virtualPath; if (i == -1) { - virtualPath = ""; + virtualPath = ""; //$NON-NLS-1$ } else { virtualPath = fullVirtualName.substring(0,i); } - ZipEntry newEntry = appendBytes(stream, dest, virtualPath, name, sourceEncoding, targetEncoding, isText); + appendBytes(stream, dest, virtualPath, name, sourceEncoding, targetEncoding, isText); dest.close(); // Now replace the old zip file with the new one @@ -1447,7 +1447,7 @@ public class SystemZipHandler implements ISystemArchiveHandler } catch (IOException e) { - System.out.println("Could not replace " + fullVirtualName); + System.out.println("Could not replace " + fullVirtualName); //$NON-NLS-1$ if (!(outputTempFile == null)) outputTempFile.delete(); closeZipFile(); return false; @@ -1479,7 +1479,7 @@ public class SystemZipHandler implements ISystemArchiveHandler VirtualChild vc = getVirtualFile(fullVirtualName); if (!vc.exists()) { - System.out.println("The virtual file " + fullVirtualName + " does not exist."); + System.out.println("The virtual file " + fullVirtualName + " does not exist."); //$NON-NLS-1$ //$NON-NLS-2$ return false; } if (openZipFile()) @@ -1488,7 +1488,7 @@ public class SystemZipHandler implements ISystemArchiveHandler try { // Open a new tempfile which will be our destination for the new zip - outputTempFile = new File(_file.getAbsolutePath() + "temp"); + outputTempFile = new File(_file.getAbsolutePath() + "temp"); //$NON-NLS-1$ ZipOutputStream dest = new ZipOutputStream( new FileOutputStream(outputTempFile)); dest.setMethod(ZipOutputStream.DEFLATED); @@ -1508,8 +1508,8 @@ public class SystemZipHandler implements ISystemArchiveHandler String newName = newFullVirtualName + suffix; if (renameList[i].isDirectory) { - newName = newName + "/"; - names.put(renameList[i].fullName + "/", newName); + newName = newName + "/"; //$NON-NLS-1$ + names.put(renameList[i].fullName + "/", newName); //$NON-NLS-1$ } else { @@ -1519,7 +1519,7 @@ public class SystemZipHandler implements ISystemArchiveHandler try { safeGetEntry(fullVirtualName); - names.put(fullVirtualName + "/", newFullVirtualName + "/"); + names.put(fullVirtualName + "/", newFullVirtualName + "/"); //$NON-NLS-1$ //$NON-NLS-2$ } catch (IOException e) {} } @@ -1540,7 +1540,7 @@ public class SystemZipHandler implements ISystemArchiveHandler } catch (IOException e) { - System.out.println("Could not rename " + fullVirtualName); + System.out.println("Could not rename " + fullVirtualName); //$NON-NLS-1$ if (!(outputTempFile == null)) outputTempFile.delete(); if (closeZipFile) closeZipFile(); return false; @@ -1558,10 +1558,10 @@ public class SystemZipHandler implements ISystemArchiveHandler { fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName); destinationVirtualPath = ArchiveHandlerManager.cleanUpVirtualPath(destinationVirtualPath); - int i = fullVirtualName.lastIndexOf("/"); + int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$ if (i == -1) { - return fullRename(fullVirtualName, destinationVirtualPath + "/" + fullVirtualName); + return fullRename(fullVirtualName, destinationVirtualPath + "/" + fullVirtualName); //$NON-NLS-1$ } String name = fullVirtualName.substring(i); return fullRename(fullVirtualName, destinationVirtualPath + name); @@ -1573,7 +1573,7 @@ public class SystemZipHandler implements ISystemArchiveHandler public boolean rename(String fullVirtualName, String newName) { fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName); - int i = fullVirtualName.lastIndexOf("/"); + int i = fullVirtualName.lastIndexOf("/"); //$NON-NLS-1$ if (i == -1) { return fullRename(fullVirtualName, newName); @@ -1595,7 +1595,7 @@ public class SystemZipHandler implements ISystemArchiveHandler String name; String fullName = fullNames[i]; fullName = ArchiveHandlerManager.cleanUpVirtualPath(fullName); - int j = fullName.lastIndexOf("/"); + int j = fullName.lastIndexOf("/"); //$NON-NLS-1$ if (j == -1) { name = fullName; @@ -1606,14 +1606,14 @@ public class SystemZipHandler implements ISystemArchiveHandler } try { - files[i] = File.createTempFile(name, "virtual"); + files[i] = File.createTempFile(name, "virtual"); //$NON-NLS-1$ files[i].deleteOnExit(); extractVirtualFile(fullNames[i], files[i]); } catch (IOException e) { System.out.println(e.getMessage()); - System.out.println("Could not extract virtual file: " + fullNames[i]); + System.out.println("Could not extract virtual file: " + fullNames[i]); //$NON-NLS-1$ return null; } } @@ -1626,7 +1626,7 @@ public class SystemZipHandler implements ISystemArchiveHandler public boolean createFolder(String name) { name = ArchiveHandlerManager.cleanUpVirtualPath(name); - name = name + "/"; + name = name + "/"; //$NON-NLS-1$ return createVirtualObject(name, true); } @@ -1662,7 +1662,7 @@ public class SystemZipHandler implements ISystemArchiveHandler try { // Open a new tempfile which will be our destination for the new zip - outputTempFile = new File(_file.getAbsolutePath() + "temp"); + outputTempFile = new File(_file.getAbsolutePath() + "temp"); //$NON-NLS-1$ ZipOutputStream dest = new ZipOutputStream( new FileOutputStream(outputTempFile)); dest.setMethod(ZipOutputStream.DEFLATED); @@ -1670,7 +1670,7 @@ public class SystemZipHandler implements ISystemArchiveHandler VirtualChild[] vcList = getVirtualChildrenList(false); // if it is an empty zip file, no need to recreate it - if (!(vcList.length == 1) || !vcList[0].fullName.equals("")) + if (!(vcList.length == 1) || !vcList[0].fullName.equals("")) //$NON-NLS-1$ { recreateZipDeleteEntries(vcList, dest, null); } @@ -1688,7 +1688,7 @@ public class SystemZipHandler implements ISystemArchiveHandler } catch (IOException e) { - System.out.println("Could not add a file."); + System.out.println("Could not add a file."); //$NON-NLS-1$ System.out.println(e.getMessage()); if (closeZipFile) closeZipFile(); return false; @@ -1710,7 +1710,7 @@ public class SystemZipHandler implements ISystemArchiveHandler */ protected ZipEntry appendEmptyFile(ZipOutputStream dest, String name) throws IOException { - boolean isDirectory = name.endsWith("/"); + boolean isDirectory = name.endsWith("/"); //$NON-NLS-1$ ZipEntry newEntry; newEntry = createSafeZipEntry(name); dest.putNextEntry(newEntry); @@ -1731,13 +1731,13 @@ public class SystemZipHandler implements ISystemArchiveHandler */ protected ZipEntry createSafeZipEntry(String name) { - if (name.startsWith("/")) name = name.substring(1); + if (name.startsWith("/")) name = name.substring(1); //$NON-NLS-1$ return new ZipEntry(name); } public String getStandardName(VirtualChild vc) { - if (vc.isDirectory) return vc.fullName + "/"; + if (vc.isDirectory) return vc.fullName + "/"; //$NON-NLS-1$ return vc.fullName; } @@ -1754,7 +1754,7 @@ public class SystemZipHandler implements ISystemArchiveHandler } catch (IOException e) { - System.out.println("Could not open zipfile: " + _file); + System.out.println("Could not open zipfile: " + _file); //$NON-NLS-1$ System.out.println(e.getMessage()); return false; } @@ -1769,7 +1769,7 @@ public class SystemZipHandler implements ISystemArchiveHandler } catch (IOException e) { - System.out.println("Could not close zipfile: " + _file); + System.out.println("Could not close zipfile: " + _file); //$NON-NLS-1$ System.out.println(e.getMessage()); return false; } @@ -1806,8 +1806,8 @@ public class SystemZipHandler implements ISystemArchiveHandler protected ZipEntry safeGetEntry(String name) throws IOException { ZipEntry entry = _zipfile.getEntry(name); - if (entry == null) entry = _zipfile.getEntry("/" + name); - if (entry == null) throw new IOException("SystemZipHandler.safeGetEntry(): The ZipEntry " + name + " cannot be found in " + _file.toString()); + if (entry == null) entry = _zipfile.getEntry("/" + name); //$NON-NLS-1$ + if (entry == null) throw new IOException("SystemZipHandler.safeGetEntry(): The ZipEntry " + name + " cannot be found in " + _file.toString()); //$NON-NLS-1$ //$NON-NLS-2$ return entry; } @@ -1923,7 +1923,7 @@ public class SystemZipHandler implements ISystemArchiveHandler */ public String getCommentFor(String fullVirtualName, boolean closeZipFile) { - if (!_exists) return ""; + if (!_exists) return ""; //$NON-NLS-1$ if (openZipFile()) { @@ -1936,14 +1936,14 @@ public class SystemZipHandler implements ISystemArchiveHandler catch (IOException e) { if (closeZipFile) closeZipFile(); - return ""; + return ""; //$NON-NLS-1$ } if (closeZipFile) closeZipFile(); String comment = entry.getComment(); - if (comment == null) return ""; + if (comment == null) return ""; //$NON-NLS-1$ else return comment; } - else return ""; + else return ""; //$NON-NLS-1$ } /* (non-Javadoc) @@ -1995,7 +1995,7 @@ public class SystemZipHandler implements ISystemArchiveHandler */ public String getCompressionMethodFor(String fullVirtualName, boolean closeZipFile) { - if (!_exists) return ""; + if (!_exists) return ""; //$NON-NLS-1$ if (openZipFile()) { @@ -2008,19 +2008,19 @@ public class SystemZipHandler implements ISystemArchiveHandler catch (IOException e) { if (closeZipFile) closeZipFile(); - return ""; + return ""; //$NON-NLS-1$ } if (closeZipFile) closeZipFile(); return (new Integer(entry.getMethod())).toString(); } - else return ""; + else return ""; //$NON-NLS-1$ } /* (non-Javadoc) * @see org.eclipse.rse.core.archiveutils.ISystemArchiveHandler#getArchiveComment() */ public String getArchiveComment() { - return ""; + return ""; //$NON-NLS-1$ } /** @@ -2038,7 +2038,7 @@ public class SystemZipHandler implements ISystemArchiveHandler public String getClassification(String fullVirtualName, boolean closeZipFile) { // default type - String type = "file"; + String type = "file"; //$NON-NLS-1$ if (!_exists) { return type; @@ -2047,7 +2047,7 @@ public class SystemZipHandler implements ISystemArchiveHandler fullVirtualName = ArchiveHandlerManager.cleanUpVirtualPath(fullVirtualName); // if it's not a class file, we do not classify it - if (!fullVirtualName.endsWith(".class")) { + if (!fullVirtualName.endsWith(".class")) { //$NON-NLS-1$ return type; } @@ -2087,16 +2087,16 @@ public class SystemZipHandler implements ISystemArchiveHandler } // if it is executable, then also get qualified class name - if (isExecutable) { - type = "executable(java"; + if (isExecutable && parser != null) { + type = "executable(java"; //$NON-NLS-1$ String qualifiedClassName = parser.getQualifiedClassName(); if (qualifiedClassName != null) { - type = type + ":" + qualifiedClassName; + type = type + ":" + qualifiedClassName; //$NON-NLS-1$ } - type = type + ")"; + type = type + ")"; //$NON-NLS-1$ } return type; @@ -2108,10 +2108,10 @@ public class SystemZipHandler implements ISystemArchiveHandler virtualPath = ArchiveHandlerManager.cleanUpVirtualPath(virtualPath); if (!file.isDirectory()) { - if (exists(virtualPath + "/" + name)) + if (exists(virtualPath + "/" + name)) //$NON-NLS-1$ { // wrong method - return replace(virtualPath + "/" + name, file, name); + return replace(virtualPath + "/" + name, file, name); //$NON-NLS-1$ } else { @@ -2146,7 +2146,7 @@ public class SystemZipHandler implements ISystemArchiveHandler sources[i] = (File) kids[i]; newNames[i] = sources[i].getAbsolutePath().substring(charsToTrim); newNames[i] = newNames[i].replace('\\','/'); - if (sources[i].isDirectory() && !newNames[i].endsWith("/")) newNames[i] = newNames[i] + "/"; + if (sources[i].isDirectory() && !newNames[i].endsWith("/")) newNames[i] = newNames[i] + "/"; //$NON-NLS-1$ //$NON-NLS-2$ // this part can be changed to allow different encodings for different files sourceEncodings[i] = sourceEncoding; @@ -2159,7 +2159,7 @@ public class SystemZipHandler implements ISystemArchiveHandler targetEncodings[children.size()] = targetEncoding; isTexts[children.size()] = registry.isText(file); - if (!newNames[children.size()].endsWith("/")) newNames[children.size()] = newNames[children.size()] + "/"; + if (!newNames[children.size()].endsWith("/")) newNames[children.size()] = newNames[children.size()] + "/"; //$NON-NLS-1$ //$NON-NLS-2$ return add(sources, virtualPath, newNames, sourceEncodings, targetEncodings, isTexts); } } @@ -2170,10 +2170,10 @@ public class SystemZipHandler implements ISystemArchiveHandler virtualPath = ArchiveHandlerManager.cleanUpVirtualPath(virtualPath); if (!file.isDirectory()) { - if (exists(virtualPath + "/" + name)) + if (exists(virtualPath + "/" + name)) //$NON-NLS-1$ { // wrong method - return replace(virtualPath + "/" + name, file, name); + return replace(virtualPath + "/" + name, file, name); //$NON-NLS-1$ } else { @@ -2192,7 +2192,6 @@ public class SystemZipHandler implements ISystemArchiveHandler } else { - String sourceName = name; HashSet children = new HashSet(); listAllFiles(file, children); File[] sources = new File[children.size() + 1]; @@ -2208,7 +2207,7 @@ public class SystemZipHandler implements ISystemArchiveHandler sources[i] = (File) kids[i]; newNames[i] = sources[i].getAbsolutePath().substring(charsToTrim); newNames[i] = newNames[i].replace('\\','/'); - if (sources[i].isDirectory() && !newNames[i].endsWith("/")) newNames[i] = newNames[i] + "/"; + if (sources[i].isDirectory() && !newNames[i].endsWith("/")) newNames[i] = newNames[i] + "/"; //$NON-NLS-1$ //$NON-NLS-2$ // this part can be changed to allow different encodings for different files sourceEncodings[i] = sourceEncoding; @@ -2220,7 +2219,7 @@ public class SystemZipHandler implements ISystemArchiveHandler sourceEncodings[children.size()] = sourceEncoding; targetEncodings[children.size()] = targetEncoding; isTexts[children.size()] = isText; - if (!newNames[children.size()].endsWith("/")) newNames[children.size()] = newNames[children.size()] + "/"; + if (!newNames[children.size()].endsWith("/")) newNames[children.size()] = newNames[children.size()] + "/"; //$NON-NLS-1$ //$NON-NLS-2$ return add(sources, virtualPath, newNames, sourceEncodings, targetEncodings, isTexts); } } diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/VirtualChild.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/VirtualChild.java index 0d2eebf9365..597d27f0ae5 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/VirtualChild.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/VirtualChild.java @@ -43,9 +43,9 @@ public final class VirtualChild { */ public VirtualChild(ISystemArchiveHandler handler) { - fullName = ""; - name = ""; - path = ""; + fullName = ""; //$NON-NLS-1$ + name = ""; //$NON-NLS-1$ + path = ""; //$NON-NLS-1$ isDirectory = false; _handler = handler; _extractedFile = null; @@ -112,7 +112,7 @@ public final class VirtualChild { */ public String getComment() { - if (_handler == null) return ""; + if (_handler == null) return ""; //$NON-NLS-1$ return _handler.getCommentFor(fullName); } @@ -131,7 +131,7 @@ public final class VirtualChild { */ public String getCompressionMethod() { - if (_handler == null) return ""; + if (_handler == null) return ""; //$NON-NLS-1$ return _handler.getCompressionMethodFor(fullName); } @@ -172,16 +172,16 @@ public final class VirtualChild { { try { - int i = name.lastIndexOf("."); - String ext = ""; + int i = name.lastIndexOf("."); //$NON-NLS-1$ + String ext = ""; //$NON-NLS-1$ if (i != -1) ext = name.substring(i+1); if (i < 3) { - _extractedFile = File.createTempFile(name + "123", "virtual." + ext); + _extractedFile = File.createTempFile(name + "123", "virtual." + ext); //$NON-NLS-1$ //$NON-NLS-2$ } else { - _extractedFile = File.createTempFile(name, "virtual." + ext); + _extractedFile = File.createTempFile(name, "virtual." + ext); //$NON-NLS-1$ } _extractedFile.deleteOnExit(); if (_handler == null) return _extractedFile; @@ -191,7 +191,7 @@ public final class VirtualChild { { if (!(_extractedFile.delete() && _extractedFile.mkdirs())) { - System.out.println("VirtualChild.getExtractedFile(): Could not create temp dir."); + System.out.println("VirtualChild.getExtractedFile(): Could not create temp dir."); //$NON-NLS-1$ return null; } } @@ -204,7 +204,7 @@ public final class VirtualChild { } catch (IOException e) { - System.out.println("VirtualChild.getExtractedFile(): "); + System.out.println("VirtualChild.getExtractedFile(): "); //$NON-NLS-1$ System.out.println(e.getMessage()); } } @@ -285,11 +285,11 @@ public final class VirtualChild { { newName = ArchiveHandlerManager.cleanUpVirtualPath(newName); fullName = newName; - int i = newName.lastIndexOf("/"); + int i = newName.lastIndexOf("/"); //$NON-NLS-1$ if (i == -1) { name = newName; - path = ""; + path = ""; //$NON-NLS-1$ } else { diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/java/BasicClassFileParser.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/java/BasicClassFileParser.java index b7dc9354d7e..8e1c8b39d96 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/java/BasicClassFileParser.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/java/BasicClassFileParser.java @@ -77,7 +77,7 @@ public class BasicClassFileParser { int nameIndex = info.getNameIndex(); String name = getString(nameIndex); - if (name.equals("main")) { + if (name.equals("main")) { //$NON-NLS-1$ // check access flags for public and static int accessFlags = info.getAccessFlags(); @@ -88,7 +88,7 @@ public class BasicClassFileParser { int descriptorIndex = info.getDescriptorIndex(); String descriptor = getString(descriptorIndex); - if (descriptor.equals("([Ljava/lang/String;)V")) { + if (descriptor.equals("([Ljava/lang/String;)V")) { //$NON-NLS-1$ return true; } } diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/java/EnhancedClassLoader.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/java/EnhancedClassLoader.java index 60f2ea7e7c6..2e63711282d 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/java/EnhancedClassLoader.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/java/EnhancedClassLoader.java @@ -78,7 +78,7 @@ public class EnhancedClassLoader extends ClassLoader { String parentPath = rootPath; // system file separator - String fileSep = System.getProperty("file.separator"); + String fileSep = System.getProperty("file.separator"); //$NON-NLS-1$ // add file separator to the parent path if it does not end with it if (!parentPath.endsWith(fileSep)) { @@ -99,7 +99,7 @@ public class EnhancedClassLoader extends ClassLoader { } } - String filePath = buf.append(".class").toString(); + String filePath = buf.append(".class").toString(); //$NON-NLS-1$ File file = new File(filePath); diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/SystemMessage.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/SystemMessage.java index 6aaeb3551a8..a95113574bb 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/SystemMessage.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/SystemMessage.java @@ -94,7 +94,7 @@ public class SystemMessage public void setIndicator(char ind) throws IndicatorException { // check that a valid indicator was specified if (ind != INQUIRY && ind != INFORMATION && ind != ERROR && ind != WARNING && ind != UNEXPECTED && ind != COMPLETION) - throw (new IndicatorException("Indicator specified not valid. Unable to set Indicator.")); + throw (new IndicatorException("Indicator specified not valid. Unable to set Indicator.")); //$NON-NLS-1$ indicator = ind; } @@ -147,7 +147,7 @@ public class SystemMessage // otherwise we need to count the substitution variables. else { numSubs = 0; // initial value - String allText = level1NS + " " + level2NS; + String allText = level1NS + " " + level2NS; //$NON-NLS-1$ String subVar = subPrefix + new Integer(numSubs + 1).toString(); int subLoc = allText.indexOf(subVar); while (subLoc >= 0) { @@ -426,7 +426,7 @@ public class SystemMessage * Returns string of the form: msgId + severity + ":" + first-level-text */ public String toString() { - return getFullMessageID() + ": " + getLevelOneText(); + return getFullMessageID() + ": " + getLevelOneText(); //$NON-NLS-1$ } /** @@ -459,7 +459,7 @@ public class SystemMessage } */ - if (sub == null) return ""; + if (sub == null) return ""; //$NON-NLS-1$ if (sub instanceof Exception) { Exception exc = (Exception) sub; @@ -468,7 +468,7 @@ public class SystemMessage String msg = exc.toString(); //String msg = exc.getMessage(); if ((msg == null) || (exc instanceof ClassCastException)) msg = exc.getClass().getName(); - return msg + "\n" + excWriter.toString(); + return msg + "\n" + excWriter.toString(); //$NON-NLS-1$ } return sub.toString(); diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/SystemMessageFile.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/SystemMessageFile.java index c273e9845c9..5460020e27e 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/SystemMessageFile.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/messages/SystemMessageFile.java @@ -57,16 +57,16 @@ public class SystemMessageFile implements ErrorHandler // caching SystemMessage objects for previously issued messages. Phil private Hashtable messages = new Hashtable(); // XML TAG AND ELEMENT NAMES... - private static final String XML_TAG_COMPONENT = "Component"; - private static final String XML_TAG_SUBCOMPONENT = "Subcomponent"; - private static final String XML_TAG_MESSAGeList = "MessageList"; - private static final String XML_TAG_MESSAGE = "Message"; - private static final String XML_TAG_LEVELONE = "LevelOne"; - private static final String XML_TAG_LEVELTWO = "LevelTwo"; - private static final String XML_ATTR_ABBR = "Abbr"; - private static final String XML_ATTR_ID = "ID"; - private static final String XML_ATTR_INDICATOR = "Indicator"; - private static final String XML_ATTR_NAME = "Name"; + private static final String XML_TAG_COMPONENT = "Component"; //$NON-NLS-1$ + private static final String XML_TAG_SUBCOMPONENT = "Subcomponent"; //$NON-NLS-1$ + private static final String XML_TAG_MESSAGeList = "MessageList"; //$NON-NLS-1$ + private static final String XML_TAG_MESSAGE = "Message"; //$NON-NLS-1$ + private static final String XML_TAG_LEVELONE = "LevelOne"; //$NON-NLS-1$ + private static final String XML_TAG_LEVELTWO = "LevelTwo"; //$NON-NLS-1$ + private static final String XML_ATTR_ABBR = "Abbr"; //$NON-NLS-1$ + private static final String XML_ATTR_ID = "ID"; //$NON-NLS-1$ + private static final String XML_ATTR_INDICATOR = "Indicator"; //$NON-NLS-1$ + private static final String XML_ATTR_NAME = "Name"; //$NON-NLS-1$ @@ -163,13 +163,13 @@ public class SystemMessageFile implements ErrorHandler // DY Defect 42605 if (msgFile.getXMLDocument() == null) { - issueErrorMessage("No XML document for message file", echoErrorsToStandardOut); + issueErrorMessage("No XML document for message file", echoErrorsToStandardOut); //$NON-NLS-1$ return null; } // caching added by Phil to increase performance, and not to leave a trail of SystemMessage objects for // the garbage collector. Hopefully, the extra memory for the cache does not defeat these benefits. - SystemMessage msg = (SystemMessage)messages.get(msgFile.getMessageShortFileName()+":"+msgId); + SystemMessage msg = (SystemMessage)messages.get(msgFile.getMessageShortFileName()+":"+msgId); //$NON-NLS-1$ if (msg != null) { //System.out.println("Reusing msg " + msgId); @@ -185,7 +185,7 @@ public class SystemMessageFile implements ErrorHandler NodeList componentElementList = msgFile.getXMLDocument().getElementsByTagName(XML_TAG_COMPONENT); if ((componentElementList == null) || (componentElementList.getLength() == 0)) { - issueErrorMessage("Unable to find any Component elements",echoErrorsToStandardOut); + issueErrorMessage("Unable to find any Component elements",echoErrorsToStandardOut); //$NON-NLS-1$ return null; } @@ -197,7 +197,7 @@ public class SystemMessageFile implements ErrorHandler if ((subComponentList == null) || (subComponentList.getLength() == 0)) { - issueErrorMessage("Unable to find any Subcomponent elements",echoErrorsToStandardOut); + issueErrorMessage("Unable to find any Subcomponent elements",echoErrorsToStandardOut); //$NON-NLS-1$ return null; } @@ -213,8 +213,8 @@ public class SystemMessageFile implements ErrorHandler //String msgPrefix=componentAbbr+subComponentAbbr; String msgPrefix = (componentAbbr + subComponentAbbr).toUpperCase(); char msgIndicator=' '; - String msgL1=""; - String msgL2=""; + String msgL1=""; //$NON-NLS-1$ + String msgL2=""; //$NON-NLS-1$ // if the message prefix matches, then try to find the message //if (msgPrefix.toUpperCase().equals(msgId.toUpperCase().substring(0,msgPrefix.length())) && @@ -242,7 +242,7 @@ public class SystemMessageFile implements ErrorHandler messageListNode = (Element)msgListNodes.item(0); else { - issueWarningMessage("unable to find MessageList nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut); + issueWarningMessage("unable to find MessageList nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut); //$NON-NLS-1$ continue; } @@ -252,7 +252,7 @@ public class SystemMessageFile implements ErrorHandler NodeList msgNodes = messageListNode.getElementsByTagName(XML_TAG_MESSAGE); if ((msgNodes==null) || (msgNodes.getLength()==0)) { - issueWarningMessage("unable to find Message nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut); + issueWarningMessage("unable to find Message nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut); //$NON-NLS-1$ continue; } boolean match = false; // I added this so we stop looping when we find what we are looking for!!! Phil. @@ -291,7 +291,7 @@ public class SystemMessageFile implements ErrorHandler try { msg = loadSystemMessage(componentAbbr, subComponentAbbr, msgNumber, msgIndicator, msgL1, msgL2); - messages.put(msgFile.getMessageShortFileName()+":"+msgId, msg); // add to cache so we find it immediately next time!! + messages.put(msgFile.getMessageShortFileName()+":"+msgId, msg); // add to cache so we find it immediately next time!! //$NON-NLS-1$ return msg; } catch (IndicatorException e) @@ -329,7 +329,7 @@ public class SystemMessageFile implements ErrorHandler */ private String getNodeText(Node msgNode) { - String nodeText = ""; + String nodeText = ""; //$NON-NLS-1$ for (Node textNode=msgNode.getFirstChild(); textNode!=null; textNode=textNode.getNextSibling()) { @@ -349,12 +349,12 @@ public class SystemMessageFile implements ErrorHandler { boolean echoErrorsToStandardOut = true; if (msgFile.getXMLDocument() == null) - return issueErrorMessage("No XML document for message file", echoErrorsToStandardOut); + return issueErrorMessage("No XML document for message file", echoErrorsToStandardOut); //$NON-NLS-1$ // parse out the Abbr attr of the first Component element NodeList componentElementList = msgFile.getXMLDocument().getElementsByTagName(XML_TAG_COMPONENT); if ((componentElementList == null) || (componentElementList.getLength() == 0)) - return issueErrorMessage("Unable to find any Component elements",echoErrorsToStandardOut); + return issueErrorMessage("Unable to find any Component elements",echoErrorsToStandardOut); //$NON-NLS-1$ Element componentElement = (Element)componentElementList.item(0); String componentAbbr = componentElement.getAttribute(XML_ATTR_ABBR); @@ -363,7 +363,7 @@ public class SystemMessageFile implements ErrorHandler NodeList subComponentList=msgFile.getXMLDocument().getElementsByTagName(XML_TAG_SUBCOMPONENT); if ((subComponentList == null) || (subComponentList.getLength() == 0)) - return issueErrorMessage("Unable to find any Subcomponent elements",echoErrorsToStandardOut); + return issueErrorMessage("Unable to find any Subcomponent elements",echoErrorsToStandardOut); //$NON-NLS-1$ // scan all subcomponents... boolean anyDupes = false; @@ -381,14 +381,14 @@ public class SystemMessageFile implements ErrorHandler messageListNode = (Element)msgListNodes.item(0); else { - issueWarningMessage("unable to find MessageList nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut); + issueWarningMessage("unable to find MessageList nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut); //$NON-NLS-1$ continue; } NodeList msgNodes = messageListNode.getElementsByTagName(XML_TAG_MESSAGE); if ((msgNodes==null) || (msgNodes.getLength()==0)) { - issueWarningMessage("unable to find Message nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut); + issueWarningMessage("unable to find Message nodes for subComponent " + subComponentElement.getAttribute(XML_ATTR_NAME),echoErrorsToStandardOut); //$NON-NLS-1$ continue; } for (int msgIdx = 0; (msgIdx < msgNodes.getLength()); msgIdx++) @@ -398,7 +398,7 @@ public class SystemMessageFile implements ErrorHandler if (msgsById.contains(msgId)) { anyDupes = true; - issueWarningMessage("Warning: duplicate message " + msgId + " found", echoErrorsToStandardOut); + issueWarningMessage("Warning: duplicate message " + msgId + " found", echoErrorsToStandardOut); //$NON-NLS-1$ //$NON-NLS-2$ } else msgsById.addElement(msgId); @@ -417,12 +417,12 @@ public class SystemMessageFile implements ErrorHandler { boolean echoErrorsToStandardOut = true; if (msgFile.getXMLDocument() == null) - return issueErrorMessage("No XML document for message file", echoErrorsToStandardOut); + return issueErrorMessage("No XML document for message file", echoErrorsToStandardOut); //$NON-NLS-1$ // parse out the Abbr attr of the first Component element NodeList componentElementList = msgFile.getXMLDocument().getElementsByTagName(XML_TAG_COMPONENT); if ((componentElementList == null) || (componentElementList.getLength() == 0)) - return issueErrorMessage("Unable to find any Component elements",echoErrorsToStandardOut); + return issueErrorMessage("Unable to find any Component elements",echoErrorsToStandardOut); //$NON-NLS-1$ Element componentElement = (Element)componentElementList.item(0); String componentAbbr = componentElement.getAttribute(XML_ATTR_ABBR); @@ -431,29 +431,29 @@ public class SystemMessageFile implements ErrorHandler NodeList subComponentList=msgFile.getXMLDocument().getElementsByTagName(XML_TAG_SUBCOMPONENT); if ((subComponentList == null) || (subComponentList.getLength() == 0)) - return issueErrorMessage("Unable to find any Subcomponent elements",echoErrorsToStandardOut); + return issueErrorMessage("Unable to find any Subcomponent elements",echoErrorsToStandardOut); //$NON-NLS-1$ File outFile = new File(fullFileName); PrintWriter outFileStream = null; try { outFileStream = new PrintWriter(new FileOutputStream(outFile)); - outFileStream.println(" Message File "+msgFile.getMessageShortFileName()+" "); - outFileStream.println(""); - outFileStream.println(" "); - outFileStream.println("

"+componentElement.getAttribute(XML_ATTR_NAME)+" Messages

"); - outFileStream.println("
"); - outFileStream.println(""); - outFileStream.println(""); - outFileStream.println(""); - outFileStream.println(""); + outFileStream.println(" Message File "+msgFile.getMessageShortFileName()+" "); //$NON-NLS-1$ //$NON-NLS-2$ + outFileStream.println(""); //$NON-NLS-1$ + outFileStream.println(""); //$NON-NLS-1$ + outFileStream.println("

"+componentElement.getAttribute(XML_ATTR_NAME)+" Messages

"); //$NON-NLS-1$ //$NON-NLS-2$ + outFileStream.println("
"); //$NON-NLS-1$ + outFileStream.println("
"); - outFileStream.println("Sub-Component Summary
"); //$NON-NLS-1$ + outFileStream.println(""); //$NON-NLS-1$ + outFileStream.println(""); //$NON-NLS-1$ + outFileStream.println(""); //$NON-NLS-1$ } catch (IOException exc) { - return issueErrorMessage("Unable to open given html file in printHTML: " + exc.getMessage(), echoErrorsToStandardOut); + return issueErrorMessage("Unable to open given html file in printHTML: " + exc.getMessage(), echoErrorsToStandardOut); //$NON-NLS-1$ } // pre-scan all subcomponents... @@ -464,12 +464,12 @@ public class SystemMessageFile implements ErrorHandler String msgPrefix = (componentAbbr + subComponentAbbr).toUpperCase(); String scName = subComponentElement.getAttribute(XML_ATTR_NAME); - outFileStream.println(""); - outFileStream.println(""); - outFileStream.println(""); + outFileStream.println(""); //$NON-NLS-1$ + outFileStream.println(""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + outFileStream.println(""); //$NON-NLS-1$ //$NON-NLS-2$ } - outFileStream.println("
"); //$NON-NLS-1$ + outFileStream.println("Sub-Component Summary
"); - outFileStream.println(""+scName+"Message prefix="+msgPrefix+"
"); //$NON-NLS-1$ + outFileStream.println(""+scName+"Message prefix="+msgPrefix+"
"); + outFileStream.println(""); //$NON-NLS-1$ // scan all subcomponents... for (int subComponentIdx=0; subComponentIdx 0) - outFileStream.println("
"); + outFileStream.println("
"); //$NON-NLS-1$ String scName = subComponentElement.getAttribute(XML_ATTR_NAME); - outFileStream.println("

"+scName+" Messages

"); + outFileStream.println("

"+scName+" Messages

"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ for (int msgIdx = 0; (msgIdx < msgNodes.getLength()); msgIdx++) { Element node = (Element)msgNodes.item(msgIdx); String msgId = msgPrefix + node.getAttribute(XML_ATTR_ID); char msgIndicator=node.getAttribute(XML_ATTR_INDICATOR).toUpperCase().charAt(0); - String msgSeverity = "Unknown"; + String msgSeverity = "Unknown"; //$NON-NLS-1$ if (msgIndicator == SystemMessage.ERROR) - msgSeverity = "Error"; + msgSeverity = "Error"; //$NON-NLS-1$ else if (msgIndicator == SystemMessage.WARNING) - msgSeverity = "Warning"; + msgSeverity = "Warning"; //$NON-NLS-1$ else if (msgIndicator == SystemMessage.INQUIRY) - msgSeverity = "Question"; + msgSeverity = "Question"; //$NON-NLS-1$ else if (msgIndicator == SystemMessage.INFORMATION) - msgSeverity = "Information"; + msgSeverity = "Information"; //$NON-NLS-1$ else if (msgIndicator == SystemMessage.COMPLETION) - msgSeverity = "Completion"; + msgSeverity = "Completion"; //$NON-NLS-1$ else if (msgIndicator == SystemMessage.UNEXPECTED) - msgSeverity = "Unexpected"; + msgSeverity = "Unexpected"; //$NON-NLS-1$ - String msgL1 = ""; - String msgL2 = ""; + String msgL1 = ""; //$NON-NLS-1$ + String msgL2 = ""; //$NON-NLS-1$ // search for the l1 & l2 text for (Node msgNode=node.getFirstChild(); msgNode!=null; msgNode=msgNode.getNextSibling()) @@ -531,14 +531,14 @@ public class SystemMessageFile implements ErrorHandler else if (msgNode.getNodeName().equals(XML_TAG_LEVELTWO)) msgL2 = getNodeText(msgNode); } - outFileStream.println("

"+msgId+"

"); - outFileStream.println("Severity: "+msgSeverity+"
"); - outFileStream.println("LevelOne: "+msgL1+"
"); - outFileStream.println("LevelTwo: "+msgL2+"
"); + outFileStream.println("

"+msgId+"

"); //$NON-NLS-1$ //$NON-NLS-2$ + outFileStream.println("Severity: "+msgSeverity+"
"); //$NON-NLS-1$ //$NON-NLS-2$ + outFileStream.println("LevelOne: "+msgL1+"
"); //$NON-NLS-1$ //$NON-NLS-2$ + outFileStream.println("LevelTwo: "+msgL2+"
"); //$NON-NLS-1$ //$NON-NLS-2$ } - outFileStream.println("
"); + outFileStream.println("
"); //$NON-NLS-1$ } - outFileStream.println(""); + outFileStream.println(""); //$NON-NLS-1$ outFileStream.close(); return true; } @@ -554,7 +554,7 @@ public class SystemMessageFile implements ErrorHandler SystemBasePlugin.logError("MessageFile error for msg file " + msgFile.getMessageShortFileName() + ": " + errormsg); **/ if (echoStandardOut) - System.out.println("MessageFile error for msg file " + msgFile.getMessageShortFileName() + ": " + errormsg); + System.out.println("MessageFile error for msg file " + msgFile.getMessageShortFileName() + ": " + errormsg); //$NON-NLS-1$ //$NON-NLS-2$ return false; } /** @@ -566,7 +566,7 @@ public class SystemMessageFile implements ErrorHandler SystemBasePlugin.logError("MessageFile warning for msg file " + msgFile.getMessageShortFileName() + ": " + errormsg); */ if (echoStandardOut) - System.out.println("MessageFile warning for msg file " + msgFile.getMessageShortFileName() + ": " + errormsg); + System.out.println("MessageFile warning for msg file " + msgFile.getMessageShortFileName() + ": " + errormsg); //$NON-NLS-1$ //$NON-NLS-2$ return false; } @@ -674,7 +674,7 @@ public class SystemMessageFile implements ErrorHandler // the current parser hits a fatal exception. // This hack prevents that exception so that the // specified EntityResolver will get used. - in.setSystemId("foo"); + in.setSystemId("foo"); //$NON-NLS-1$ Document document = parser.parse(in); //Document document = parser.parse(messageFile); diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/HostProcessFilterImpl.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/HostProcessFilterImpl.java index 01da4585530..c64429d72f8 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/HostProcessFilterImpl.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/HostProcessFilterImpl.java @@ -40,7 +40,7 @@ import org.eclipse.rse.services.clientserver.NamePatternMatcher; public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISystemProcessRemoteConstants { - public static final String ALL = "*"; + public static final String ALL = "*"; //$NON-NLS-1$ protected static final char WILDCARD = '*'; @@ -107,15 +107,15 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy maxVM = -1; anystatus = true; initStates(); - status = ""; + status = ""; //$NON-NLS-1$ } protected void initInput(String input) { anystatus = true; - StringTokenizer tz = new StringTokenizer(input, "|"); - String strMinVM = "0"; - String strMaxVM = "-1"; + StringTokenizer tz = new StringTokenizer(input, "|"); //$NON-NLS-1$ + String strMinVM = "0"; //$NON-NLS-1$ + String strMaxVM = "-1"; //$NON-NLS-1$ if (tz.hasMoreTokens()) { @@ -154,9 +154,9 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy if (!(status == null)) { - if (!status.equals("")) + if (!status.equals("")) //$NON-NLS-1$ { - String[] allStates = status.split(","); + String[] allStates = status.split(","); //$NON-NLS-1$ if (!(allStates == null)) { initStates(); @@ -169,19 +169,19 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy } } - if (name == null || name.equals("")) + if (name == null || name.equals("")) //$NON-NLS-1$ name = ALL; - if (username == null || username.equals("")) + if (username == null || username.equals("")) //$NON-NLS-1$ username = ALL; - if (gid == null || gid.equals("")) + if (gid == null || gid.equals("")) //$NON-NLS-1$ gid = ALL; - if (ppid == null || ppid.equals("")) + if (ppid == null || ppid.equals("")) //$NON-NLS-1$ ppid = ALL; - if (pid == null || pid.equals("")) + if (pid == null || pid.equals("")) //$NON-NLS-1$ pid = ALL; try { @@ -227,7 +227,7 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy */ public String getUsername() { - if (_resolveVariables && username.equals("${user.id}")) + if (_resolveVariables && username.equals("${user.id}")) //$NON-NLS-1$ { return ALL; } @@ -272,7 +272,7 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy */ public String getMinVM() { - return "" + minVM; + return "" + minVM; //$NON-NLS-1$ } /** @@ -280,7 +280,7 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy */ public String getMaxVM() { - return "" + maxVM; + return "" + maxVM; //$NON-NLS-1$ } @@ -372,12 +372,12 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy */ public String toString() { - return name + "|" + username + "|" + gid + "|" + toStateString() + "|" + ppid + "|" + pid + "|" + minVM + "|" + maxVM; + return name + "|" + username + "|" + gid + "|" + toStateString() + "|" + ppid + "|" + pid + "|" + minVM + "|" + maxVM; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ } protected String toStateString() { - String s = " "; + String s = " "; //$NON-NLS-1$ if (!anystatus) { @@ -385,10 +385,10 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy { Boolean currentState = (Boolean) states.get(ALL_STATES_STR[i]); if (currentState.booleanValue()) s = s + ALL_STATES_STR[i]; - if (currentState.booleanValue()) s = s + ","; + if (currentState.booleanValue()) s = s + ","; //$NON-NLS-1$ } - if (!s.trim().equals("")) s = s.trim(); - if (s.endsWith(",")) s = s.substring(0, s.length() - 1); + if (!s.trim().equals("")) s = s.trim(); //$NON-NLS-1$ + if (s.endsWith(",")) s = s.substring(0, s.length() - 1); //$NON-NLS-1$ } return s; } @@ -405,7 +405,7 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy public boolean allows(String status) { NamePatternMatcher matcher = null; - String[] tokens = status.split("\\|"); + String[] tokens = status.split("\\|"); //$NON-NLS-1$ if (tokens.length < (PROCESS_ATTRIBUTES_COUNT -1)) return false; matcher = new NamePatternMatcher(gid, true, false); @@ -417,7 +417,7 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy String state = tokens[PROCESS_ATTRIBUTES_INDEX_STATUS].trim(); if (!satisfiesState(state)) return false; - if (getUsername().equals("${user.id}")) + if (getUsername().equals("${user.id}")) //$NON-NLS-1$ matcher = new NamePatternMatcher(ALL, true, false); else matcher = new NamePatternMatcher(getUsername(), true, false); @@ -433,7 +433,7 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy } catch (Exception e) { - if (tokens[PROCESS_ATTRIBUTES_INDEX_VMSIZE].trim().equals("")) vmSize = 0; + if (tokens[PROCESS_ATTRIBUTES_INDEX_VMSIZE].trim().equals("")) vmSize = 0; //$NON-NLS-1$ else return false; } if (!(vmSize >= minVM)) return false; @@ -459,7 +459,7 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy { if (!anystatus) { - String[] allStates = state.split(","); + String[] allStates = state.split(","); //$NON-NLS-1$ if (allStates == null) return false; if (allStates.length == 0) return false; boolean satisfied = false; diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/ISystemProcessRemoteConstants.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/ISystemProcessRemoteConstants.java index bbf629fe27f..c4555fdfed1 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/ISystemProcessRemoteConstants.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/ISystemProcessRemoteConstants.java @@ -150,45 +150,45 @@ public interface ISystemProcessRemoteConstants public static final String[] ALL_STATES_STR = { - "ASTATE_ACTIVE", - "ISTATE_IDLE", - "OSTATE_NONEXISTENT", - "WSTATE_PAGING", - "RSTATE_RUNNING", - "SSTATE_SLEEPING", - "TSTATE_TRACED", - "DSTATE_WAITING", - "ZSTATE_ZOMBIE", - "1STATE_ZOS_SINGLE", - "ASTATE_ZOS_MSGQRECEIVEWAIT", - "BSTATE_ZOS_MSGQSENDWAIT", - "CSTATE_ZOS_COMSYSKERNELWAIT", - "DSTATE_ZOS_SEMAPHOREWAIT", - "ESTATE_ZOS_QUIESCEFROZEN", - "FSTATE_ZOS_FILESYSKERNELWAIT", - "GSTATE_ZOS_MVSPAUSEWAIT", - "HSTATE_ZOS_PTHREADCREATEDTASKS", - "ISTATE_ZOS_SWAPPEDOUT", - "JSTATE_ZOS_PTHREADCREATED", - "KSTATE_ZOS_OTHERKERNELWAIT", - "LSTATE_ZOS_CANCELLED", - "MSTATE_ZOS_MULTITHREAD", - "NSTATE_ZOS_MEDIUMWEIGHTTHREAD", - "OSTATE_ZOS_ASYNCHRONOUSTHREAD", - "PSTATE_ZOS_PTRACEKERNELWAIT", - "RSTATE_ZOS_RUNNING", - "SSTATE_ZOS_SLEEPING", - "TSTATE_ZOS_STOPPED", - "USTATE_ZOS_INITIALPROCESSTHREAD", - "VSTATE_ZOS_DETACHED", - "WSTATE_ZOS_WAITINGFORCHILD", - "XSTATE_ZOS_FORKING", - "YSTATE_ZOS_MVSWAIT", - "ZSTATE_ZOS_ZOMBIE" + "ASTATE_ACTIVE", //$NON-NLS-1$ + "ISTATE_IDLE", //$NON-NLS-1$ + "OSTATE_NONEXISTENT", //$NON-NLS-1$ + "WSTATE_PAGING", //$NON-NLS-1$ + "RSTATE_RUNNING", //$NON-NLS-1$ + "SSTATE_SLEEPING", //$NON-NLS-1$ + "TSTATE_TRACED", //$NON-NLS-1$ + "DSTATE_WAITING", //$NON-NLS-1$ + "ZSTATE_ZOMBIE", //$NON-NLS-1$ + "1STATE_ZOS_SINGLE", //$NON-NLS-1$ + "ASTATE_ZOS_MSGQRECEIVEWAIT", //$NON-NLS-1$ + "BSTATE_ZOS_MSGQSENDWAIT", //$NON-NLS-1$ + "CSTATE_ZOS_COMSYSKERNELWAIT", //$NON-NLS-1$ + "DSTATE_ZOS_SEMAPHOREWAIT", //$NON-NLS-1$ + "ESTATE_ZOS_QUIESCEFROZEN", //$NON-NLS-1$ + "FSTATE_ZOS_FILESYSKERNELWAIT", //$NON-NLS-1$ + "GSTATE_ZOS_MVSPAUSEWAIT", //$NON-NLS-1$ + "HSTATE_ZOS_PTHREADCREATEDTASKS", //$NON-NLS-1$ + "ISTATE_ZOS_SWAPPEDOUT", //$NON-NLS-1$ + "JSTATE_ZOS_PTHREADCREATED", //$NON-NLS-1$ + "KSTATE_ZOS_OTHERKERNELWAIT", //$NON-NLS-1$ + "LSTATE_ZOS_CANCELLED", //$NON-NLS-1$ + "MSTATE_ZOS_MULTITHREAD", //$NON-NLS-1$ + "NSTATE_ZOS_MEDIUMWEIGHTTHREAD", //$NON-NLS-1$ + "OSTATE_ZOS_ASYNCHRONOUSTHREAD", //$NON-NLS-1$ + "PSTATE_ZOS_PTRACEKERNELWAIT", //$NON-NLS-1$ + "RSTATE_ZOS_RUNNING", //$NON-NLS-1$ + "SSTATE_ZOS_SLEEPING", //$NON-NLS-1$ + "TSTATE_ZOS_STOPPED", //$NON-NLS-1$ + "USTATE_ZOS_INITIALPROCESSTHREAD", //$NON-NLS-1$ + "VSTATE_ZOS_DETACHED", //$NON-NLS-1$ + "WSTATE_ZOS_WAITINGFORCHILD", //$NON-NLS-1$ + "XSTATE_ZOS_FORKING", //$NON-NLS-1$ + "YSTATE_ZOS_MVSWAIT", //$NON-NLS-1$ + "ZSTATE_ZOS_ZOMBIE" //$NON-NLS-1$ }; - public static final String PROCESS_MINER_ERROR_NO_HANDLER = "No handler for this system type"; - public static final String PROCESS_MINER_SUCCESS = "SUCCESS"; + public static final String PROCESS_MINER_ERROR_NO_HANDLER = "No handler for this system type"; //$NON-NLS-1$ + public static final String PROCESS_MINER_SUCCESS = "SUCCESS"; //$NON-NLS-1$ - public static final String PROCESS_SIGNAL_TYPE_DEFAULT = "default"; + public static final String PROCESS_SIGNAL_TYPE_DEFAULT = "default"; //$NON-NLS-1$ } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/ISystemProcessRemoteTypes.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/ISystemProcessRemoteTypes.java index 4462e7460da..b6672ba478a 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/ISystemProcessRemoteTypes.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/ISystemProcessRemoteTypes.java @@ -32,7 +32,7 @@ public interface ISystemProcessRemoteTypes * There is only one type category for remote processes. * It is "processes". */ - public static final String TYPECATEGORY = "processes"; + public static final String TYPECATEGORY = "processes"; //$NON-NLS-1$ // ----------- // TYPES... @@ -41,11 +41,11 @@ public interface ISystemProcessRemoteTypes /** * A process object */ - public static final String TYPE_PROCESS = "process"; + public static final String TYPE_PROCESS = "process"; //$NON-NLS-1$ /** * A root process object */ - public static final String TYPE_ROOT = "rootprocess"; + public static final String TYPE_ROOT = "rootprocess"; //$NON-NLS-1$ } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/ProcessHandlerManager.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/ProcessHandlerManager.java index 2075d67e882..89b5ccda8ba 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/ProcessHandlerManager.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/ProcessHandlerManager.java @@ -38,11 +38,11 @@ public class ProcessHandlerManager */ public ProcessHandler getNewProcessHandler() { - String osName = System.getProperty("os.name").toLowerCase(); - if (osName.startsWith("linux")) return new UniversalLinuxProcessHandler(); - else if (osName.startsWith("aix")) return new UniversalAIXProcessHandler(); - else if (osName.startsWith("z/os")) return new UniversalZOSProcessHandler(); - else if (osName.startsWith("mac os x")) return new UniversalMacOSXProcessHandler(); + String osName = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$ + if (osName.startsWith("linux")) return new UniversalLinuxProcessHandler(); //$NON-NLS-1$ + else if (osName.startsWith("aix")) return new UniversalAIXProcessHandler(); //$NON-NLS-1$ + else if (osName.startsWith("z/os")) return new UniversalZOSProcessHandler(); //$NON-NLS-1$ + else if (osName.startsWith("mac os x")) return new UniversalMacOSXProcessHandler(); //$NON-NLS-1$ else return null; } } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalAIXProcessHandler.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalAIXProcessHandler.java index 1ef039fbc36..8e2d9eb0256 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalAIXProcessHandler.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalAIXProcessHandler.java @@ -30,8 +30,8 @@ import org.eclipse.rse.services.clientserver.processes.ISystemProcessRemoteConst public class UniversalAIXProcessHandler implements ProcessHandler, ISystemProcessRemoteConstants { - private static final String[] processAttributes = {"pid","ppid","comm","uid","user","gid","vsz","s","rss"}; - private static final String firstColumnHeader = "PID"; + private static final String[] processAttributes = {"pid","ppid","comm","uid","user","gid","vsz","s","rss"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ + private static final String firstColumnHeader = "PID"; //$NON-NLS-1$ protected HashMap _usernamesByUid; protected HashMap _uidsByUserName; private HashMap stateMap; @@ -57,23 +57,23 @@ public class UniversalAIXProcessHandler implements ProcessHandler, ISystemProces SortedSet results = new TreeSet(new ProcessComparator()); // create the remote command with the AIX specific attributes - String cmdLine = "/usr/sysv/bin/ps -Alf -o "; + String cmdLine = "/usr/sysv/bin/ps -Alf -o "; //$NON-NLS-1$ for (int i = 0; i < processAttributes.length; i++) { cmdLine = cmdLine + processAttributes[i]; - if ((processAttributes.length - i > 1)) cmdLine = cmdLine + ","; + if ((processAttributes.length - i > 1)) cmdLine = cmdLine + ","; //$NON-NLS-1$ } // run the command and get output Process ps = Runtime.getRuntime().exec(cmdLine); InputStreamReader isr = new InputStreamReader(ps.getInputStream()); - if (isr == null) return null; + BufferedReader reader = new BufferedReader(isr); - if (reader == null) return null; + String nextLine = reader.readLine(); if (nextLine != null && nextLine.trim().startsWith(firstColumnHeader)) nextLine = reader.readLine(); while (nextLine != null) { - String statusLine = ""; + String statusLine = ""; //$NON-NLS-1$ // put the details of each process into a hashmap HashMap psLineContents = getPSOutput(nextLine); if (psLineContents == null) @@ -82,56 +82,56 @@ public class UniversalAIXProcessHandler implements ProcessHandler, ISystemProces continue; } - String pid = (String) psLineContents.get("pid"); - statusLine = pid + "|"; + String pid = (String) psLineContents.get("pid"); //$NON-NLS-1$ + statusLine = pid + "|"; //$NON-NLS-1$ // add the name to the status string - String name = (String) psLineContents.get("comm"); - if (name == null) name = " "; - statusLine = statusLine + name + "|"; + String name = (String) psLineContents.get("comm"); //$NON-NLS-1$ + if (name == null) name = " "; //$NON-NLS-1$ + statusLine = statusLine + name + "|"; //$NON-NLS-1$ // add the status letter to the status string - String state = (String) psLineContents.get("s"); - if (state == null) state = " "; + String state = (String) psLineContents.get("s"); //$NON-NLS-1$ + if (state == null) state = " "; //$NON-NLS-1$ String stateCode = convertToStateCode(state); - statusLine = statusLine + stateCode + "|"; + statusLine = statusLine + stateCode + "|"; //$NON-NLS-1$ // add the Tgid - String tgid = (String) psLineContents.get("tgid"); - if (tgid == null) tgid = " "; - statusLine = statusLine + tgid + "|"; + String tgid = (String) psLineContents.get("tgid"); //$NON-NLS-1$ + if (tgid == null) tgid = " "; //$NON-NLS-1$ + statusLine = statusLine + tgid + "|"; //$NON-NLS-1$ // add the Ppid - String pPid = (String) psLineContents.get("ppid"); - if (pPid == null) pPid = " "; - statusLine = statusLine + pPid + "|"; + String pPid = (String) psLineContents.get("ppid"); //$NON-NLS-1$ + if (pPid == null) pPid = " "; //$NON-NLS-1$ + statusLine = statusLine + pPid + "|"; //$NON-NLS-1$ // add the TracerPid - String tracerpid = (String) psLineContents.get("tracerpid"); - if (tracerpid == null) tracerpid = " "; - statusLine = statusLine + tracerpid + "|"; + String tracerpid = (String) psLineContents.get("tracerpid"); //$NON-NLS-1$ + if (tracerpid == null) tracerpid = " "; //$NON-NLS-1$ + statusLine = statusLine + tracerpid + "|"; //$NON-NLS-1$ - String uid = (String) psLineContents.get("uid"); - if (uid == null) uid = " "; - statusLine = statusLine + uid + "|"; // add the uid to the status string + String uid = (String) psLineContents.get("uid"); //$NON-NLS-1$ + if (uid == null) uid = " "; //$NON-NLS-1$ + statusLine = statusLine + uid + "|"; // add the uid to the status string //$NON-NLS-1$ - String username = (String) psLineContents.get("user"); - if (username == null) username = " "; - statusLine = statusLine + username + "|"; // add the username to the status string + String username = (String) psLineContents.get("user"); //$NON-NLS-1$ + if (username == null) username = " "; //$NON-NLS-1$ + statusLine = statusLine + username + "|"; // add the username to the status string //$NON-NLS-1$ // add the gid to the status string - String gid = (String) psLineContents.get("gid"); - if (gid == null) gid = " "; - statusLine = statusLine + gid + "|"; + String gid = (String) psLineContents.get("gid"); //$NON-NLS-1$ + if (gid == null) gid = " "; //$NON-NLS-1$ + statusLine = statusLine + gid + "|"; //$NON-NLS-1$ // add the VmSize to the status string - String vmsize = (String) psLineContents.get("vsz"); - if (vmsize == null) vmsize = " "; - statusLine = statusLine + vmsize + "|"; + String vmsize = (String) psLineContents.get("vsz"); //$NON-NLS-1$ + if (vmsize == null) vmsize = " "; //$NON-NLS-1$ + statusLine = statusLine + vmsize + "|"; //$NON-NLS-1$ // add the VmRSS to the status string - String vmrss = (String) psLineContents.get("rss"); - if (vmrss == null) vmrss = " "; + String vmrss = (String) psLineContents.get("rss"); //$NON-NLS-1$ + if (vmrss == null) vmrss = " "; //$NON-NLS-1$ statusLine = statusLine + vmrss; if (rpfs.allows(statusLine)) @@ -157,7 +157,7 @@ public class UniversalAIXProcessHandler implements ProcessHandler, ISystemProces protected HashMap getPSOutput(String nextLine) { HashMap contents = new HashMap(); - String[] values = nextLine.trim().split("\\s+"); + String[] values = nextLine.trim().split("\\s+"); //$NON-NLS-1$ if (values == null || values.length < processAttributes.length) return null; for (int i = 0; i < processAttributes.length; i++) { @@ -172,16 +172,16 @@ public class UniversalAIXProcessHandler implements ProcessHandler, ISystemProces public IHostProcess kill(IHostProcess process, String type) throws Exception { - if (type.equals(PROCESS_SIGNAL_TYPE_DEFAULT)) type = ""; - else type = "-" + type; + if (type.equals(PROCESS_SIGNAL_TYPE_DEFAULT)) type = ""; //$NON-NLS-1$ + else type = "-" + type; //$NON-NLS-1$ // formulate command to send kill signal - String cmdLine = "kill " + type + " " + process.getPid(); + String cmdLine = "kill " + type + " " + process.getPid(); //$NON-NLS-1$ //$NON-NLS-2$ Runtime.getRuntime().exec(cmdLine); // after the kill command is executed, the process might have changed // attributes, or might be gone, so requery HostProcessFilterImpl rpfs = new HostProcessFilterImpl(); - rpfs.setPid("" + process.getPid()); + rpfs.setPid("" + process.getPid()); //$NON-NLS-1$ SortedSet results = lookupProcesses(rpfs); if (results == null || results.size() == 0) return null; else return (IHostProcess) results.first(); @@ -234,19 +234,19 @@ public class UniversalAIXProcessHandler implements ProcessHandler, ISystemProces */ protected String convertToStateCode(String state) { - String stateCode = " "; + String stateCode = " "; //$NON-NLS-1$ if (state == null) return stateCode; - if (state.trim().equals("")) return stateCode; + if (state.trim().equals("")) return stateCode; //$NON-NLS-1$ for (int i = 0; i < state.length(); i++) { String nextState = (String) stateMap.get(new Character(state.charAt(i))); if (nextState != null) { stateCode = stateCode + nextState; - if (i < state.length() - 1) stateCode = stateCode + ","; + if (i < state.length() - 1) stateCode = stateCode + ","; //$NON-NLS-1$ } } - if (stateCode.trim().equals("")) return " "; + if (stateCode.trim().equals("")) return " "; //$NON-NLS-1$ //$NON-NLS-2$ else return stateCode.trim(); } } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalLinuxProcessHandler.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalLinuxProcessHandler.java index 73d80d2f387..7099c0db842 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalLinuxProcessHandler.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalLinuxProcessHandler.java @@ -56,16 +56,16 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon */ public IHostProcess kill(IHostProcess process, String type) throws Exception { - if (type.equals(PROCESS_SIGNAL_TYPE_DEFAULT)) type = ""; - else type = "-" + type; + if (type.equals(PROCESS_SIGNAL_TYPE_DEFAULT)) type = ""; //$NON-NLS-1$ + else type = "-" + type; //$NON-NLS-1$ // formulate command to send kill signal - String cmdLine = "kill " + type + " " + process.getPid(); + String cmdLine = "kill " + type + " " + process.getPid(); //$NON-NLS-1$ //$NON-NLS-2$ Runtime.getRuntime().exec(cmdLine); // after the kill command is executed, the process might have changed // attributes, or might be gone, so requery HostProcessFilterImpl rpfs = new HostProcessFilterImpl(); - rpfs.setPid("" + process.getPid()); + rpfs.setPid("" + process.getPid()); //$NON-NLS-1$ SortedSet results = lookupProcesses(rpfs); if (results == null || results.size() == 0) return null; else return (IHostProcess) results.first(); @@ -76,7 +76,7 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon */ public SortedSet lookupProcesses(IHostProcessFilter rpfs) throws Exception { - File procDir = new File("/proc"); + File procDir = new File("/proc"); //$NON-NLS-1$ if (!procDir.exists()) throw new Exception(FAILED_WITH_DOES_NOT_EXIST); @@ -86,7 +86,7 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon // list all subdirectories of /proc File[] processes; - if (rpfs.getPid().indexOf("*") == -1) + if (rpfs.getPid().indexOf("*") == -1) //$NON-NLS-1$ { processes = new File[1]; processes[0] = new File(procDir, rpfs.getPid()); @@ -103,72 +103,71 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon catch (NumberFormatException e) { continue; } - String statusLine = ""; + String statusLine = ""; //$NON-NLS-1$ try { // open the file containing the human-readable status info for the process - File statusFile = new File(processes[i], "status"); + File statusFile = new File(processes[i], "status"); //$NON-NLS-1$ if (!statusFile.exists() || !statusFile.canRead()) continue; // read the status info from the stat file FileReader fr = new FileReader(statusFile); - if (fr == null) continue; BufferedReader reader = new BufferedReader(fr); - if (reader == null) continue; + HashMap statusFileContents = getStatusFileContents(reader); - statusLine = processes[i].getName() + "|"; // add the pid to the status string + statusLine = processes[i].getName() + "|"; // add the pid to the status string //$NON-NLS-1$ // add the name to the status string - String name = (String) statusFileContents.get("name"); - if (name == null) name = " "; + String name = (String) statusFileContents.get("name"); //$NON-NLS-1$ + if (name == null) name = " "; //$NON-NLS-1$ //if (!pexematcher.matches(name)) continue; - statusLine = statusLine + name + "|"; + statusLine = statusLine + name + "|"; //$NON-NLS-1$ // add the status letter to the status string - String state = (String) statusFileContents.get("state"); - if (state == null) state = " "; + String state = (String) statusFileContents.get("state"); //$NON-NLS-1$ + if (state == null) state = " "; //$NON-NLS-1$ String stateCode = convertToStateCode(state); - statusLine = statusLine + stateCode + "|"; + statusLine = statusLine + stateCode + "|"; //$NON-NLS-1$ // add the Tgid - String tgid = (String) statusFileContents.get("tgid"); - if (tgid == null) tgid = " "; - statusLine = statusLine + tgid + "|"; + String tgid = (String) statusFileContents.get("tgid"); //$NON-NLS-1$ + if (tgid == null) tgid = " "; //$NON-NLS-1$ + statusLine = statusLine + tgid + "|"; //$NON-NLS-1$ // add the Ppid - String pPid = (String) statusFileContents.get("ppid"); - if (pPid == null) pPid = " "; + String pPid = (String) statusFileContents.get("ppid"); //$NON-NLS-1$ + if (pPid == null) pPid = " "; //$NON-NLS-1$ //if (!ppidmatcher.matches(pPid)) continue; - statusLine = statusLine + pPid + "|"; + statusLine = statusLine + pPid + "|"; //$NON-NLS-1$ // add the TracerPid - String tracerpid = (String) statusFileContents.get("tracerpid"); - if (tracerpid == null) tracerpid = " "; - statusLine = statusLine + tracerpid + "|"; + String tracerpid = (String) statusFileContents.get("tracerpid"); //$NON-NLS-1$ + if (tracerpid == null) tracerpid = " "; //$NON-NLS-1$ + statusLine = statusLine + tracerpid + "|"; //$NON-NLS-1$ - String uid = (String) statusFileContents.get("uid"); - if (uid == null) uid = " "; - statusLine = statusLine + uid + "|"; // add the uid to the status string + String uid = (String) statusFileContents.get("uid"); //$NON-NLS-1$ + if (uid == null) uid = " "; //$NON-NLS-1$ + statusLine = statusLine + uid + "|"; // add the uid to the status string //$NON-NLS-1$ String username = getUsername(uid); - if (username == null) username = " "; - statusLine = statusLine + username + "|"; // add the username to the status string + if (username == null) username = " "; //$NON-NLS-1$ + statusLine = statusLine + username + "|"; // add the username to the status string //$NON-NLS-1$ // add the gid to the status string - String gid = (String) statusFileContents.get("gid"); - if (gid == null) gid = " "; - statusLine = statusLine + gid + "|"; + String gid = (String) statusFileContents.get("gid"); //$NON-NLS-1$ + if (gid == null) gid = " "; //$NON-NLS-1$ + statusLine = statusLine + gid + "|"; //$NON-NLS-1$ // add the VmSize to the status string - String vmsize = (String) statusFileContents.get("vmsize"); - if (vmsize == null) vmsize = " "; - statusLine = statusLine + vmsize + "|"; + String vmsize = (String) statusFileContents.get("vmsize"); //$NON-NLS-1$ + if (vmsize == null) vmsize = " "; //$NON-NLS-1$ + statusLine = statusLine + vmsize + "|"; //$NON-NLS-1$ // add the VmRSS to the status string - String vmrss = (String) statusFileContents.get("vmrss"); - if (vmrss == null) vmrss = " "; + String vmrss = (String) statusFileContents.get("vmrss"); //$NON-NLS-1$ + if (vmrss == null) vmrss = " "; //$NON-NLS-1$ statusLine = statusLine + vmrss; reader.close(); @@ -221,8 +220,7 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon { while ((nextLine = reader.readLine()) != null) { - if (nextLine == null) break; - String key = nextLine.substring(0, nextLine.indexOf(":")).trim().toLowerCase(); + String key = nextLine.substring(0, nextLine.indexOf(":")).trim().toLowerCase(); //$NON-NLS-1$ String theRest = processStatusLine(nextLine, -1); StringTokenizer tz = new StringTokenizer(theRest); String value = null; @@ -245,10 +243,10 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon { if (length == -1) { - return line.substring(line.indexOf(":") + 1).trim(); + return line.substring(line.indexOf(":") + 1).trim(); //$NON-NLS-1$ } else - return line.substring(line.indexOf(":") + 1).trim().substring(0, length); + return line.substring(line.indexOf(":") + 1).trim().substring(0, length); //$NON-NLS-1$ } /** @@ -262,17 +260,16 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon try { // read the uid info using the getent command - Process ps = Runtime.getRuntime().exec("getent passwd"); + Process ps = Runtime.getRuntime().exec("getent passwd"); //$NON-NLS-1$ InputStreamReader isr = new InputStreamReader(ps.getInputStream()); - if (isr == null) return; + BufferedReader reader = new BufferedReader(isr); - if (reader == null) return; String nextLine; while ((nextLine = reader.readLine()) != null) { - String[] fields = nextLine.split(":"); + String[] fields = nextLine.split(":"); //$NON-NLS-1$ int length = fields.length; if (length < 3) continue; String uid = fields[2]; @@ -298,19 +295,19 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon */ protected String convertToStateCode(String state) { - String stateCode = " "; + String stateCode = " "; //$NON-NLS-1$ if (state == null) return stateCode; - if (state.trim().equals("")) return stateCode; + if (state.trim().equals("")) return stateCode; //$NON-NLS-1$ for (int i = 0; i < state.length(); i++) { String nextState = (String) stateMap.get(new Character(state.charAt(i))); if (nextState != null) { stateCode = stateCode + nextState; - if (i < state.length() - 1) stateCode = stateCode + ","; + if (i < state.length() - 1) stateCode = stateCode + ","; //$NON-NLS-1$ } } - if (stateCode.trim().equals("")) return " "; + if (stateCode.trim().equals("")) return " "; //$NON-NLS-1$ //$NON-NLS-2$ else return stateCode.trim(); } } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalMacOSXProcessHandler.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalMacOSXProcessHandler.java index 40fcbd990c0..61faa07c2c7 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalMacOSXProcessHandler.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalMacOSXProcessHandler.java @@ -33,12 +33,12 @@ public class UniversalMacOSXProcessHandler implements ProcessHandler { static { String[] strings = ISystemProcessRemoteConstants.ALL_STATES_STR; - stateMap.put("I", strings[ISystemProcessRemoteConstants.STATE_IDLE_INDEX]); - stateMap.put("R", strings[ISystemProcessRemoteConstants.STATE_RUNNING_INDEX]); - stateMap.put("S", strings[ISystemProcessRemoteConstants.STATE_SLEEPING_INDEX]); - stateMap.put("T", strings[ISystemProcessRemoteConstants.STATE_NONEXISTENT_INDEX]); - stateMap.put("U", strings[ISystemProcessRemoteConstants.STATE_WAITING_INDEX]); - stateMap.put("Z", strings[ISystemProcessRemoteConstants.STATE_ZOMBIE_INDEX]); + stateMap.put("I", strings[ISystemProcessRemoteConstants.STATE_IDLE_INDEX]); //$NON-NLS-1$ + stateMap.put("R", strings[ISystemProcessRemoteConstants.STATE_RUNNING_INDEX]); //$NON-NLS-1$ + stateMap.put("S", strings[ISystemProcessRemoteConstants.STATE_SLEEPING_INDEX]); //$NON-NLS-1$ + stateMap.put("T", strings[ISystemProcessRemoteConstants.STATE_NONEXISTENT_INDEX]); //$NON-NLS-1$ + stateMap.put("U", strings[ISystemProcessRemoteConstants.STATE_WAITING_INDEX]); //$NON-NLS-1$ + stateMap.put("Z", strings[ISystemProcessRemoteConstants.STATE_ZOMBIE_INDEX]); //$NON-NLS-1$ } /** @@ -53,7 +53,7 @@ public class UniversalMacOSXProcessHandler implements ProcessHandler { public SortedSet lookupProcesses(IHostProcessFilter rpfs) throws Exception { SortedSet results = new TreeSet(new ProcessComparator()); // Using -A is problematic - the command never returns! Using -a for now. - String command = "/bin/ps -awwo pid,ucomm,state,ppid,uid,user,gid,vsz,rss"; + String command = "/bin/ps -awwo pid,ucomm,state,ppid,uid,user,gid,vsz,rss"; //$NON-NLS-1$ Process ps = Runtime.getRuntime().exec(command); InputStreamReader isr = new InputStreamReader(ps.getInputStream()); BufferedReader reader = new BufferedReader(isr); @@ -61,7 +61,7 @@ public class UniversalMacOSXProcessHandler implements ProcessHandler { line = reader.readLine(); while (line != null) { // Input line looks like "pid ucomm state ppid uid user gid vsz rss" - String[] words = line.trim().split("\\s+"); + String[] words = line.trim().split("\\s+"); //$NON-NLS-1$ UniversalServerProcessImpl usp = new UniversalServerProcessImpl(); usp.setPid(words[0]); usp.setName(words[1]); @@ -72,8 +72,8 @@ public class UniversalMacOSXProcessHandler implements ProcessHandler { usp.setGid(words[6]); usp.setVmSizeInKB(words[7]); usp.setVmRSSInKB(words[8]); - usp.setTgid(""); - usp.setTracerPid(""); + usp.setTgid(""); //$NON-NLS-1$ + usp.setTracerPid(""); //$NON-NLS-1$ if (rpfs.allows(usp.getAllProperties())) { results.add(usp); } @@ -89,19 +89,19 @@ public class UniversalMacOSXProcessHandler implements ProcessHandler { */ public IHostProcess kill(IHostProcess process, String type) throws Exception { if (type.equals(ISystemProcessRemoteConstants.PROCESS_SIGNAL_TYPE_DEFAULT)) { - type = ""; + type = ""; //$NON-NLS-1$ } else { - type = "-" + type; + type = "-" + type; //$NON-NLS-1$ } // formulate command to send kill signal - String cmdLine = "kill " + type + " " + process.getPid(); + String cmdLine = "kill " + type + " " + process.getPid(); //$NON-NLS-1$ //$NON-NLS-2$ Runtime.getRuntime().exec(cmdLine); // after the kill command is executed, the process might have changed // attributes, or might be gone, so requery HostProcessFilterImpl rpfs = new HostProcessFilterImpl(); - rpfs.setPid("" + process.getPid()); + rpfs.setPid("" + process.getPid()); //$NON-NLS-1$ SortedSet results = lookupProcesses(rpfs); if (results == null || results.size() == 0) { return null; diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalServerProcessImpl.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalServerProcessImpl.java index 342c550f1d8..63eb5c37def 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalServerProcessImpl.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalServerProcessImpl.java @@ -31,18 +31,18 @@ public class UniversalServerProcessImpl implements IRemoteServerProcess, IServic */ public UniversalServerProcessImpl() { - _properties[PROCESS_ATTRIBUTES_INDEX_EXENAME] = " "; + _properties[PROCESS_ATTRIBUTES_INDEX_EXENAME] = " "; //$NON-NLS-1$ _properties[PROCESS_ATTRIBUTES_INDEX_GID] = new Long(-1); _properties[PROCESS_ATTRIBUTES_INDEX_PID] = new Long(-1); _properties[PROCESS_ATTRIBUTES_INDEX_PPID] = new Long(-1); - _properties[PROCESS_ATTRIBUTES_INDEX_STATUS] = new String(" "); + _properties[PROCESS_ATTRIBUTES_INDEX_STATUS] = new String(" "); //$NON-NLS-1$ _properties[PROCESS_ATTRIBUTES_INDEX_TGID] = new Long(-1); _properties[PROCESS_ATTRIBUTES_INDEX_TRACERPID] = new Long(-1); _properties[PROCESS_ATTRIBUTES_INDEX_UID] = new Long(-1); - _properties[PROCESS_ATTRIBUTES_INDEX_USERNAME] = " "; + _properties[PROCESS_ATTRIBUTES_INDEX_USERNAME] = " "; //$NON-NLS-1$ _properties[PROCESS_ATTRIBUTES_INDEX_VMSIZE] = new Long(-1); _properties[PROCESS_ATTRIBUTES_INDEX_VMRSS] = new Long(-1); - _properties[PROCESS_ATTRIBUTES_COUNT] = " "; //set the label + _properties[PROCESS_ATTRIBUTES_COUNT] = " "; //set the label //$NON-NLS-1$ } /** @@ -175,7 +175,7 @@ public class UniversalServerProcessImpl implements IRemoteServerProcess, IServic if (s != null && s.length() > 0) { - String[] str = s.split("\\"+TOKEN_SEPARATOR); + String[] str = s.split("\\"+TOKEN_SEPARATOR); //$NON-NLS-1$ int numOfExpectedTokens = PROCESS_ATTRIBUTES_COUNT; int tokens = str.length; if (tokens == numOfExpectedTokens) @@ -281,7 +281,7 @@ public class UniversalServerProcessImpl implements IRemoteServerProcess, IServic */ public String getAllProperties() { - String properties = ""; + String properties = ""; //$NON-NLS-1$ for (int i = 0; i < PROCESS_ATTRIBUTES_COUNT; i++) { properties = properties + _properties[i].toString(); diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalZOSProcessHandler.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalZOSProcessHandler.java index 51fade3b095..ef55264343f 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalZOSProcessHandler.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/processes/handlers/UniversalZOSProcessHandler.java @@ -27,8 +27,8 @@ import org.eclipse.rse.services.clientserver.processes.HostProcessFilterImpl; public class UniversalZOSProcessHandler extends UniversalAIXProcessHandler { - private static final String[] processAttributes = {"pid","ppid","comm","uid","user","gid","vsz","state"}; - private static final String firstColumnHeader = "PID"; + private static final String[] processAttributes = {"pid","ppid","comm","uid","user","gid","vsz","state"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ + private static final String firstColumnHeader = "PID"; //$NON-NLS-1$ private HashMap stateMap; /** @@ -53,23 +53,23 @@ public class UniversalZOSProcessHandler extends UniversalAIXProcessHandler SortedSet results = new TreeSet(new ProcessComparator()); // create the remote command with the AIX specific attributes - String cmdLine = "ps -A -o "; + String cmdLine = "ps -A -o "; //$NON-NLS-1$ for (int i = 0; i < processAttributes.length; i++) { cmdLine = cmdLine + processAttributes[i]; - if ((processAttributes.length - i > 1)) cmdLine = cmdLine + ","; + if ((processAttributes.length - i > 1)) cmdLine = cmdLine + ","; //$NON-NLS-1$ } // run the command and get output Process ps = Runtime.getRuntime().exec(cmdLine); InputStreamReader isr = new InputStreamReader(ps.getInputStream()); - if (isr == null) return null; + BufferedReader reader = new BufferedReader(isr); - if (reader == null) return null; + String nextLine = reader.readLine(); if (nextLine != null && nextLine.trim().startsWith(firstColumnHeader)) nextLine = reader.readLine(); while (nextLine != null) { - String statusLine = ""; + String statusLine = ""; //$NON-NLS-1$ // put the details of each process into a hashmap HashMap psLineContents = getPSOutput(nextLine); if (psLineContents == null) @@ -78,56 +78,56 @@ public class UniversalZOSProcessHandler extends UniversalAIXProcessHandler continue; } - String pid = (String) psLineContents.get("pid"); - statusLine = pid + "|"; + String pid = (String) psLineContents.get("pid"); //$NON-NLS-1$ + statusLine = pid + "|"; //$NON-NLS-1$ // add the name to the status string - String name = (String) psLineContents.get("comm"); - if (name == null) name = " "; - statusLine = statusLine + name + "|"; + String name = (String) psLineContents.get("comm"); //$NON-NLS-1$ + if (name == null) name = " "; //$NON-NLS-1$ + statusLine = statusLine + name + "|"; //$NON-NLS-1$ // add the status letter to the status string - String state = (String) psLineContents.get("state"); - if (state == null) state = " "; + String state = (String) psLineContents.get("state"); //$NON-NLS-1$ + if (state == null) state = " "; //$NON-NLS-1$ String stateCode = convertToStateCode(state); - statusLine = statusLine + stateCode + "|"; + statusLine = statusLine + stateCode + "|"; //$NON-NLS-1$ // add the Tgid - String tgid = (String) psLineContents.get("tgid"); - if (tgid == null) tgid = " "; - statusLine = statusLine + tgid + "|"; + String tgid = (String) psLineContents.get("tgid"); //$NON-NLS-1$ + if (tgid == null) tgid = " "; //$NON-NLS-1$ + statusLine = statusLine + tgid + "|"; //$NON-NLS-1$ // add the Ppid - String pPid = (String) psLineContents.get("ppid"); - if (pPid == null) pPid = " "; - statusLine = statusLine + pPid + "|"; + String pPid = (String) psLineContents.get("ppid"); //$NON-NLS-1$ + if (pPid == null) pPid = " "; //$NON-NLS-1$ + statusLine = statusLine + pPid + "|"; //$NON-NLS-1$ // add the TracerPid - String tracerpid = (String) psLineContents.get("tracerpid"); - if (tracerpid == null) tracerpid = " "; - statusLine = statusLine + tracerpid + "|"; + String tracerpid = (String) psLineContents.get("tracerpid"); //$NON-NLS-1$ + if (tracerpid == null) tracerpid = " "; //$NON-NLS-1$ + statusLine = statusLine + tracerpid + "|"; //$NON-NLS-1$ - String uid = (String) psLineContents.get("uid"); - if (uid == null) uid = " "; - statusLine = statusLine + uid + "|"; // add the uid to the status string + String uid = (String) psLineContents.get("uid"); //$NON-NLS-1$ + if (uid == null) uid = " "; //$NON-NLS-1$ + statusLine = statusLine + uid + "|"; // add the uid to the status string //$NON-NLS-1$ - String username = (String) psLineContents.get("user"); - if (username == null) username = " "; - statusLine = statusLine + username + "|"; // add the username to the status string + String username = (String) psLineContents.get("user"); //$NON-NLS-1$ + if (username == null) username = " "; //$NON-NLS-1$ + statusLine = statusLine + username + "|"; // add the username to the status string //$NON-NLS-1$ // add the gid to the status string - String gid = (String) psLineContents.get("gid"); - if (gid == null) gid = " "; - statusLine = statusLine + gid + "|"; + String gid = (String) psLineContents.get("gid"); //$NON-NLS-1$ + if (gid == null) gid = " "; //$NON-NLS-1$ + statusLine = statusLine + gid + "|"; //$NON-NLS-1$ // add the VmSize to the status string - String vmsize = (String) psLineContents.get("vsz"); - if (vmsize == null) vmsize = " "; - statusLine = statusLine + vmsize +"|"; + String vmsize = (String) psLineContents.get("vsz"); //$NON-NLS-1$ + if (vmsize == null) vmsize = " "; //$NON-NLS-1$ + statusLine = statusLine + vmsize +"|"; //$NON-NLS-1$ // add a dummy vmrss to the status string // vmRss is not available on ZOS - String vmrss = " "; + String vmrss = " "; //$NON-NLS-1$ statusLine = statusLine + vmrss; if (rpfs.allows(statusLine)) @@ -153,7 +153,7 @@ public class UniversalZOSProcessHandler extends UniversalAIXProcessHandler protected HashMap getPSOutput(String nextLine) { HashMap contents = new HashMap(); - String[] values = nextLine.trim().split("\\s+"); + String[] values = nextLine.trim().split("\\s+"); //$NON-NLS-1$ if (values == null || values.length < processAttributes.length) return null; for (int i = 0; i < processAttributes.length; i++) { @@ -168,19 +168,19 @@ public class UniversalZOSProcessHandler extends UniversalAIXProcessHandler */ protected String convertToStateCode(String state) { - String stateCode = " "; + String stateCode = " "; //$NON-NLS-1$ if (state == null) return stateCode; - if (state.trim().equals("")) return stateCode; + if (state.trim().equals("")) return stateCode; //$NON-NLS-1$ for (int i = 0; i < state.length(); i++) { String nextState = (String) stateMap.get(new Character(state.charAt(i))); if (nextState != null) { stateCode = stateCode + nextState; - if (i < state.length() - 1) stateCode = stateCode + ","; + if (i < state.length() - 1) stateCode = stateCode + ","; //$NON-NLS-1$ } } - if (stateCode.trim().equals("")) return " "; + if (stateCode.trim().equals("")) return " "; //$NON-NLS-1$ //$NON-NLS-2$ else return stateCode.trim(); } } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/search/SystemSearchFileNameMatcher.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/search/SystemSearchFileNameMatcher.java index d2bab3420d8..987be7e0113 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/search/SystemSearchFileNameMatcher.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/search/SystemSearchFileNameMatcher.java @@ -98,7 +98,7 @@ public class SystemSearchFileNameMatcher implements ISystemSearchMatcher { * @return true if the file names string is "*", false otherwise. */ public boolean isFileNamesStringAsterisk() { - return fileNamesString.equals("*"); + return fileNamesString.equals("*"); //$NON-NLS-1$ } /** diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/search/SystemSearchStringMatcher.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/search/SystemSearchStringMatcher.java index 23ee01dbbf8..9dcfbfabd01 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/search/SystemSearchStringMatcher.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/search/SystemSearchStringMatcher.java @@ -84,7 +84,7 @@ public class SystemSearchStringMatcher implements ISystemSearchMatcher { * @return true if the search string is "*", false otherwise. */ public boolean isSearchStringAsterisk() { - return searchString.equals("*"); + return searchString.equals("*"); //$NON-NLS-1$ } /** diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/search/SystemSearchUtil.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/search/SystemSearchUtil.java index 3f676172cbd..f227ddf3304 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/search/SystemSearchUtil.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/search/SystemSearchUtil.java @@ -32,7 +32,7 @@ public class SystemSearchUtil { private static SystemSearchUtil instance; - public static String FILE_NAMES_SEP_STRING = ","; + public static String FILE_NAMES_SEP_STRING = ","; //$NON-NLS-1$ /** * Constructor for the utility class. @@ -84,7 +84,7 @@ public class SystemSearchUtil { throw new NullPointerException(); } - if (fileNamesString.equals("")) { + if (fileNamesString.equals("")) { //$NON-NLS-1$ return new HashSet(); } @@ -116,7 +116,7 @@ public class SystemSearchUtil { throw new NullPointerException(); } - if (fileNamesString.equals("")) { + if (fileNamesString.equals("")) { //$NON-NLS-1$ return new ArrayList(); } @@ -178,7 +178,7 @@ public class SystemSearchUtil { // if it's not the first entry, then precede with ',' followed by space, i.e. ' ' if (!first) { result.append(FILE_NAMES_SEP_STRING); - result.append(" "); + result.append(" "); //$NON-NLS-1$ } // if first entry, don't do anything else { diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/util/tar/TarEntry.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/util/tar/TarEntry.java index 7b2800bd511..fdd7318ab21 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/util/tar/TarEntry.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/util/tar/TarEntry.java @@ -99,7 +99,7 @@ public class TarEntry implements ITarConstants, Cloneable { // if the name is an empty string, then don't fill in other fields, // since this indicates that we have reached end of file - if (getName().equals("")) { + if (getName().equals("")) { //$NON-NLS-1$ return; } @@ -145,7 +145,7 @@ public class TarEntry implements ITarConstants, Cloneable { // append null characters to the name for (int i = 0; i < length; i++) { - fileName = fileName + "\0"; + fileName = fileName + "\0"; //$NON-NLS-1$ } name = fileName.getBytes(); @@ -181,8 +181,8 @@ public class TarEntry implements ITarConstants, Cloneable { mod += 01; } - String modString = "0100" + Integer.toString(mod, 8) + "44"; - modString = modString + "\0"; + String modString = "0100" + Integer.toString(mod, 8) + "44"; //$NON-NLS-1$ //$NON-NLS-2$ + modString = modString + "\0"; //$NON-NLS-1$ mode = modString.getBytes(); } @@ -227,11 +227,11 @@ public class TarEntry implements ITarConstants, Cloneable { // prepend the string with 0s for (int i = 0; i < diff; i++) { - sizeString = "0" + sizeString; + sizeString = "0" + sizeString; //$NON-NLS-1$ } // append a space at the end - sizeString = sizeString + " "; + sizeString = sizeString + " "; //$NON-NLS-1$ size = sizeString.getBytes(); } @@ -260,11 +260,11 @@ public class TarEntry implements ITarConstants, Cloneable { // prepend the string with 0s for (int i = 0; i < diff; i++) { - mtimeString = "0" + mtimeString; + mtimeString = "0" + mtimeString; //$NON-NLS-1$ } // append a space at the end - mtimeString = mtimeString + " "; + mtimeString = mtimeString + " "; //$NON-NLS-1$ mtime = mtimeString.getBytes(); } @@ -330,7 +330,7 @@ public class TarEntry implements ITarConstants, Cloneable { // append null characters to the user name for (int i = 0; i < length; i++) { - userName = userName + "\0"; + userName = userName + "\0"; //$NON-NLS-1$ } uname = userName.getBytes(); @@ -384,7 +384,7 @@ public class TarEntry implements ITarConstants, Cloneable { String entryName = getName(); - if (entryName.endsWith("/")) { + if (entryName.endsWith("/")) { //$NON-NLS-1$ return true; } else { @@ -512,14 +512,14 @@ public class TarEntry implements ITarConstants, Cloneable { // prepend the string with 0s for (int i = 0; i < diff; i++) { - sumString = "0" + sumString; + sumString = "0" + sumString; //$NON-NLS-1$ } // append a null character - sumString = sumString + "\0"; + sumString = sumString + "\0"; //$NON-NLS-1$ // append a space - sumString = sumString + " "; + sumString = sumString + " "; //$NON-NLS-1$ // set the checksum chksum = sumString.getBytes(); diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/util/tar/TarFile.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/util/tar/TarFile.java index e1d03802a9a..bce17702b2e 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/util/tar/TarFile.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/util/tar/TarFile.java @@ -241,7 +241,7 @@ public class TarFile implements ITarConstants { // if the name of the entry is an empty string, it means we have reached end of file // so just return null - if (entry.getName().equals("")) { + if (entry.getName().equals("")) { //$NON-NLS-1$ return null; } else { @@ -283,7 +283,7 @@ public class TarFile implements ITarConstants { String entryName = entry.getName(); // if name of entry matches the given name, then that is the entry we are looking for - if (entryName.equals(name) || entryName.equals(name + "/")) { + if (entryName.equals(name) || entryName.equals(name + "/")) { //$NON-NLS-1$ return entry; } } diff --git a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/util/tar/TarOutputStream.java b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/util/tar/TarOutputStream.java index 53d516d8c7b..6d0f9e34384 100644 --- a/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/util/tar/TarOutputStream.java +++ b/rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/util/tar/TarOutputStream.java @@ -65,7 +65,7 @@ public class TarOutputStream extends OutputStream implements ITarConstants { private void ensureOpen() throws IOException { if (isClosed) { - throw new IOException("Stream closed"); + throw new IOException("Stream closed"); //$NON-NLS-1$ } } diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/Activator.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/Activator.java index b6833c4daec..884954fc0dc 100644 --- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/Activator.java +++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/Activator.java @@ -74,7 +74,7 @@ public class Activator extends Plugin { public void logException(Throwable t) { ILog log = getLog(); String id = getBundle().getSymbolicName(); - IStatus status = new Status(IStatus.ERROR, id, 0, "Unexpected exception", t); + IStatus status = new Status(IStatus.ERROR, id, 0, "Unexpected exception", t); //$NON-NLS-1$ log.log(status); } diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileCancelledException.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileCancelledException.java index c0a6b8d878a..df9db1c2136 100644 --- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileCancelledException.java +++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileCancelledException.java @@ -54,10 +54,10 @@ public class RemoteFileCancelledException extends RemoteFileIOException { * */ private static SystemMessage getMyMessage() { - String l1 = "Operation cancelled."; - String l2 = ""; + String l1 = "Operation cancelled."; //$NON-NLS-1$ + String l2 = ""; //$NON-NLS-1$ try { - myMessage = new SystemMessage("RSE", "G", "1067", SystemMessage.ERROR, l1, l2); + myMessage = new SystemMessage("RSE", "G", "1067", SystemMessage.ERROR, l1, l2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } catch (IndicatorException e) { } return myMessage; diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileException.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileException.java index 19dca2a167e..312164ecb19 100644 --- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileException.java +++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileException.java @@ -115,7 +115,7 @@ public class RemoteFileException extends SystemMessageException String msg = null; try { msg = bundle.getString(key); } catch (Exception exc) {} if (msg == null) - msg = "Message with key " + key + " not found"; + msg = "Message with key " + key + " not found"; //$NON-NLS-1$ //$NON-NLS-2$ return msg; } diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileIOException.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileIOException.java index 870577c61de..4922f6c83d1 100644 --- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileIOException.java +++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileIOException.java @@ -59,10 +59,10 @@ public class RemoteFileIOException extends RemoteFileException { * */ private static SystemMessage getMyMessage() { - String l1 = "Operation failed. File system input or output error"; - String l2 = "Message reported from file system: %1"; + String l1 = "Operation failed. File system input or output error"; //$NON-NLS-1$ + String l2 = "Message reported from file system: %1"; //$NON-NLS-1$ try { - myMessage = new SystemMessage("RSE", "F", "1002", SystemMessage.ERROR, l1, l2); + myMessage = new SystemMessage("RSE", "F", "1002", SystemMessage.ERROR, l1, l2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } catch (IndicatorException e) { } return myMessage; diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileSecurityException.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileSecurityException.java index 5d34cdd8838..92c12da1a11 100644 --- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileSecurityException.java +++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFileSecurityException.java @@ -58,10 +58,10 @@ public class RemoteFileSecurityException extends RemoteFileException { */ private static SystemMessage getMyMessage() { if (myMessage == null) { - String l1 = "Operation failed. Security violation"; - String l2 = "Message reported from file system: %1"; + String l1 = "Operation failed. Security violation"; //$NON-NLS-1$ + String l2 = "Message reported from file system: %1"; //$NON-NLS-1$ try { - myMessage = new SystemMessage("RSE", "F", "1001", SystemMessage.ERROR, l1, l2); + myMessage = new SystemMessage("RSE", "F", "1001", SystemMessage.ERROR, l1, l2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } catch (IndicatorException e) { } } diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFolderNotEmptyException.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFolderNotEmptyException.java index dd976b13228..4c7bf1893f1 100644 --- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFolderNotEmptyException.java +++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/RemoteFolderNotEmptyException.java @@ -58,10 +58,10 @@ public class RemoteFolderNotEmptyException extends RemoteFileException { */ private static SystemMessage getMyMessage() { if (myMessage == null) { - String l1 = "Folder is not empty. Cannot delete"; - String l2 = "The operation failed. One possible reason is that the folder is not empty"; + String l1 = "Folder is not empty. Cannot delete"; //$NON-NLS-1$ + String l2 = "The operation failed. One possible reason is that the folder is not empty"; //$NON-NLS-1$ try { - myMessage = new SystemMessage("RSE", "F", "1003", SystemMessage.ERROR, l1, l2); + myMessage = new SystemMessage("RSE", "F", "1003", SystemMessage.ERROR, l1, l2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } catch (IndicatorException e) { } } diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/search/IHostSearchResult.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/search/IHostSearchResult.java index f75a48c112d..a94cbf0bb62 100644 --- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/search/IHostSearchResult.java +++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/search/IHostSearchResult.java @@ -21,10 +21,10 @@ import org.eclipse.rse.services.clientserver.SystemSearchString; public interface IHostSearchResult { - public static final String SEARCH_RESULT_DELIMITER = ":SEARCH"; - public static final String SEARCH_RESULT_OPEN_DELIMITER = "<"; - public static final String SEARCH_RESULT_CLOSE_DELIMITER = ">"; - public static final String SEARCH_RESULT_INDEX_DELIMITER = ":"; + public static final String SEARCH_RESULT_DELIMITER = ":SEARCH"; //$NON-NLS-1$ + public static final String SEARCH_RESULT_OPEN_DELIMITER = "<"; //$NON-NLS-1$ + public static final String SEARCH_RESULT_CLOSE_DELIMITER = ">"; //$NON-NLS-1$ + public static final String SEARCH_RESULT_INDEX_DELIMITER = ":"; //$NON-NLS-1$ public void setParent(Object parent); diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/search/IHostSearchResultConfiguration.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/search/IHostSearchResultConfiguration.java index 5bf8e016a8a..d4e02aa6ff1 100644 --- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/search/IHostSearchResultConfiguration.java +++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/search/IHostSearchResultConfiguration.java @@ -38,7 +38,7 @@ public interface IHostSearchResultConfiguration extends IHostSearchConstants { /** * Gets the results contained within the resultContainer * @param resultContainer - * @return + * @return the results */ public IHostSearchResult[] getContainedResults(Object resultContainer); diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/old/FileTransferStatusListener.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/old/FileTransferStatusListener.java index 1994e8dfc2b..2dea2b29327 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/old/FileTransferStatusListener.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/old/FileTransferStatusListener.java @@ -46,7 +46,7 @@ public class FileTransferStatusListener extends StatusChangeListener _log = uploadLog; if (_log == null) { - throw new Exception("Could not find log in DataStore."); + throw new Exception("Could not find log in DataStore."); //$NON-NLS-1$ } setStatus(findOrCreateUploadStatus(ds)); } @@ -59,13 +59,13 @@ public class FileTransferStatusListener extends StatusChangeListener // but also need to handle case where it's been uploaded before in the sessoin (i.e. for reseting values) if (result == null) { - result = _log.getDataStore().createObject(_log, "uploadstatus", _remotePath); - result.setAttribute(DE.A_SOURCE, "running"); - result.setAttribute(DE.A_VALUE, ""); + result = _log.getDataStore().createObject(_log, "uploadstatus", _remotePath); //$NON-NLS-1$ + result.setAttribute(DE.A_SOURCE, "running"); //$NON-NLS-1$ + result.setAttribute(DE.A_VALUE, ""); //$NON-NLS-1$ DataElement cmd = ds.findCommandDescriptor(DataStoreSchema.C_SET); - DataElement setstatus = ds.command(cmd, _log, true); + ds.command(cmd, _log, true); /* try { @@ -83,8 +83,8 @@ public class FileTransferStatusListener extends StatusChangeListener else { - result.setAttribute(DE.A_SOURCE, "running"); - result.setAttribute(DE.A_VALUE, ""); + result.setAttribute(DE.A_SOURCE, "running"); //$NON-NLS-1$ + result.setAttribute(DE.A_VALUE, ""); //$NON-NLS-1$ } _statusElement = result; return result; diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/old/SearchResultsChangeListener.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/old/SearchResultsChangeListener.java index 3198a3de2c9..82ea8c810ca 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/old/SearchResultsChangeListener.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/old/SearchResultsChangeListener.java @@ -24,7 +24,6 @@ import org.eclipse.dstore.core.model.DataElement; import org.eclipse.dstore.core.model.DataStore; import org.eclipse.dstore.extra.internal.extra.DomainEvent; import org.eclipse.dstore.extra.internal.extra.IDomainListener; -import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.subsystems.CommunicationsEvent; import org.eclipse.rse.core.subsystems.ICommunicationsListener; import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants; @@ -83,14 +82,12 @@ public class SearchResultsChangeListener implements IDomainListener, ICommunicat _lastUpdateTime = 0; - ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry(); - //_factory = ((FileServiceSubSystem)_subsys).getRemoteFileFactory(); - if (_status.getValue().equals("done")) { + if (_status.getValue().equals("done")) { //$NON-NLS-1$ setDone(); } - else if (_status.getValue().equals("cancelled")) { + else if (_status.getValue().equals("cancelled")) { //$NON-NLS-1$ _cancelled = true; setDone(); } @@ -137,10 +134,10 @@ public class SearchResultsChangeListener implements IDomainListener, ICommunicat return; } - if (_status.getValue().equals("done")) { + if (_status.getValue().equals("done")) { //$NON-NLS-1$ setDone(); } - else if (_status.getValue().equals("cancelled")) { + else if (_status.getValue().equals("cancelled")) { //$NON-NLS-1$ _cancelled = true; setDone(); } @@ -180,7 +177,7 @@ public class SearchResultsChangeListener implements IDomainListener, ICommunicat // for defect 47414, this code changes the context used for creating IRemoteFiles char slash = '/'; - if (_subsys.getHost().getSystemType().equals("Windows")) { + if (_subsys.getHost().getSystemType().equals("Windows")) { //$NON-NLS-1$ slash = '\\'; } @@ -267,7 +264,7 @@ public class SearchResultsChangeListener implements IDomainListener, ICommunicat if (result.getNestedSize() > 0) { - boolean isWindows = _subsys.getHost().getSystemType().equals("Windows"); + boolean isWindows = _subsys.getHost().getSystemType().equals("Windows"); //$NON-NLS-1$ char separator = isWindows ? '\\' : '/'; List contents = new ArrayList(); @@ -283,12 +280,11 @@ public class SearchResultsChangeListener implements IDomainListener, ICommunicat searchResult.setText(resultElement.getName()); String source = resultElement.getSource().replace('\\', separator).replace('/', separator); - String path = source; + String lineNumStr = null; - int colonIndex = source.indexOf(":"); + int colonIndex = source.indexOf(":"); //$NON-NLS-1$ if (colonIndex > 2) { - path = source.substring(0, colonIndex); lineNumStr = source.substring(colonIndex); } diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/old/StatusChangeListener.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/old/StatusChangeListener.java index c4d5646c977..4c7a1624765 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/old/StatusChangeListener.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/old/StatusChangeListener.java @@ -67,7 +67,7 @@ public class StatusChangeListener implements IDomainListener, ICommunicationsLis } } } catch (Exception e) { - SystemBasePlugin.logError("StatusChangeListener.FindShell exception: ", e); + SystemBasePlugin.logError("StatusChangeListener.FindShell exception: ", e); //$NON-NLS-1$ } } } @@ -311,7 +311,7 @@ public class StatusChangeListener implements IDomainListener, ICommunicationsLis if (ICommunicationsDiagnostic.CANCEL_WAIT_REQUESTED == diagnostic.diagnosticStatus()) { cancelled = true; - SystemBasePlugin.logError("StatusChangeListener.waitForUpdate cancelled by user."); + SystemBasePlugin.logError("StatusChangeListener.waitForUpdate cancelled by user."); //$NON-NLS-1$ } } } @@ -366,7 +366,7 @@ public class StatusChangeListener implements IDomainListener, ICommunicationsLis if (ICommunicationsDiagnostic.CANCEL_WAIT_REQUESTED == diagnostic.diagnosticStatus()) { cancelled = true; - SystemBasePlugin.logError("StatusChangeListener.waitForUpdate cancelled by user."); + SystemBasePlugin.logError("StatusChangeListener.waitForUpdate cancelled by user."); //$NON-NLS-1$ } } } @@ -395,7 +395,7 @@ public class StatusChangeListener implements IDomainListener, ICommunicationsLis * @return true if status done, false otherwise. */ protected boolean determineStatusDone() { - return getStatus().getAttribute(DE.A_VALUE).equals("done") || getStatus().getAttribute(DE.A_NAME).equals("done"); + return getStatus().getAttribute(DE.A_VALUE).equals("done") || getStatus().getAttribute(DE.A_NAME).equals("done"); //$NON-NLS-1$ //$NON-NLS-2$ } /** @@ -423,15 +423,15 @@ public class StatusChangeListener implements IDomainListener, ICommunicationsLis try { String name = getStatus().getName(); /* Get the current element status name: started/working/done */ /* Log the current status */ - SystemBasePlugin.logError("StatusChangeListener."+name+": " + "Communications Diagnostic started"); - SystemBasePlugin.logError("StatusChangeListener."+name + - ": done = " + done + - "; cancelled = " + cancelled + - "; _networkDown = " + _networkDown ); + SystemBasePlugin.logError("StatusChangeListener."+name+": " + "Communications Diagnostic started"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SystemBasePlugin.logError("StatusChangeListener."+name + //$NON-NLS-1$ + ": done = " + done + //$NON-NLS-1$ + "; cancelled = " + cancelled + //$NON-NLS-1$ + "; _networkDown = " + _networkDown ); //$NON-NLS-1$ ds = target.getDataStore(); /* Log the status in DataStore */ - SystemBasePlugin.logError("StatusChangeListener."+name+"(DataStore): " + " isConnected = " + ds.isConnected() + "; isWaiting = " + ds.isWaiting(target)); + SystemBasePlugin.logError("StatusChangeListener."+name+"(DataStore): " + " isConnected = " + ds.isConnected() + "; isWaiting = " + ds.isWaiting(target)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ /*Log all nested DataElement's in target's parent*/ List deList = target.getParent().getNestedData(); @@ -441,10 +441,10 @@ public class StatusChangeListener implements IDomainListener, ICommunicationsLis { DataElement child = (DataElement) deList.get(i); if (child != null) { - SystemBasePlugin.logError("StatusChangeListener."+name+".child"+i+"(DataElement): " + child.toString()); + SystemBasePlugin.logError("StatusChangeListener."+name+".child"+i+"(DataElement): " + child.toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ DataElement descriptor = child.getDescriptor(); if (descriptor != null) - SystemBasePlugin.logError("StatusChangeListener."+name+".child"+i+"(Descriptor): " + descriptor.toString()); + SystemBasePlugin.logError("StatusChangeListener."+name+".child"+i+"(Descriptor): " + descriptor.toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } } @@ -462,7 +462,7 @@ public class StatusChangeListener implements IDomainListener, ICommunicationsLis } catch (Exception e) { - SystemBasePlugin.logError("StatusChangeListener.ICommunicationsDiagnostic exception: ", e); + SystemBasePlugin.logError("StatusChangeListener.ICommunicationsDiagnostic exception: ", e); //$NON-NLS-1$ } return d; // return the created diagnostic class instance diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/subsystem/DStoreFileSubSystemSearchResultConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/subsystem/DStoreFileSubSystemSearchResultConfiguration.java index 5d9ba7a03b1..cc7b630fcd8 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/subsystem/DStoreFileSubSystemSearchResultConfiguration.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/subsystem/DStoreFileSubSystemSearchResultConfiguration.java @@ -129,7 +129,7 @@ public class DStoreFileSubSystemSearchResultConfiguration extends DStoreSearchRe public void domainChanged(DomainEvent e) { - if (_status.getValue().equals("done")) + if (_status.getValue().equals("done")) //$NON-NLS-1$ { setStatus(FINISHED); diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/subsystem/DStoreJavaLanguageUtility.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/subsystem/DStoreJavaLanguageUtility.java index 89f11888dd8..1112243708e 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/subsystem/DStoreJavaLanguageUtility.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/subsystem/DStoreJavaLanguageUtility.java @@ -55,8 +55,7 @@ public class DStoreJavaLanguageUtility extends AbstractJavaLanguageUtility imple else { return null; } - - String remotePath = remoteFile.getAbsolutePath(); + DataElement deObj = ((DStoreHostFile)univFile.getHostFile()).getDataElement(); DataStore ds = deObj.getDataStore(); @@ -66,11 +65,11 @@ public class DStoreJavaLanguageUtility extends AbstractJavaLanguageUtility imple DataElement status = ds.synchronizedCommand(queryCmd, deObj, true); DataElement className = ds.find(status, DE.A_TYPE, TYPE_QUALIFIED_CLASSNAME, 1); - if (className != null && !className.equals("null")) { + if (className != null && !className.equals("null")) { //$NON-NLS-1$ return className.getName(); } else { - SystemBasePlugin.logWarning("Qualified class name for " + remoteFile.getAbsolutePath() + " is null"); + SystemBasePlugin.logWarning("Qualified class name for " + remoteFile.getAbsolutePath() + " is null"); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/subsystem/DStoreWindowsFileSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/subsystem/DStoreWindowsFileSubSystemConfiguration.java index f6ad237ca5d..823ecbb56e0 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/subsystem/DStoreWindowsFileSubSystemConfiguration.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/subsystem/DStoreWindowsFileSubSystemConfiguration.java @@ -38,7 +38,7 @@ public class DStoreWindowsFileSubSystemConfiguration extends DStoreFileSubSystem pool = mgr.createSystemFilterPool(getDefaultFilterPoolName(mgr.getName(), getId()), true); // true=>is deletable by user if (pool == null) // hmmm, why would this happen? { - SystemBasePlugin.logError("Creating default filter pool "+getDefaultFilterPoolName(mgr.getName(), getId())+" for mgr "+mgr.getName()+" failed.",null); + SystemBasePlugin.logError("Creating default filter pool "+getDefaultFilterPoolName(mgr.getName(), getId())+" for mgr "+mgr.getName()+" failed.",null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return null; } if (isUserPrivateProfile(mgr)) @@ -50,7 +50,7 @@ public class DStoreWindowsFileSubSystemConfiguration extends DStoreFileSubSystem Vector filterStrings = new Vector(); RemoteFileFilterString myHomeFilterString = new RemoteFileFilterString(this); myHomeFilterString.setPath(getSeparator()); - filterStrings.add(".\\*"); + filterStrings.add(".\\*"); //$NON-NLS-1$ ISystemFilter filter = mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_MYHOME,filterStrings); filter.setNonChangable(true); filter.setSingleFilterStringOnly(true); @@ -65,14 +65,14 @@ public class DStoreWindowsFileSubSystemConfiguration extends DStoreFileSubSystem } catch (Exception exc) { - SystemBasePlugin.logError("Error creating default filter pool",exc); + SystemBasePlugin.logError("Error creating default filter pool",exc); //$NON-NLS-1$ } return pool; } public String getSeparator() { - return "\\"; + return "\\"; //$NON-NLS-1$ } public char getSeparatorChar() diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/subsystem/RemoteFilePropertyChangeListener.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/subsystem/RemoteFilePropertyChangeListener.java index d7ad8d099b0..641a1dc02af 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/subsystem/RemoteFilePropertyChangeListener.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/subsystem/RemoteFilePropertyChangeListener.java @@ -88,7 +88,7 @@ public class RemoteFilePropertyChangeListener implements IDomainListener, catch (Exception e) { SystemBasePlugin.logError( - "StatusChangeListener.FindShell exception: ", e); + "StatusChangeListener.FindShell exception: ", e); //$NON-NLS-1$ } } } diff --git a/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/servicesubsystem/ServiceCommandShell.java b/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/servicesubsystem/ServiceCommandShell.java index 56f52795b37..bfdd153fb9a 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/servicesubsystem/ServiceCommandShell.java +++ b/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/servicesubsystem/ServiceCommandShell.java @@ -71,7 +71,7 @@ public class ServiceCommandShell extends RemoteCommandShell implements IServiceC { SimpleHostOutput line = (SimpleHostOutput)lineObj; - String type = event.isError() ? "stderr" : "stdout"; + String type = event.isError() ? "stderr" : "stdout"; //$NON-NLS-1$ //$NON-NLS-2$ if (event.isError()) { output = new RemoteError(this, type); diff --git a/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/servicesubsystem/ShellServiceSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/servicesubsystem/ShellServiceSubSystem.java index ddef2d0ea25..ab387cd4990 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/servicesubsystem/ShellServiceSubSystem.java +++ b/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/servicesubsystem/ShellServiceSubSystem.java @@ -22,7 +22,6 @@ import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.subsystems.IConnectorService; import org.eclipse.rse.core.subsystems.IServiceSubSystemConfiguration;