fix wrong initializing order

This commit is contained in:
Sebastian Sdorra
2012-08-29 19:05:11 +02:00
parent 230fd1a4fb
commit 1ab5e5610d
3 changed files with 159 additions and 34 deletions

View File

@@ -91,7 +91,7 @@ public class JAXBStoreFactory implements ListenableStoreFactory
public void init(SCMContextProvider context)
{
configDirectory = new File(context.getBaseDirectory(),
CONFIGDIRECTORY_NAME);
CONFIGDIRECTORY_NAME);
IOUtil.mkdirs(configDirectory);
}
@@ -110,12 +110,17 @@ public class JAXBStoreFactory implements ListenableStoreFactory
@Override
public <T> JAXBStore<T> getStore(Class<T> type, String name)
{
if (configDirectory == null)
{
throw new IllegalStateException("store factory is not initialized");
}
File configFile = new File(configDirectory, name.concat(FILE_EXTENSION));
if (logger.isDebugEnabled())
{
logger.debug("create store for {} at {}", type.getName(),
configFile.getPath());
configFile.getPath());
}
return new JAXBStore<T>(type, configFile);