From cd65ea06223d596e817e63167e91a94b05e35be4 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Mon, 16 Nov 2015 15:24:18 +0100 Subject: fix possible NullPointerException with STORK configuration --- .../config/ConfigurationMigrationUtils.java | 40 +++++++++++++--------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'id/server/moa-id-commons/src') diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java index d99f826b6..c175253af 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java @@ -738,6 +738,7 @@ public class ConfigurationMigrationUtils { } dbOA.setIsActive(Boolean.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_ISACTIVE))); + dbOA.setIsAdminRequired(false); dbOA.setPublicURLPrefix(oa.get(MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER)); dbOA.setFriendlyName(oa.get(MOAIDConfigurationConstants.SERVICE_FRIENDLYNAME)); @@ -1679,35 +1680,42 @@ public class ConfigurationMigrationUtils { String index = KeyValueUtils.getFirstChildAfterPrefix(key, MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST); if (!attrMap.containsKey(index)) { StorkAttribute attr = new StorkAttribute(); - attr.setName(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST + String attrName = moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST + "." + index + "." - + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_NAME)); - attr.setMandatory(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST - + "." + index + "." - + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY))); - attr.setHjid(Long.valueOf(index)); - attrMap.put(index, attr); + + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_NAME); + if (MiscUtil.isNotEmpty(attrName)) { + attr.setName(attrName); + attr.setMandatory(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST + + "." + index + "." + + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY))); + attr.setHjid(Long.valueOf(index)); + attrMap.put(index, attr); + } } } else if (key.startsWith(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST)) { String index = KeyValueUtils.getFirstChildAfterPrefix(key, MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST); if (!cpepsMap.containsKey(index)) { CPEPS attr = new CPEPS(); - attr.setCountryCode(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST - + "." + index + "." - + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY)); - - attr.setURL(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + + String countryCode = moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + "." + index + "." - + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL)); + + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY); - attr.setSupportsXMLSignature(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + String pepsURL = moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + "." + index + "." - + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_SUPPORT_XMLDSIG))); + + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL); - attr.setHjid(Long.valueOf(index)); + if (MiscUtil.isNotEmpty(countryCode) && MiscUtil.isNotEmpty(pepsURL)) { + attr.setCountryCode(countryCode); + attr.setURL(pepsURL); + attr.setSupportsXMLSignature(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + + "." + index + "." + + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_SUPPORT_XMLDSIG))); + attr.setHjid(Long.valueOf(index)); cpepsMap.put(index, attr); + } } } -- cgit v1.2.3