Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-06-01 08:52:42 +0000
committerUwe Stieber2012-06-01 09:25:36 +0000
commitd9557464e69f6c957e7c6fe3136d033b07cfa30b (patch)
treeaf288422bf250a7f7b05ca6a9d0b71fa0c84eba7 /target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core
parentf07d102f800e0d8b873d1ab1a4d040ac516d536c (diff)
downloadorg.eclipse.tcf-d9557464e69f6c957e7c6fe3136d033b07cfa30b.tar.gz
org.eclipse.tcf-d9557464e69f6c957e7c6fe3136d033b07cfa30b.tar.xz
org.eclipse.tcf-d9557464e69f6c957e7c6fe3136d033b07cfa30b.zip
Target Explorer: Fix FindBugs warnings
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsStreamsListener.java46
2 files changed, 31 insertions, 23 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java
index c37cacc94..9da0fc1a1 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java
@@ -211,7 +211,7 @@ public class TerminalsLauncher extends PlatformObject implements ITerminalsLaunc
String message = NLS.bind(Messages.TerminalsLauncher_error_terminalExitFailed, context.getProcessID());
message += Messages.TerminalsLauncher_error_possibleCauseUnknown;
- IStatus status = new Status(IStatus.WARNING, CoreBundleActivator.getUniqueIdentifier(), message, error);
+ IStatus status = new Status(IStatus.WARNING, CoreBundleActivator.getUniqueIdentifier(), message);
Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status);
// Dispose the launcher directly
@@ -599,7 +599,7 @@ public class TerminalsLauncher extends PlatformObject implements ITerminalsLaunc
Map<String, String> env = (Map<String, String>)properties.getProperty(ITerminalsLauncher.PROP_TERMINAL_ENV);
// Launch the remote terminal
- getSvcTerminals().launch(type, encoding, makeEnvironmentArray(env), new ITerminals.DoneLaunch() {
+ getSvcTerminals().launch(type, encoding, env != null ? makeEnvironmentArray(env) : null, new ITerminals.DoneLaunch() {
@Override
public void doneLaunch(IToken token, Exception error, ITerminals.TerminalContext terminal) {
if (error != null) {
@@ -803,11 +803,11 @@ public class TerminalsLauncher extends PlatformObject implements ITerminalsLaunc
/**
* Makes an environment array out of the given map.
*
- * @param env The environment map or <code>null</code>.
+ * @param env The environment map. Must not be <code>null</code>.
* @return The string.
*/
private String[] makeEnvironmentArray(Map<String, String> env) {
- if (env == null) return null;
+ Assert.isNotNull(env);
List<String> envList = new ArrayList<String>();
for (Entry<String, String> entry : env.entrySet()) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsStreamsListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsStreamsListener.java
index 94d008580..3dc3299aa 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsStreamsListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsStreamsListener.java
@@ -248,7 +248,7 @@ public class TerminalsStreamsListener implements IStreams.StreamsListener, ITerm
*
* @param task The currently active reader task or <code>null</code>.
*/
- protected final synchronized void setActiveTask(TCFTask<ReadData> task) {
+ protected final void setActiveTask(TCFTask<ReadData> task) {
activeTask = task;
}
@@ -315,21 +315,21 @@ public class TerminalsStreamsListener implements IStreams.StreamsListener, ITerm
@Override
@SuppressWarnings("synthetic-access")
public void doneDisconnect(IToken token, Exception error) {
- // Disconnect is done, ignore any error, invoke the callback
synchronized (this) {
+ // Mark the runnable definitely stopped
+ stopped = true;
+ // Disconnect is done, ignore any error, invoke the callback
if (getCallback() != null) getCallback().done(this, Status.OK_STATUS);
}
- // Mark the runnable definitely stopped
- stopped = true;
}
});
} else {
- // Invoke the callback directly, if any
synchronized (this) {
+ // Mark the runnable definitely stopped
+ stopped = true;
+ // Invoke the callback directly, if any
if (callback != null) callback.done(this, Status.OK_STATUS);
}
- // Mark the runnable definitely stopped
- stopped = true;
}
}
@@ -411,7 +411,6 @@ public class TerminalsStreamsListener implements IStreams.StreamsListener, ITerm
// The associated stream id
/* default */ final String streamId;
// The associated stream type id
- @SuppressWarnings("unused")
private final String streamTypeId;
// The data provider applicable for the associated stream type id
private final StreamsDataProvider provider;
@@ -451,6 +450,15 @@ public class TerminalsStreamsListener implements IStreams.StreamsListener, ITerm
}
/**
+ * Returns the associated stream type id.
+ *
+ * @return The associated stream type id.
+ */
+ public final String getStreamTypeId() {
+ return streamTypeId;
+ }
+
+ /**
* Stop the runnable.
*
* @param callback The callback to invoke if the runnable stopped.
@@ -480,7 +488,7 @@ public class TerminalsStreamsListener implements IStreams.StreamsListener, ITerm
*
* @param task The currently active writer task or <code>null</code>.
*/
- protected final synchronized void setActiveTask(TCFTask<Object> task) {
+ protected final void setActiveTask(TCFTask<Object> task) {
activeTask = task;
}
@@ -507,14 +515,14 @@ public class TerminalsStreamsListener implements IStreams.StreamsListener, ITerm
*/
@Override
public void run() {
- // If not data provider is set, we are done here immediately
+ // If no data provider is set, we are done here immediately
if (provider == null) {
- // Invoke the callback directly, if any
synchronized (this) {
+ // Mark the runnable definitely stopped
+ stopped = true;
+ // Invoke the callback directly, if any
if (callback != null) callback.done(this, Status.OK_STATUS);
}
- // Mark the runnable definitely stopped
- stopped = true;
return;
}
@@ -561,23 +569,23 @@ public class TerminalsStreamsListener implements IStreams.StreamsListener, ITerm
@Override
@SuppressWarnings("synthetic-access")
public void doneDisconnect(IToken token, Exception error) {
- // Disconnect is done, ignore any error, invoke the callback
synchronized (this) {
+ // Mark the runnable definitely stopped
+ stopped = true;
+ // Disconnect is done, ignore any error, invoke the callback
if (getCallback() != null) getCallback().done(this, Status.OK_STATUS);
}
- // Mark the runnable definitely stopped
- stopped = true;
}
});
}
});
} else {
- // Invoke the callback directly, if any
synchronized (this) {
+ // Mark the runnable definitely stopped
+ stopped = true;
+ // Invoke the callback directly, if any
if (callback != null) callback.done(this, Status.OK_STATUS);
}
- // Mark the runnable definitely stopped
- stopped = true;
}
}

Back to the top