From 191bd90971b488bff16a5e08d0c1b2306da5876f Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 14 Mar 2014 12:52:35 +0100 Subject: bugfix possible NullPointerException in STORK config --- .../moa/id/config/stork/STORKConfig.java | 36 ++++++++++++---------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'id/server/idserverlib') diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java index ff481b825..b3a4cca78 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/stork/STORKConfig.java @@ -58,30 +58,32 @@ public class STORKConfig { this.basedirectory = basedirectory; this.props = props; - //create CPEPS map - List cpeps = stork.getCPEPS(); - cpepsMap = new HashMap(); + attr = new ArrayList(); + + if (stork != null) { + //create CPEPS map + List cpeps = stork.getCPEPS(); + + if (cpeps != null) { + for(at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS cpep : cpeps) { - if (cpeps != null) { - for(at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS cpep : cpeps) { - - try { - CPEPS moacpep = new CPEPS(cpep.getCountryCode(), new URL(cpep.getURL())); + try { + CPEPS moacpep = new CPEPS(cpep.getCountryCode(), new URL(cpep.getURL())); - cpepsMap.put(cpep.getCountryCode(), moacpep); + cpepsMap.put(cpep.getCountryCode(), moacpep); - } catch (MalformedURLException e) { - Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " - + cpep.getCountryCode() + " has an invalid URL and is ignored."); + } catch (MalformedURLException e) { + Logger.warn("Error in MOA-ID Configuration. CPEP entry for country " + + cpep.getCountryCode() + " has an invalid URL and is ignored."); + } } } - } - attr = new ArrayList(); - if (stork.getAttributes() != null) { - for(StorkAttribute current : stork.getAttributes()) { - attr.add(current); + if (stork.getAttributes() != null) { + for(StorkAttribute current : stork.getAttributes()) { + attr.add(current); + } } } -- cgit v1.2.3