diff options
author | Alena Laskavaia | 2011-03-11 03:17:38 +0000 |
---|---|---|
committer | Alena Laskavaia | 2011-03-11 03:17:38 +0000 |
commit | 5a8cf9f832b0e936f24ca6c1943acd425912a840 (patch) | |
tree | 93277530994c43d7f709997327814b2eb963eb34 | |
parent | c2dfefd6ea1b97b8a79d3df9367af76c04cd8f2a (diff) | |
download | org.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.java | 6 |
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; } |