Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2013-04-14 19:48:15 -0400
committerEugene Tarassov2013-04-14 19:48:15 -0400
commitbc7419e92bbf4fea2b35fe61f58e38cb04307cd0 (patch)
tree6efff0974742067b324def6d6092ab5e9a1816d2 /plugins
parentd71cd8a9992ce8030562c53bcc3372ed91aa1b16 (diff)
downloadorg.eclipse.tcf-bc7419e92bbf4fea2b35fe61f58e38cb04307cd0.tar.gz
org.eclipse.tcf-bc7419e92bbf4fea2b35fe61f58e38cb04307cd0.tar.xz
org.eclipse.tcf-bc7419e92bbf4fea2b35fe61f58e38cb04307cd0.zip
TCF Core: fixed high priority FindBugs warnings
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/ServerTCP.java2
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java11
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/protocol/Protocol.java2
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFAnnotationProvider.java5
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFPresentationProvider.java5
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFPrettyExpressionProvider.java5
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFMemoryRegion.java6
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/tests/TestStreams.java2
-rw-r--r--plugins/org.eclipse.tcf.rse/src/org/eclipse/tcf/internal/rse/TCFConnectorService.java2
-rw-r--r--plugins/org.eclipse.tcf.rse/src/org/eclipse/tcf/internal/rse/TCFConnectorServiceManager.java2
10 files changed, 27 insertions, 15 deletions
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/ServerTCP.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/ServerTCP.java
index 3234a6abf..74e02b511 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/ServerTCP.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/ServerTCP.java
@@ -96,7 +96,7 @@ public class ServerTCP extends ServerSocket {
if (addr.isLinkLocalAddress()) return getTransientPeer(addr);
String host = addr.getHostAddress();
for (ServerPeer p : peers) {
- if (addr.equals(p.getAttributes().get(IPeer.ATTR_IP_HOST))) return p;
+ if (host.equals(p.getAttributes().get(IPeer.ATTR_IP_HOST))) return p;
}
String port = Integer.toString(getLocalPort());
Map<String,String> attrs = new HashMap<String,String>();
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java
index 46ac6ef9b..eb104ecbc 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java
@@ -63,6 +63,8 @@ public class LocatorService implements ILocator {
private static final int PREF_PACKET_SIZE = 1500 - 40 - 8;
private static LocatorService locator;
+ private static LocalPeer local_peer;
+
private static final Map<String,IPeer> peers = new HashMap<String,IPeer>();
private static final ArrayList<LocatorListener> listeners = new ArrayList<LocatorListener>();
private static final HashSet<String> error_log = new HashSet<String>();
@@ -170,8 +172,6 @@ public class LocatorService implements ILocator {
private static final HashMap<String,AddressCacheItem> addr_cache = new HashMap<String,AddressCacheItem>();
private static boolean addr_request;
- private static LocalPeer local_peer;
-
private DatagramSocket socket;
private long last_master_packet_time;
@@ -350,9 +350,12 @@ public class LocatorService implements ILocator {
return socket;
}
- public LocatorService() {
- locator = this;
+ public static void createLocalInstance() {
local_peer = new LocalPeer();
+ locator = new LocatorService();
+ }
+
+ public LocatorService() {
try {
loopback_addr = InetAddress.getByName(null);
out_buf[0] = 'T';
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/protocol/Protocol.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/protocol/Protocol.java
index 719c7eb72..e97d43429 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/protocol/Protocol.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/protocol/Protocol.java
@@ -118,7 +118,7 @@ public final class Protocol {
event_queue.invokeLater(new Runnable() {
public void run() {
- new LocatorService();
+ LocatorService.createLocalInstance();
}
});
timer_dispatcher.setName("TCF Timer Dispatcher");
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFAnnotationProvider.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFAnnotationProvider.java
index 4669dc615..5e62ade31 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFAnnotationProvider.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFAnnotationProvider.java
@@ -37,7 +37,7 @@ public class TCFAnnotationProvider {
public static ITCFAnnotationProvider getAnnotationProvider(Object selection) {
if (selection == null) return null;
if (providers == null) {
- providers = new ArrayList<ITCFAnnotationProvider>();
+ ArrayList<ITCFAnnotationProvider> list = new ArrayList<ITCFAnnotationProvider>();
try {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(
Activator.PLUGIN_ID, "annotation_provider"); //$NON-NLS-1$
@@ -51,7 +51,7 @@ public class TCFAnnotationProvider {
String nm = e[j].getName();
if (nm.equals("class")) { //$NON-NLS-1$
Class<?> c = bundle.loadClass(e[j].getAttribute("name")); //$NON-NLS-1$
- providers.add((ITCFAnnotationProvider)c.newInstance());
+ list.add((ITCFAnnotationProvider)c.newInstance());
}
}
}
@@ -63,6 +63,7 @@ public class TCFAnnotationProvider {
catch (Exception x) {
Activator.log("Cannot access annotation provider extension points", x);
}
+ providers = list;
}
for (ITCFAnnotationProvider p : providers) {
if (p.isSupportedSelection(selection)) return p;
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFPresentationProvider.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFPresentationProvider.java
index 5940d3cc3..d6153fded 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFPresentationProvider.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFPresentationProvider.java
@@ -30,7 +30,7 @@ public class TCFPresentationProvider {
public static Iterable<ITCFPresentationProvider> getPresentationProviders() {
if (providers == null) {
- providers = new ArrayList<ITCFPresentationProvider>();
+ ArrayList<ITCFPresentationProvider> list = new ArrayList<ITCFPresentationProvider>();
try {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(
Activator.PLUGIN_ID, "presentation_provider"); //$NON-NLS-1$
@@ -44,7 +44,7 @@ public class TCFPresentationProvider {
String nm = e[j].getName();
if (nm.equals("class")) { //$NON-NLS-1$
Class<?> c = bundle.loadClass(e[j].getAttribute("name")); //$NON-NLS-1$
- providers.add((ITCFPresentationProvider)c.newInstance());
+ list.add((ITCFPresentationProvider)c.newInstance());
}
}
}
@@ -56,6 +56,7 @@ public class TCFPresentationProvider {
catch (Exception x) {
Activator.log("Cannot access presentation provider extension points", x);
}
+ providers = list;
}
return providers;
}
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFPrettyExpressionProvider.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFPrettyExpressionProvider.java
index 49d1c02e9..1f80da13f 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFPrettyExpressionProvider.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFPrettyExpressionProvider.java
@@ -35,7 +35,7 @@ public class TCFPrettyExpressionProvider {
public static Collection<ITCFPrettyExpressionProvider> getProviders() {
if (providers == null) {
- providers = new ArrayList<ITCFPrettyExpressionProvider>();
+ ArrayList<ITCFPrettyExpressionProvider> list = new ArrayList<ITCFPrettyExpressionProvider>();
try {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(
Activator.PLUGIN_ID, "pretty_expression_provider"); //$NON-NLS-1$
@@ -49,7 +49,7 @@ public class TCFPrettyExpressionProvider {
String nm = e[j].getName();
if (nm.equals("class")) { //$NON-NLS-1$
Class<?> c = bundle.loadClass(e[j].getAttribute("name")); //$NON-NLS-1$
- providers.add((ITCFPrettyExpressionProvider)c.newInstance());
+ list.add((ITCFPrettyExpressionProvider)c.newInstance());
}
}
}
@@ -61,6 +61,7 @@ public class TCFPrettyExpressionProvider {
catch (Exception x) {
Activator.log("Cannot access pretty expression provider extension points", x);
}
+ providers = list;
}
return providers;
}
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFMemoryRegion.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFMemoryRegion.java
index e37bdb29b..415709e5e 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFMemoryRegion.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFMemoryRegion.java
@@ -44,4 +44,10 @@ public class TCFMemoryRegion extends org.eclipse.tcf.util.TCFMemoryRegion implem
}
return false;
}
+
+ @Override
+ public int hashCode() {
+ if (addr == null) return 0;
+ return addr.hashCode();
+ }
}
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/tests/TestStreams.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/tests/TestStreams.java
index 10c3d165e..c6be64cde 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/tests/TestStreams.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/tests/TestStreams.java
@@ -149,7 +149,7 @@ class TestStreams implements ITCFTest, IStreams.StreamsListener {
private void testReadWrite(final boolean skip_zeros, final Runnable done) {
final byte[] data_out = new byte[rnd.nextInt(10000) + 1000];
- new Random().nextBytes(data_out);
+ rnd.nextBytes(data_out);
if (skip_zeros) data_out[0] = 1;
final HashSet<IToken> cmds = new HashSet<IToken>();
IStreams.DoneRead done_read = new IStreams.DoneRead() {
diff --git a/plugins/org.eclipse.tcf.rse/src/org/eclipse/tcf/internal/rse/TCFConnectorService.java b/plugins/org.eclipse.tcf.rse/src/org/eclipse/tcf/internal/rse/TCFConnectorService.java
index e49cb0294..68964c0ff 100644
--- a/plugins/org.eclipse.tcf.rse/src/org/eclipse/tcf/internal/rse/TCFConnectorService.java
+++ b/plugins/org.eclipse.tcf.rse/src/org/eclipse/tcf/internal/rse/TCFConnectorService.java
@@ -229,7 +229,7 @@ public class TCFConnectorService extends StandardConnectorService implements ITC
String host = getHostName().toLowerCase();
int port = getConnectPort();
if (port <= 0) {
- //Default fallback
+ // Default fallback
port = TCFConnectorServiceManager.TCF_PORT;
}
IPeer peer = null;
diff --git a/plugins/org.eclipse.tcf.rse/src/org/eclipse/tcf/internal/rse/TCFConnectorServiceManager.java b/plugins/org.eclipse.tcf.rse/src/org/eclipse/tcf/internal/rse/TCFConnectorServiceManager.java
index e96959778..e2c6ca188 100644
--- a/plugins/org.eclipse.tcf.rse/src/org/eclipse/tcf/internal/rse/TCFConnectorServiceManager.java
+++ b/plugins/org.eclipse.tcf.rse/src/org/eclipse/tcf/internal/rse/TCFConnectorServiceManager.java
@@ -18,7 +18,7 @@ import org.eclipse.rse.core.subsystems.ISubSystem;
public class TCFConnectorServiceManager extends AbstractConnectorServiceManager {
- public static int TCF_PORT = 1534;
+ public static final int TCF_PORT = 1534;
private static final TCFConnectorServiceManager manager =
new TCFConnectorServiceManager();

Back to the top