You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by an...@apache.org on 2018/11/22 13:45:08 UTC
[syncope] branch master updated: fixes tests and avoids NPE while
showing plain attribuest wizard
This is an automated email from the ASF dual-hosted git repository.
andreapatricelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/master by this push:
new 5476771 fixes tests and avoids NPE while showing plain attribuest wizard
5476771 is described below
commit 54767715466da6cdcd4eac8150672e9065f2407c
Author: Andrea Patricelli <an...@apache.org>
AuthorDate: Thu Nov 22 14:44:07 2018 +0100
fixes tests and avoids NPE while showing plain attribuest wizard
---
.../syncope/client/console/wizards/any/PlainAttrs.java | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
index fb9c7c6..b767910 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
@@ -410,24 +410,26 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
((MultiFieldPanel) panel).setReadOnly(schemas.get(attrTO.getSchema()).isReadonly());
}
item.add(panel);
- Optional<AttrTO> previousPlainAttr = previousObject.getPlainAttr(attrTO.getSchema());
+ Optional<AttrTO> previousPlainAttr = previousObject == null
+ ? Optional.empty()
+ : previousObject.getPlainAttr(attrTO.getSchema());
if (previousObject != null
- && ((!previousPlainAttr.isPresent() && !isEmptyOrBlank(attrTO.getValues()))
+ && ((!previousPlainAttr.isPresent() && isNotEmptyOrBlank(attrTO.getValues()))
|| (previousPlainAttr.isPresent() && !ListUtils.isEqualList(
ListUtils.select(previousPlainAttr.get().getValues(),
object -> StringUtils.isNotEmpty(object)),
ListUtils.select(attrTO.getValues(), object -> StringUtils.isNotEmpty(object)))))) {
- List<String> oldValues = !previousPlainAttr.isPresent()
- ? Collections.<String>emptyList()
- : previousPlainAttr.get().getValues();
+ List<String> oldValues = previousPlainAttr.isPresent()
+ ? previousPlainAttr.get().getValues()
+ : Collections.<String>emptyList();
panel.showExternAction(new LabelInfo("externalAction", oldValues));
}
}
- protected boolean isEmptyOrBlank(final List<String> values) {
- return values.stream().allMatch(value -> StringUtils.isBlank(value));
+ protected boolean isNotEmptyOrBlank(final List<String> values) {
+ return values.stream().anyMatch(value -> StringUtils.isNotBlank(value));
}
});
}