Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-05-31 17:50:37 +0000
committerUwe Stieber2012-05-31 17:50:37 +0000
commit9a57024bf6b43d08285a09ba3316e0c5272ffa03 (patch)
treef365fb488a492d63476176bfb6259b119e87fb70 /target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm
parent75851083999fcbe274b9fc81887ed58985860ab8 (diff)
downloadorg.eclipse.tcf-9a57024bf6b43d08285a09ba3316e0c5272ffa03.tar.gz
org.eclipse.tcf-9a57024bf6b43d08285a09ba3316e0c5272ffa03.tar.xz
org.eclipse.tcf-9a57024bf6b43d08285a09ba3316e0c5272ffa03.zip
Target Explorer: Fix FindBugs warnings
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchConfigSorter.java11
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java26
2 files changed, 29 insertions, 8 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchConfigSorter.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchConfigSorter.java
index d4ba9c6b7..9143b2be7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchConfigSorter.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/LaunchConfigSorter.java
@@ -51,6 +51,17 @@ public class LaunchConfigSorter implements Comparable<LaunchConfigSorter> {
}
/* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof LaunchConfigSorter) {
+ return ranking == ((LaunchConfigSorter)obj).ranking;
+ }
+ return super.equals(obj);
+ }
+
+ /* (non-Javadoc)
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
@Override
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java
index 9c482faf5..885a96fb7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java
@@ -462,14 +462,19 @@ public class DefaultLaunchManagerDelegate extends ExecutableExtension implements
*/
@Override
public void validate(String launchMode, ILaunchConfiguration launchConfig) throws LaunchServiceException {
- String missingAttributes = null;
+ StringBuilder missingAttributes = new StringBuilder();
for (String attribute : getMandatoryAttributes()) {
if (!isValidAttribute(attribute, launchConfig, launchMode)) {
- missingAttributes = (missingAttributes == null) ? attribute : missingAttributes + ", " + attribute; //$NON-NLS-1$
+ if (missingAttributes.length() == 0) {
+ missingAttributes.append(attribute);
+ } else {
+ missingAttributes.append(", "); //$NON-NLS-1$
+ missingAttributes.append(attribute);
+ }
}
}
- if (missingAttributes != null) {
- throw new LaunchServiceException("Missing launch configuration attributes: " + '\n' + missingAttributes, LaunchServiceException.TYPE_MISSING_LAUNCH_CONFIG_ATTR); //$NON-NLS-1$
+ if (missingAttributes.length() > 0) {
+ throw new LaunchServiceException("Missing launch configuration attributes: " + '\n' + missingAttributes.toString(), LaunchServiceException.TYPE_MISSING_LAUNCH_CONFIG_ATTR); //$NON-NLS-1$
}
}
@@ -500,15 +505,20 @@ public class DefaultLaunchManagerDelegate extends ExecutableExtension implements
*/
@Override
public void validate(ILaunchSpecification launchSpec) throws LaunchServiceException {
- String missingAttributes = null;
+ StringBuilder missingAttributes = new StringBuilder();
for (String attribute : getMandatoryAttributes()) {
if (launchSpec == null || !launchSpec.hasAttribute(attribute)) {
// Remember the missing attribute for adding the list to the exception.
- missingAttributes = (missingAttributes == null) ? attribute : missingAttributes + ", " + attribute; //$NON-NLS-1$
+ if (missingAttributes.length() == 0) {
+ missingAttributes.append(attribute);
+ } else {
+ missingAttributes.append(", "); //$NON-NLS-1$
+ missingAttributes.append(attribute);
+ }
}
}
- if (missingAttributes != null) {
- throw new LaunchServiceException("Missing launch specification attributes: " + '\n' + missingAttributes, LaunchServiceException.TYPE_MISSING_LAUNCH_SPEC_ATTR); //$NON-NLS-1$
+ if (missingAttributes.length() > 0) {
+ throw new LaunchServiceException("Missing launch specification attributes: " + '\n' + missingAttributes.toString(), LaunchServiceException.TYPE_MISSING_LAUNCH_SPEC_ATTR); //$NON-NLS-1$
}
}

Back to the top