From 84a86ceddf89f4a1a04396a37742a892f09ffafb Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 20 Jul 2018 10:57:08 +0200 Subject: some small modifications in attribute builder update internal messages-codes --- .../builder/AbstractAuthenticationDataBuilder.java | 14 +++++++++--- .../impl/idp/conf/AbstractConfigurationImpl.java | 25 ++++++++++++++++------ .../tasks/RestartAuthProzessManagement.java | 2 +- 3 files changed, 31 insertions(+), 10 deletions(-) (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp') diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java index ad01a796..17c8274b 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java @@ -417,14 +417,22 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati } String[] spitted = pvpbPKValueAttr.split(":"); - if (spitted.length != 2) { + if (spitted.length == 2) { + log.debug("Find PVP-Attr: " + PVPAttributeDefinitions.BPK_FRIENDLY_NAME); + return spitted[1]; + + + + } else if (spitted.length > 2) { log.warn("Attribute " + PVPAttributeDefinitions.BPK_NAME + " has a wrong encoding and can NOT be USED!" + " Value:" + pvpbPKValueAttr); return null; + } else { + log.debug("Find PVP-Attr: " + PVPAttributeDefinitions.BPK_FRIENDLY_NAME + " without prefix. Use it as it is"); + return spitted[0]; + } - log.debug("Find PVP-Attr: " + PVPAttributeDefinitions.BPK_FRIENDLY_NAME); - return spitted[1]; } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/AbstractConfigurationImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/AbstractConfigurationImpl.java index f269c501..ca99b040 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/AbstractConfigurationImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/AbstractConfigurationImpl.java @@ -60,6 +60,13 @@ public abstract class AbstractConfigurationImpl implements IConfiguration { if (StringUtils.isEmpty(configPath)) { log.debug("Primary configuration is empty. Search for backup configuration .... "); + String backupConfigPath = getBackupConfigPath(); + if (StringUtils.isEmpty(backupConfigPath)) { + log.error("No configuration file found."); + throw new EAAFConfigurationException("config.01", null); + + } + internalConfigPath = new URI(getBackupConfigPath()); } else @@ -70,7 +77,13 @@ public abstract class AbstractConfigurationImpl implements IConfiguration { //extract configuration root directory //TODO: check if it works with classpath - File propertiesFile = new File(internalConfigPath); + File propertiesFile = new File(internalConfigPath); + if (!propertiesFile.exists()) { + log.error("Configuration file: " + internalConfigPath + " is NOT found on filesystem"); + throw new EAAFConfigurationException("config.18", null); + + } + String configDir = propertiesFile.getParent(); configRootDirectory = new File(configDir).toURI(); log.debug("Set EAAFCore configuration root directory to " + configRootDirectory.toString()); @@ -87,13 +100,14 @@ public abstract class AbstractConfigurationImpl implements IConfiguration { } else { log.error("Can not load EAAFCore configuration. Unsupported prefix! (Only 'file:' and 'classpath:') "); - throw new EAAFConfigurationException("Can not load EAAFCore configuration. Unsupported prefix"); + throw new EAAFConfigurationException("config.24", new Object[] {internalConfigPath, "'file:'"}); } if (is == null) { log.error("Can NOT load EAAFCore configuration from file " + internalConfigPath.toString()); - throw new EAAFConfigurationException("Can NOT load EAAFCore configuration from file " + internalConfigPath.toString()); + throw new EAAFConfigurationException("config.03", + new Object[] {internalConfigPath.toString()}); } @@ -103,11 +117,10 @@ public abstract class AbstractConfigurationImpl implements IConfiguration { properties.load(is); log.info("EAAFCore configuration loaded"); - - + } catch (URISyntaxException | IOException e) { log.error("Can not parse configuration path " + configPath + " or " + getBackupConfigPath()); - throw new EAAFConfigurationException("Can not parse configuration path", e); + throw new EAAFConfigurationException("config.03", new Object[]{configPath + " or " + getBackupConfigPath()}, e); } finally { if (is != null) { diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/RestartAuthProzessManagement.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/RestartAuthProzessManagement.java index b3e4d874..a4120ed1 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/RestartAuthProzessManagement.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/RestartAuthProzessManagement.java @@ -96,7 +96,7 @@ public class RestartAuthProzessManagement extends AbstractAuthServletTask { } catch (EAAFException e) { log.error("Database Error! MOASession is not stored!"); - throw new EAAFException("init.04", new Object[] { pendingReq.getPendingRequestId() }); + throw new EAAFException("internal.02", null); } -- cgit v1.2.3