Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2015-02-09 11:22:24 -0500
committerUwe Stieber2015-02-09 11:22:24 -0500
commit6abd600ff1c80220860a10b576544b6d5a3a9b43 (patch)
treef0a2e90c5bc9bcc04b1e0c628be252c17ca1ee8a
parent17d84c473c6447efff491506042090da101e2b20 (diff)
downloadorg.eclipse.tcf-6abd600ff1c80220860a10b576544b6d5a3a9b43.tar.gz
org.eclipse.tcf-6abd600ff1c80220860a10b576544b6d5a3a9b43.tar.xz
org.eclipse.tcf-6abd600ff1c80220860a10b576544b6d5a3a9b43.zip
Terminals: Fix findbugs warnings
-rw-r--r--admin/findbugs-exclude.xml2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalServiceFactory.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationMkDir.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java23
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialPortAddressDialog.java2
5 files changed, 24 insertions, 7 deletions
diff --git a/admin/findbugs-exclude.xml b/admin/findbugs-exclude.xml
index 3a065e201..16426976d 100644
--- a/admin/findbugs-exclude.xml
+++ b/admin/findbugs-exclude.xml
@@ -203,6 +203,7 @@
<Or>
<Class name="org.eclipse.tcf.te.runtime.processes.ProcessOutputReaderThread"/>
<Class name="org.eclipse.tcf.te.tcf.launch.cdt.utils.TEHelper"/>
+ <Class name="org.eclipse.tcf.te.tcf.remote.core.TCFConnectionManager"/>
</Or>
</Match>
@@ -256,6 +257,7 @@
<Class name="~org\.eclipse\.tcf\.te\.tcf\.filesystem\.ui\.internal\.handlers\.OpenFileHandler.*"/>
<Package name="~org\.eclipse\.tcf\.te\.tests\..*"/>
<Class name="org.eclipse.tcf.te.ui.terminals.local.showin.ExternalExecutablesManager"/>
+ <Class name="org.eclipse.tcf.te.tcf.launch.cdt.utils.TEHelper"/>
</Or>
</Match>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalServiceFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalServiceFactory.java
index a86287da3..601e2149d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalServiceFactory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core.terminals/src/org/eclipse/tcf/te/core/terminals/TerminalServiceFactory.java
@@ -23,7 +23,7 @@ import org.osgi.framework.Bundle;
* Provides access to the terminal service instance.
*/
public final class TerminalServiceFactory {
- public static ITerminalService instance = null;
+ private static ITerminalService instance = null;
static {
// Tries to instantiate the terminal service implementation
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationMkDir.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationMkDir.java
index c336a2bd9..8977aa74e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationMkDir.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationMkDir.java
@@ -60,7 +60,7 @@ public final class TCFOperationMkDir extends TCFFileStoreOperation<Object> {
}
if (error == null && attrs.isDirectory()) {
// Directory exists, ok.
- callback.doneMkDir(token, error);
+ callback.doneMkDir(token, null);
} else if (error != null && error.getStatus() != IFileSystem.STATUS_NO_SUCH_FILE) {
// Error and file exists
callback.doneMkDir(token, error);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java
index 5178be44c..1e797d92f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java
@@ -12,6 +12,7 @@ package org.eclipse.tcf.te.ui.terminals.local.showin;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -44,9 +45,12 @@ public class ExternalExecutablesManager {
if (stateLocation != null) {
File f = stateLocation.append(".executables/data.properties").toFile(); //$NON-NLS-1$
if (f.canRead()) {
+ FileReader r = null;
+
try {
Properties data = new Properties();
- data.load(new FileReader(f));
+ r= new FileReader(f);
+ data.load(r);
Map<Integer, Map<String, String>> c = new HashMap<Integer, Map<String, String>>();
for (String name : data.stringPropertyNames()) {
@@ -80,6 +84,8 @@ public class ExternalExecutablesManager {
if (Platform.inDebugMode()) {
e.printStackTrace();
}
+ } finally {
+ if (r != null) try { r.close(); } catch (IOException e) { /* ignored on purpose */ }
}
}
}
@@ -100,6 +106,8 @@ public class ExternalExecutablesManager {
@SuppressWarnings("unused")
boolean s = f.delete();
} else {
+ FileWriter w = null;
+
try {
Properties data = new Properties();
for (int i = 0; i < l.size(); i++) {
@@ -115,14 +123,21 @@ public class ExternalExecutablesManager {
boolean s = f.getParentFile().mkdirs();
s = f.createNewFile();
}
- FileWriter w = new FileWriter(f);
+ w = new FileWriter(f);
data.store(w, null);
- w.flush();
- w.close();
} catch (Exception e) {
if (Platform.inDebugMode()) {
e.printStackTrace();
}
+ } finally {
+ if (w != null) {
+ try {
+ w.flush();
+ w.close();
+ } catch (IOException e) {
+ /* ignored on purpose */
+ }
+ }
}
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialPortAddressDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialPortAddressDialog.java
index 3e6f682f1..ca20fb0fd 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialPortAddressDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialPortAddressDialog.java
@@ -346,7 +346,7 @@ public class SerialPortAddressDialog extends TitleAreaDialog implements IMessage
if (tty != null && tty.trim().length() > 0 && ttyControl.indexOf(tty) == -1) {
ttyControl.add(tty.trim());
}
- if (tty.equals(data)) {
+ if (tty != null && tty.equals(data)) {
ttyControl.setText(tty.trim());
}
}

Back to the top