Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2014-12-02 22:42:49 -0500
committerElena Laskavaia2014-12-04 13:57:27 -0500
commit863def95be233a4f6650874b1c3950cad4aabb8d (patch)
tree2f768e76d7a1632654811aaca55907946819779d /codan/org.eclipse.cdt.codan.core
parentc6865cfb7dfaad4317abc572c3fe73ed5ff8be3a (diff)
downloadorg.eclipse.cdt-863def95be233a4f6650874b1c3950cad4aabb8d.tar.gz
org.eclipse.cdt-863def95be233a4f6650874b1c3950cad4aabb8d.tar.xz
org.eclipse.cdt-863def95be233a4f6650874b1c3950cad4aabb8d.zip
Bug 453275 - Codan tests cannot test for checkers throwing an exception
Added system flag that is used to propagate exception instead of swallowing. Set by default in codan junit tests. Change-Id: Iccda9a7b2e419192bb9f4eec4b89d525e152fc81 Signed-off-by: Alena Laskavaia <elaskavaia.cdt@gmail.com> Reviewed-on: https://git.eclipse.org/r/37482
Diffstat (limited to 'codan/org.eclipse.cdt.codan.core')
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanCorePlugin.java2
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanRunner.java40
2 files changed, 21 insertions, 21 deletions
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanCorePlugin.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanCorePlugin.java
index 70a583c6c1..968e827a26 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanCorePlugin.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanCorePlugin.java
@@ -95,6 +95,8 @@ public class CodanCorePlugin extends Plugin {
* @noreference This method is not intended to be referenced by clients.
*/
public static void log(Throwable e) {
+ if (Boolean.valueOf(System.getProperty("codan.rethrow"))) //$NON-NLS-1$
+ throw new RuntimeException(e);
log("Internal Error", e); //$NON-NLS-1$
}
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanRunner.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanRunner.java
index 8b23934fe0..4b41a4d921 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanRunner.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanRunner.java
@@ -76,31 +76,29 @@ public class CodanRunner {
ICheckerInvocationContext context = new CheckerInvocationContext(resource);
try {
for (IChecker checker : chegistry) {
- try {
- if (monitor.isCanceled())
- return;
- if (chegistry.isCheckerEnabled(checker, resource, checkerLaunchMode)) {
- synchronized (checker) {
- try {
- checker.before(resource);
- CheckersTimeStats.getInstance().checkerStart(checker.getClass().getName());
- if (checkerLaunchMode == CheckerLaunchMode.RUN_AS_YOU_TYPE) {
- ((IRunnableInEditorChecker) checker).processModel(model, context);
- } else {
- checker.processResource(resource, context);
- }
- } finally {
- CheckersTimeStats.getInstance().checkerStop(checker.getClass().getName());
- checker.after(resource);
+ if (monitor.isCanceled())
+ return;
+ if (chegistry.isCheckerEnabled(checker, resource, checkerLaunchMode)) {
+ synchronized (checker) {
+ try {
+ checker.before(resource);
+ CheckersTimeStats.getInstance().checkerStart(checker.getClass().getName());
+ if (checkerLaunchMode == CheckerLaunchMode.RUN_AS_YOU_TYPE) {
+ ((IRunnableInEditorChecker) checker).processModel(model, context);
+ } else {
+ checker.processResource(resource, context);
}
+ } catch (OperationCanceledException e) {
+ return;
+ } catch (Throwable e) {
+ CodanCorePlugin.log(e);
+ } finally {
+ CheckersTimeStats.getInstance().checkerStop(checker.getClass().getName());
+ checker.after(resource);
}
}
- monitor.worked(1);
- } catch (OperationCanceledException e) {
- return;
- } catch (Throwable e) {
- CodanCorePlugin.log(e);
}
+ monitor.worked(1);
}
} finally {
context.dispose();

Back to the top