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, ICheckersRegistry { private static final Object DEFAULT = "DEFAULT"; //$NON-NLS-1$ private Collection checkers = new ArrayList(); private static CheckersRegistry instance; + private static boolean initialized = false; private HashMap profiles = new HashMap(); private HashMap> problemList = new HashMap>(); @@ -60,6 +61,7 @@ public class CheckersRegistry implements Iterable, ICheckersRegistry { instance = this; profiles.put(DEFAULT, new ProblemProfile()); readCheckersRegistry(); + initialized = true; } private void readCheckersRegistry() { @@ -235,9 +237,11 @@ public class CheckersRegistry implements Iterable, 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; }