diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2014-06-11 12:02:05 +0200 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2014-06-11 12:02:05 +0200 |
commit | c4671f7b414547ab3f412eb46d35f6048d463307 (patch) | |
tree | ccc8fc811aa32b1a647fb04a93d72c193942893a /id/ConfigWebTool/src/main/java/at | |
parent | c976cab32c983d14efde49fd8ef5630d75e23ebe (diff) | |
download | moa-id-spss-c4671f7b414547ab3f412eb46d35f6048d463307.tar.gz moa-id-spss-c4671f7b414547ab3f412eb46d35f6048d463307.tar.bz2 moa-id-spss-c4671f7b414547ab3f412eb46d35f6048d463307.zip |
change initialization step in AuthenticationFilter
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at')
3 files changed, 20 insertions, 24 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java index e176e5141..bea6220ff 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java @@ -85,19 +85,14 @@ public class ConfigurationProvider { public static ConfigurationProvider getInstance() throws ConfigurationException { if (instance == null) { - synchronized (ConfigurationProvider.class) { - instance = new ConfigurationProvider(); - } + instance = new ConfigurationProvider(); + instance.inizialize(); } return instance; } - - private ConfigurationProvider() throws ConfigurationException { - inizialize(); - } - + private void inizialize() throws ConfigurationException { configFileName = System.getProperty(SYSTEM_PROP_CONFIG); @@ -143,10 +138,10 @@ public class ConfigurationProvider { } catch (FileNotFoundException e) { - throw new ConfigurationException("config.01", e); + throw new ConfigurationException("config.01", new Object[]{configFileName}, e); } catch (IOException e) { - throw new ConfigurationException("config.02", e); + throw new ConfigurationException("config.02", new Object[]{configFileName}, e); } catch (MOADatabaseException e) { throw new ConfigurationException("config.03", e); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/exception/ConfigurationException.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/exception/ConfigurationException.java index ebabd600d..3aa3910cc 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/exception/ConfigurationException.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/exception/ConfigurationException.java @@ -35,7 +35,11 @@ public class ConfigurationException extends Exception { public ConfigurationException(String errorname, Throwable e) { super(LanguageHelper.getErrorString(errorname, null), e); } - + + public ConfigurationException(String errorname, Object[] params, Throwable e) { + super(LanguageHelper.getErrorString(errorname, params, null), e); + } + public ConfigurationException(Throwable e) { super(e); } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/filter/AuthenticationFilter.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/filter/AuthenticationFilter.java index 9ca1d08cc..1f631afea 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/filter/AuthenticationFilter.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/filter/AuthenticationFilter.java @@ -75,17 +75,6 @@ public class AuthenticationFilter implements Filter{ private static String[] excludedPages = null; private static Pattern excludedRegEx = null; - - - public AuthenticationFilter() throws ServletException { - try { - config = ConfigurationProvider.getInstance(); - - } catch (ConfigurationException e) { - throw new ServletException(AuthenticationFilter.class + ": Configuration can not be loaded!", e); - } - } - public static String getErrorPage() { return errorPage; } @@ -224,9 +213,17 @@ public class AuthenticationFilter implements Filter{ } } - public void init(FilterConfig filterConfig) throws ServletException { + public void init(FilterConfig filterConfig) throws ServletException { log.debug("Starting init of " + this.getClass().getName() + "."); - + + try { + config = ConfigurationProvider.getInstance(); + + } catch (ConfigurationException e) { + throw new ServletException(e.getMessage(), e); + + } + // login page loginPage = StringUtils.trim(filterConfig.getInitParameter(WEB_XML_INIT_PARAM_LOGIN_PAGE)); if (MiscUtil.isEmpty(loginPage)) { |