diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2021-01-15 15:50:31 +0100 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2021-01-15 15:50:31 +0100 |
commit | b9f95d7008eca05ef26229725e7fed709fac4a10 (patch) | |
tree | b56b5f34418b2f93e89f034bde0664f8b2532cf4 /eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas | |
parent | 6fad183dc6332b52cd33fbabeabbae3999b1ac2a (diff) | |
download | National_eIDAS_Gateway-b9f95d7008eca05ef26229725e7fed709fac4a10.tar.gz National_eIDAS_Gateway-b9f95d7008eca05ef26229725e7fed709fac4a10.tar.bz2 National_eIDAS_Gateway-b9f95d7008eca05ef26229725e7fed709fac4a10.zip |
fix merge problem in EidasResponseUtils.java
refactor broken jUnit test InitialSearchTaskFirstTest.java to new configuration-loader
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas')
-rw-r--r-- | eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java | 71 |
1 files changed, 38 insertions, 33 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java index bb0545f7..1ca4cdb6 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java @@ -103,53 +103,58 @@ public class EidasResponseUtils { */ // TODO: check possible problem with nonLatinCharacters public static List<String> translateStringListAttribute(AttributeDefinition<?> attributeDefinition, - ImmutableSet<? extends AttributeValue<?>> attributeValues) { + @Nullable ImmutableSet<? extends AttributeValue<?>> attributeValues) { final List<String> stringListAttribute = new ArrayList<>(); - - final AttributeValueMarshaller<?> attributeValueMarshaller = attributeDefinition - .getAttributeValueMarshaller(); - for (final AttributeValue<?> attributeValue : attributeValues) { - String valueString = null; - try { - valueString = attributeValueMarshaller.marshal((AttributeValue) attributeValue); - - log.trace("Find attr: {} with value: {} nonLatinFlag: {} needTransliteration: {}", - attributeDefinition.getFriendlyName(), attributeValue.toString(), - attributeValue.isNonLatinScriptAlternateVersion(), - AttributeValueTransliterator.needsTransliteration(valueString)); - - // if (attributeValue.isNonLatinScriptAlternateVersion()) { - if (!AttributeValueTransliterator.needsTransliteration(valueString)) { - stringListAttribute.add(0, valueString); - - } else { - log.trace("Find 'needsTransliteration' flag. Setting this value at last list element ... "); - stringListAttribute.add(valueString); - + if (attributeValues == null) { + log.info("Can not extract infos from 'null' attribute value"); + + } else { + final AttributeValueMarshaller<?> attributeValueMarshaller = + attributeDefinition.getAttributeValueMarshaller(); + for (final AttributeValue<?> attributeValue : attributeValues) { + String valueString = null; + try { + valueString = attributeValueMarshaller.marshal((AttributeValue) attributeValue); + log.trace("Find attr: {} with value: {} nonLatinFlag: {} needTransliteration: {}", attributeDefinition.getFriendlyName(), attributeValue.toString(), attributeValue.isNonLatinScriptAlternateVersion(), AttributeValueTransliterator.needsTransliteration(valueString)); - + // if (attributeValue.isNonLatinScriptAlternateVersion()) { if (!AttributeValueTransliterator.needsTransliteration(valueString)) { stringListAttribute.add(0, valueString); - + } else { log.trace("Find 'needsTransliteration' flag. Setting this value at last list element ... "); stringListAttribute.add(valueString); - + + log.trace("Find attr: {} with value: {} nonLatinFlag: {} needTransliteration: {}", + attributeDefinition.getFriendlyName(), attributeValue.toString(), + attributeValue.isNonLatinScriptAlternateVersion(), + AttributeValueTransliterator.needsTransliteration(valueString)); + + // if (attributeValue.isNonLatinScriptAlternateVersion()) { + if (!AttributeValueTransliterator.needsTransliteration(valueString)) { + stringListAttribute.add(0, valueString); + + } else { + log.trace("Find 'needsTransliteration' flag. Setting this value at last list element ... "); + stringListAttribute.add(valueString); + + } } + } catch (final AttributeValueMarshallingException e) { + throw new IllegalStateException(e); + } - } catch (final AttributeValueMarshallingException e) { - throw new IllegalStateException(e); - - } + + } + log.trace("Extract values: {} for attr: {}", + StringUtils.join(stringListAttribute, ","), attributeDefinition.getFriendlyName()); + } - - log.trace("Extract values: {} for attr: {}", - StringUtils.join(stringListAttribute, ","), attributeDefinition.getFriendlyName()); - + return stringListAttribute; } |