Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/gcov
diff options
context:
space:
mode:
authorXavier Raynaud2012-03-05 14:18:37 +0000
committerXavier Raynaud2012-03-05 14:19:07 +0000
commite0b87be3d929f84ddf78ea776f6663e9b49bbedf (patch)
tree4ddbf75160ca0c8549cc24c0bdc5c2989835187d /gcov
parente93933524ba0463359d9fa91126bab1a6bd3ce84 (diff)
downloadorg.eclipse.linuxtools-e0b87be3d929f84ddf78ea776f6663e9b49bbedf.tar.gz
org.eclipse.linuxtools-e0b87be3d929f84ddf78ea776f6663e9b49bbedf.tar.xz
org.eclipse.linuxtools-e0b87be3d929f84ddf78ea776f6663e9b49bbedf.zip
fix various warnings issued by FindBug
Diffstat (limited to 'gcov')
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/action/OpenGCAction.java41
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Block.java2
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/CovManager.java2
3 files changed, 25 insertions, 20 deletions
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/action/OpenGCAction.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/action/OpenGCAction.java
index a3ee67a76e..28807f287f 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/action/OpenGCAction.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/action/OpenGCAction.java
@@ -99,27 +99,32 @@ public class OpenGCAction implements IEditorLauncher {
String line;
String tab[];
if (info.exists()) {
- BufferedReader br = new BufferedReader(new FileReader(info.toString()));
+ BufferedReader br = null;
+ try {
+ br = new BufferedReader(new FileReader(info.toString()));
- while ((line = br.readLine())!= null){
- tab = line.split("=");
- String name="", value="";
- if (tab.length > 1){
- name=tab[0];
- value=tab[1].trim();
- if (name.equals("Project Name ")){
- project = ResourcesPlugin.getWorkspace().getRoot().getProject(value);
- }
- else if (name.equals("Program Name ")){
- if(project != null){
- ifile = project.getFile(value);
- br.close();
- if (ifile.exists()) {
- return ifile.getLocation().toString();
- }
+ while ((line = br.readLine())!= null){
+ tab = line.split("=");
+ String name="", value="";
+ if (tab.length > 1){
+ name=tab[0];
+ value=tab[1].trim();
+ if (name.equals("Project Name ")){
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(value);
}
- }
+ else if (name.equals("Program Name ")){
+ if(project != null){
+ ifile = project.getFile(value);
+ br.close();
+ if (ifile.exists()) {
+ return ifile.getLocation().toString();
+ }
+ }
+ }
+ }
}
+ } finally {
+ if (br != null) br.close();
}
}else{
IFile c = ResourcesPlugin.getWorkspace().getRoot()
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Block.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Block.java
index 495ebfe65f..5ada91b7c8 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Block.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/Block.java
@@ -166,7 +166,7 @@ public class Block implements Serializable{
this.blkline.num = numline;
}
- class BlkLine implements Serializable{
+ static class BlkLine implements Serializable{
/**
*
*/
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/CovManager.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/CovManager.java
index bf516f7d2d..d7345d8cf9 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/CovManager.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/gcov/parser/CovManager.java
@@ -371,7 +371,7 @@ public class CovManager implements Serializable {
- private final class ThreadConsumer extends Thread
+ private static final class ThreadConsumer extends Thread
{
private final Process p;
private final List<String> list;

Back to the top