summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2004-08-23 15:09:26 +0000
committeraclement <aclement>2004-08-23 15:09:26 +0000
commit197afeadcb72402b3262c795ede32a7c5a6c7def (patch)
tree5267d180b65fb862c06910006d5813268dcd9531
parentf5035234ee878003515413fee5e7e6bfa7a2228d (diff)
downloadaspectj-197afeadcb72402b3262c795ede32a7c5a6c7def.tar.gz
aspectj-197afeadcb72402b3262c795ede32a7c5a6c7def.zip
FindBugs: fixes.
-rw-r--r--ajbrowser/src/org/aspectj/tools/ajbrowser/BasicEditor.java5
-rw-r--r--ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java4
-rw-r--r--ajde/src/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java9
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java2
-rw-r--r--ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java19
-rw-r--r--ajde/src/org/aspectj/ajde/ui/swing/BuildOptionsPanel.java2
-rw-r--r--ajde/testsrc/org/aspectj/ajde/ReweavableTestCase.java8
-rw-r--r--weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java3
-rw-r--r--weaver/testsrc/org/aspectj/weaver/patterns/ConcretizationTestCase.java2
9 files changed, 30 insertions, 24 deletions
diff --git a/ajbrowser/src/org/aspectj/tools/ajbrowser/BasicEditor.java b/ajbrowser/src/org/aspectj/tools/ajbrowser/BasicEditor.java
index 720ed65fd..f5a0fa4ae 100644
--- a/ajbrowser/src/org/aspectj/tools/ajbrowser/BasicEditor.java
+++ b/ajbrowser/src/org/aspectj/tools/ajbrowser/BasicEditor.java
@@ -123,10 +123,10 @@ public class BasicEditor implements EditorAdapter {
}
public void saveContents() throws IOException {
- if (filePath != NO_FILE && filePath != "" && editorPane.getText() != "") {
+ if (!filePath.equals(NO_FILE) && !filePath.equals("") && !editorPane.getText().equals("")) {
BufferedWriter writer = new BufferedWriter(new FileWriter(filePath));
writer.write(editorPane.getText());
- writer.flush();
+ writer.close();
}
}
@@ -169,6 +169,7 @@ public class BasicEditor implements EditorAdapter {
contents.append('\n');
line = reader.readLine();
}
+ reader.close();
return contents.toString();
} catch (IOException ioe) {
return "ERROR: could not read file \"" + filePath + "\", make sure that you have mounted /project/aop on X:\\";
diff --git a/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java b/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
index f98e08c0e..26cfe8894 100644
--- a/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
+++ b/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
@@ -95,10 +95,10 @@ public class CompilerAdapter {
init();
try {
AjBuildConfig buildConfig = genBuildConfig(configFile);
- buildConfig.setGenerateModelMode(buildModel);
- if (null == buildConfig) {
+ if (buildConfig == null) {
return false;
}
+ buildConfig.setGenerateModelMode(buildModel);
currNotifier = new BuildNotifierAdapter(progressMonitor, buildManager);
buildManager.setProgressListener(currNotifier);
messageHandler.setBuildNotifierAdapter(currNotifier);
diff --git a/ajde/src/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java b/ajde/src/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java
index dc87ccb79..443ef41dc 100644
--- a/ajde/src/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java
+++ b/ajde/src/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java
@@ -105,6 +105,7 @@ class LstBuildConfigFileUpdater {
fileContents.add(line.replace('\\', '/'));
line = reader.readLine();
}
+ reader.close();
return fileContents;
} catch (IOException ioe) {
Ajde.getDefault().getErrorHandler().handleError("Could not update build config file.", ioe);
@@ -193,13 +194,15 @@ class LstBuildConfigFileUpdater {
}
private void writeFile(String contents, String filePath) {
+ FileOutputStream fos = null;
try {
- FileOutputStream fos = new FileOutputStream(filePath, false);
+ fos = new FileOutputStream(filePath, false);
fos.write(contents.getBytes());
- fos.close();
} catch (IOException ioe) {
Ajde.getDefault().getErrorHandler().handleError("Could not update build config file: " + filePath, ioe);
- }
+ } finally {
+ if (fos!=null) try {fos.close();} catch (IOException ioe) {}
+ }
}
}
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java b/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java
index a0e1cf4bf..61ba5f9ee 100644
--- a/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java
+++ b/ajde/src/org/aspectj/ajde/ui/StructureModelUtil.java
@@ -166,7 +166,7 @@ public class StructureModelUtil {
List packages = new ArrayList();
IHierarchy model =
Ajde.getDefault().getStructureModelManager().getHierarchy();
- if (model.equals(IHierarchy.NO_STRUCTURE)) {
+ if (model.getRoot().equals(IHierarchy.NO_STRUCTURE)) {
return null;
} else {
return getPackagesHelper(
diff --git a/ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java b/ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java
index 1421a7a04..36c047bf4 100644
--- a/ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java
+++ b/ajde/src/org/aspectj/ajde/ui/StructureSearchManager.java
@@ -55,15 +55,16 @@ public class StructureSearchManager {
matches.add(node);
}
}
-
- for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
- IProgramElement nextNode = (IProgramElement)it.next();
- if (nextNode instanceof IProgramElement) {
- findMatchesHelper(
- (IProgramElement)nextNode,
- pattern,
- kind,
- matches);
+ if (node.getChildren() != null) {
+ for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
+ IProgramElement nextNode = (IProgramElement)it.next();
+ if (nextNode instanceof IProgramElement) {
+ findMatchesHelper(
+ (IProgramElement)nextNode,
+ pattern,
+ kind,
+ matches);
+ }
}
}
diff --git a/ajde/src/org/aspectj/ajde/ui/swing/BuildOptionsPanel.java b/ajde/src/org/aspectj/ajde/ui/swing/BuildOptionsPanel.java
index e8866d985..ef1f32584 100644
--- a/ajde/src/org/aspectj/ajde/ui/swing/BuildOptionsPanel.java
+++ b/ajde/src/org/aspectj/ajde/ui/swing/BuildOptionsPanel.java
@@ -32,7 +32,7 @@ public class BuildOptionsPanel extends OptionsPanel {
+ "AspectJ compiler. The Document Outline View will fail to refresh correctly when\n"
+ "incremental mode is enabled. Submit any other bugs at http://eclipse.org/aspectj";
- protected static BuildOptionsPanel INSTANCE = new BuildOptionsPanel();
+ protected static final BuildOptionsPanel INSTANCE = new BuildOptionsPanel();
// private ButtonGroup compilerMode_buttonGroup = new ButtonGroup();
private TitledBorder titledBorder1;
diff --git a/ajde/testsrc/org/aspectj/ajde/ReweavableTestCase.java b/ajde/testsrc/org/aspectj/ajde/ReweavableTestCase.java
index c1a6c05c1..fd0ef0c73 100644
--- a/ajde/testsrc/org/aspectj/ajde/ReweavableTestCase.java
+++ b/ajde/testsrc/org/aspectj/ajde/ReweavableTestCase.java
@@ -34,10 +34,10 @@ public class ReweavableTestCase extends AjdeTestCase {
public static final String outjarName = "/bin/output.jar";
- public static int nonreweavesize_CalculatePI;
- public static int nonreweavesize_Logger;
- public static int reweavablesize_CalculatePI;
- public static int reweavablesize_Logger;
+ private static int nonreweavesize_CalculatePI;
+ private static int nonreweavesize_Logger;
+ private static int reweavablesize_CalculatePI;
+ private static int reweavablesize_Logger;
/**
* Constructor for JarResourceCopyTestCase.
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java b/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java
index c186624f0..9a7a4e7b0 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java
+++ b/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java
@@ -42,7 +42,8 @@ public abstract class WeaveTestCase extends TestCase {
outDir = BcweaverTests.getOutdir();
outDirPath = outDir.getAbsolutePath();
}
- public void tearDown() {
+ public void tearDown() throws Exception {
+ super.tearDown();
BcweaverTests.removeOutDir();
outDir = null;
outDirPath = null;
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/ConcretizationTestCase.java b/weaver/testsrc/org/aspectj/weaver/patterns/ConcretizationTestCase.java
index 8bf41f750..e6655d80d 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/ConcretizationTestCase.java
+++ b/weaver/testsrc/org/aspectj/weaver/patterns/ConcretizationTestCase.java
@@ -24,7 +24,7 @@ public class ConcretizationTestCase extends WeaveTestCase {
super(name);
}
- String[] none = new String[0];
+ // String[] none = new String[0];