Updated after code review. Modified attribute check for efficiency and hardened OSProcess selection using OSProcess.parseProcess()
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/AttachLaunchDelegate.java Mon Aug 10 15:50:55 2009 -0500
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/AttachLaunchDelegate.java Tue Aug 11 10:31:32 2009 -0500
@@ -133,7 +133,7 @@
String defaultProcessName = exeFile.getPath().removeFileExtension().lastSegment();
OSProcess attachTarget = null;
String choosenProcessTarget = config.getAttribute(SettingsData.AttachToProcessDialog_Selection, "");
- if (!choosenProcessTarget.contentEquals("")) {
+ if (choosenProcessTarget.length() > 0) {
attachTarget = chooseProcessTargetNoUI(processesOnTarget, choosenProcessTarget);
} else {
attachTarget = chooseProcessTarget(processesOnTarget, defaultProcessName);
@@ -206,7 +206,7 @@
attachTarget = null;
for (OSProcess process : processesOnTarget) {
- if (process.getName().contains(choosenProcessName)) {
+ if (process.parseProcess().getProcessName().equals(choosenProcessName)) {
attachTarget = process;
break;
}