Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2011-03-11 03:17:38 +0000
committerAlena Laskavaia2011-03-11 03:17:38 +0000
commit5a8cf9f832b0e936f24ca6c1943acd425912a840 (patch)
tree93277530994c43d7f709997327814b2eb963eb34
parentc2dfefd6ea1b97b8a79d3df9367af76c04cd8f2a (diff)
downloadorg.eclipse.cdt-5a8cf9f832b0e936f24ca6c1943acd425912a840.tar.gz
org.eclipse.cdt-5a8cf9f832b0e936f24ca6c1943acd425912a840.tar.xz
org.eclipse.cdt-5a8cf9f832b0e936f24ca6c1943acd425912a840.zip
fixed issues of accessing non-initialized checker registry
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegistry.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegistry.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegistry.java
index 206937f6e70..4e13cce130b 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegistry.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegistry.java
@@ -53,6 +53,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
private static final Object DEFAULT = "DEFAULT"; //$NON-NLS-1$
private Collection<IChecker> checkers = new ArrayList<IChecker>();
private static CheckersRegistry instance;
+ private static boolean initialized = false;
private HashMap<Object, IProblemProfile> profiles = new HashMap<Object, IProblemProfile>();
private HashMap<IChecker, Collection<IProblem>> problemList = new HashMap<IChecker, Collection<IProblem>>();
@@ -60,6 +61,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
instance = this;
profiles.put(DEFAULT, new ProblemProfile());
readCheckersRegistry();
+ initialized = true;
}
private void readCheckersRegistry() {
@@ -235,9 +237,11 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
/**
* @return the singleton checkers registry
*/
- public static CheckersRegistry getInstance() {
+ public static synchronized CheckersRegistry getInstance() {
if (instance == null)
return new CheckersRegistry();
+ if (initialized == false)
+ throw new IllegalStateException("Registry is not initialized"); //$NON-NLS-1$
return instance;
}

Back to the top