Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-05-25 05:17:14 -0400
committerUwe Stieber2012-05-25 05:17:14 -0400
commitc43ff2700cbc527f99e29eefe83f4586a4c2258e (patch)
tree483a85c908377cb05776c68fc06de57bb7f88e85 /target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src
parentcd822fb9e1041dbd02071a04b2b7963ac98be248 (diff)
downloadorg.eclipse.tcf-c43ff2700cbc527f99e29eefe83f4586a4c2258e.tar.gz
org.eclipse.tcf-c43ff2700cbc527f99e29eefe83f4586a4c2258e.tar.xz
org.eclipse.tcf-c43ff2700cbc527f99e29eefe83f4586a4c2258e.zip
Target Explorer: Fix more findbugs warnings
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/AbstractService.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/AbstractServiceManager.java34
2 files changed, 24 insertions, 12 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/AbstractService.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/AbstractService.java
index bc3ebfcb5..62ebf85b6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/AbstractService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/AbstractService.java
@@ -30,7 +30,7 @@ public abstract class AbstractService extends PlatformObject implements IService
*/
@Override
public final void setId(String id) {
- if (id == null) this.id = id;
+ if (this.id == null) this.id = id;
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/AbstractServiceManager.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/AbstractServiceManager.java
index 546d82b1c..c0e459ed2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/AbstractServiceManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/AbstractServiceManager.java
@@ -73,7 +73,7 @@ public abstract class AbstractServiceManager {
// Initialize the id field by reading the <id> extension attribute.
// Throws an exception if the id is empty or null.
id = config.getAttribute("id"); //$NON-NLS-1$
- if (id == null || (id != null && "".equals(id.trim()))) { //$NON-NLS-1$
+ if (id == null || "".equals(id.trim())) { //$NON-NLS-1$
throw new CoreException(new Status(IStatus.ERROR,
CoreBundleActivator.getUniqueIdentifier(),
NLS.bind(Messages.Extension_error_missingRequiredAttribute, "id", config.getContributor().getName()))); //$NON-NLS-1$
@@ -88,7 +88,7 @@ public abstract class AbstractServiceManager {
clazz = children[0].getAttribute("class"); //$NON-NLS-1$
}
}
- if (clazz == null || (clazz != null && "".equals(clazz.trim()))) { //$NON-NLS-1$
+ if (clazz == null || "".equals(clazz.trim())) { //$NON-NLS-1$
throw new CoreException(new Status(IStatus.ERROR,
CoreBundleActivator.getUniqueIdentifier(),
NLS.bind(Messages.Extension_error_missingRequiredAttribute, "class", config.getContributor().getName()))); //$NON-NLS-1$
@@ -128,13 +128,11 @@ public abstract class AbstractServiceManager {
if (unique) {
return (IService)service;
}
- else if (service instanceof IService) {
- this.service = (IService)service;
- }
- else {
- IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "Service '" + service.getClass().getName() + "' not of type IService."); //$NON-NLS-1$ //$NON-NLS-2$
- Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status);
- }
+ this.service = (IService)service;
+ }
+ else {
+ IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "Service '" + service.getClass().getName() + "' not of type IService."); //$NON-NLS-1$ //$NON-NLS-2$
+ Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status);
}
}
catch (CoreException e) {
@@ -259,14 +257,28 @@ public abstract class AbstractServiceManager {
return expression;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof IService) {
+ return equals((IService)obj);
+ }
+ if (obj instanceof ServiceProxy) {
+ return equals((ServiceProxy)obj);
+ }
+ return super.equals(obj);
+ }
+
public boolean equals(IService service) {
Assert.isNotNull(service);
- return clazz.equals(service.getClass().getCanonicalName());
+ return clazz != null ? clazz.equals(service.getClass().getCanonicalName()) : false;
}
public boolean equals(ServiceProxy proxy) {
Assert.isNotNull(proxy);
- return clazz.equals(proxy.clazz);
+ return clazz != null ? clazz.equals(proxy.clazz) : false;
}
}

Back to the top