From 43569eebde7fab37a9be15e26e2a5411b354d829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Sassmann?= <445320@mail.muni.cz> Date: Thu, 1 Apr 2021 09:55:03 +0200 Subject: [PATCH] Core - fixed optional ns config options * The new csvGenHeader and csvGenPlaceholder options should be optional. However, the previous check was not working properly, and the whole application would fail to start because of NullPointerExceptions. --- .../perun/core/impl/SponsoredAccountsConfigLoader.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/perun-core/src/main/java/cz/metacentrum/perun/core/impl/SponsoredAccountsConfigLoader.java b/perun-core/src/main/java/cz/metacentrum/perun/core/impl/SponsoredAccountsConfigLoader.java index 4b1ca89547..775e00245c 100644 --- a/perun-core/src/main/java/cz/metacentrum/perun/core/impl/SponsoredAccountsConfigLoader.java +++ b/perun-core/src/main/java/cz/metacentrum/perun/core/impl/SponsoredAccountsConfigLoader.java @@ -40,7 +40,7 @@ public Map loadSponsoredAccountsConfig() { } catch(RuntimeException e) { throw new InternalErrorException("Configuration file has invalid syntax. Configuration file: " + - configurationPath.getFilename()); + configurationPath.getFilename(), e); } return namespacesRules; @@ -69,9 +69,9 @@ private Set loadNamespacesRulesFromJsonNode(JsonNode rootNode) { namespaceRules.setDefaultEmail(defaultEmail.asText()); namespaceRules.setRequiredAttributes(requiredAttributes); namespaceRules.setOptionalAttributes(optionalAttributes); - if (!csvGenHeader.isNull()) + if (csvGenHeader != null && !csvGenHeader.isNull()) namespaceRules.setCsvGenHeader(csvGenHeader.asText()); - if (!csvGenPlaceholder.isNull()) + if (csvGenPlaceholder != null && !csvGenPlaceholder.isNull()) namespaceRules.setCsvGenPlaceholder(csvGenPlaceholder.asText()); rules.add(namespaceRules);