diff options
Diffstat (limited to 'spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java')
-rw-r--r-- | spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java | 74 |
1 files changed, 54 insertions, 20 deletions
diff --git a/spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java b/spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java index 1e966911b..33e9daca1 100644 --- a/spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java +++ b/spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java @@ -827,32 +827,66 @@ public class ConfigurationPartsBuilder { while ((profileElem = (Element) profileIter.nextNode()) != null) { String id = profileElem.getAttribute("id"); String uriStr = profileElem.getAttribute("uri"); - - try { - URI uri = new URI(uriStr); - TrustProfile profile; - File profileDir; - + String signerCertsUriStr = profileElem.getAttribute("signerCertsUri"); + + boolean createTrustProfile = true; + + URI uri = null; + try + { + uri = new URI(uriStr); if (!uri.isAbsolute()) { // make it absolute to the config file uri = new URI(configRoot.toURL() + uriStr); } + } + catch (URIException e) { + warn("config.14", new Object[] { "uri", id, uriStr }, e); + createTrustProfile = false; + } + catch (MalformedURLException e) + { + warn("config.15", new Object[] {id}, e); + createTrustProfile = false; + } - profileDir = new File(uri.getPath()); - if (!profileDir.exists() || !profileDir.isDirectory()) { - warn("config.27", new Object[] { id }); - } + File profileDir = new File(uri.getPath()); + if (!profileDir.exists() || !profileDir.isDirectory()) { + warn("config.27", new Object[] { "uri", id }); + createTrustProfile = false; + } - if (trustProfiles.containsKey(id)) { - warn("config.04", new Object[] { "TrustProfile", id }); - } else { - profile = new TrustProfile(id, uri.toString()); - trustProfiles.put(id, profile); + if (trustProfiles.containsKey(id)) { + warn("config.04", new Object[] { "TrustProfile", id }); + createTrustProfile = false; + } + + URI signerCertsUri = null; + if (signerCertsUriStr != null && !"".equals(signerCertsUriStr)) + { + try + { + signerCertsUri = new URI(signerCertsUriStr); + if (!signerCertsUri.isAbsolute()) uri = new URI(configRoot.toURL() + signerCertsUriStr); + + File signerCertsDir = new File(signerCertsUri.getPath()); + if (!signerCertsDir.exists() || !signerCertsDir.isDirectory()) { + warn("config.27", new Object[] { "signerCertsUri", id }); + createTrustProfile = false; + } } - - } catch (URIException e) { - warn("config.14", new Object[] { id, uriStr }, e); - } catch (MalformedURLException e) { - warn("config.15", null, e); + catch (URIException e) { + warn("config.14", new Object[] { "signerCertsUri", id, uriStr }, e); + createTrustProfile = false; + } + catch (MalformedURLException e) { + warn("config.15", new Object[] {id}, e); + createTrustProfile = false; + } + } + + if (createTrustProfile) { + TrustProfile profile = new TrustProfile(id, uri.toString(), signerCertsUri.toString()); + trustProfiles.put(id, profile); } } |