Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F0DC3200BF6 for ; Tue, 10 Jan 2017 13:07:30 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id EF838160B4B; Tue, 10 Jan 2017 12:07:30 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4E514160B31 for ; Tue, 10 Jan 2017 13:07:30 +0100 (CET) Received: (qmail 20055 invoked by uid 500); 10 Jan 2017 12:07:29 -0000 Mailing-List: contact commits-help@syncope.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@syncope.apache.org Delivered-To: mailing list commits@syncope.apache.org Received: (qmail 20045 invoked by uid 99); 10 Jan 2017 12:07:29 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jan 2017 12:07:29 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 639EEDFA0E; Tue, 10 Jan 2017 12:07:29 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: ilgrosso@apache.org To: commits@syncope.apache.org Date: Tue, 10 Jan 2017 12:07:29 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] syncope git commit: Reconciliation reportlet: fixing misaligned management for byte[] attributes archived-at: Tue, 10 Jan 2017 12:07:31 -0000 Repository: syncope Updated Branches: refs/heads/2_0_X 7b81998b3 -> 549c3e989 refs/heads/master e44e55340 -> 2b71dab8f Reconciliation reportlet: fixing misaligned management for byte[] attributes Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/549c3e98 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/549c3e98 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/549c3e98 Branch: refs/heads/2_0_X Commit: 549c3e989ee825242a1b6a9818b0bb59fb27fca2 Parents: 7b81998 Author: Francesco Chicchiriccò Authored: Tue Jan 10 13:07:12 2017 +0100 Committer: Francesco Chicchiriccò Committed: Tue Jan 10 13:07:12 2017 +0100 ---------------------------------------------------------------------- .../logic/report/ReconciliationReportlet.java | 31 +++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/549c3e98/core/logic/src/main/java/org/apache/syncope/core/logic/report/ReconciliationReportlet.java ---------------------------------------------------------------------- diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/report/ReconciliationReportlet.java b/core/logic/src/main/java/org/apache/syncope/core/logic/report/ReconciliationReportlet.java index 2d5c1c9..ac5c1f1 100644 --- a/core/logic/src/main/java/org/apache/syncope/core/logic/report/ReconciliationReportlet.java +++ b/core/logic/src/main/java/org/apache/syncope/core/logic/report/ReconciliationReportlet.java @@ -28,7 +28,6 @@ import java.util.Set; import org.apache.commons.collections4.Closure; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.IterableUtils; -import org.apache.commons.collections4.SetUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.syncope.common.lib.SyncopeConstants; @@ -60,6 +59,7 @@ import org.apache.syncope.core.provisioning.api.Connector; import org.apache.syncope.core.provisioning.api.ConnectorFactory; import org.apache.syncope.core.provisioning.api.MappingManager; import org.apache.syncope.core.provisioning.java.utils.MappingUtils; +import org.identityconnectors.common.Base64; import org.identityconnectors.framework.common.objects.Attribute; import org.identityconnectors.framework.common.objects.AttributeBuilder; import org.identityconnectors.framework.common.objects.ConnectorObject; @@ -259,6 +259,22 @@ public class ReconciliationReportlet extends AbstractReportlet { handler.endElement("", "", getAnyElementName(any.getType().getKind())); } + private Set getValues(final Attribute attr) { + Set values; + if (attr.getValue() == null || attr.getValue().isEmpty()) { + values = Collections.emptySet(); + } else if (attr.getValue().get(0) instanceof byte[]) { + values = new HashSet<>(attr.getValue().size()); + for (Object single : attr.getValue()) { + values.add(Base64.encode((byte[]) single)); + } + } else { + values = new HashSet<>(attr.getValue()); + } + + return values; + } + private void doExtract(final ContentHandler handler, final List> anys) throws SAXException, ReportException { @@ -300,9 +316,7 @@ public class ReconciliationReportlet extends AbstractReportlet { final Map> syncopeAttrs = new HashMap<>(); for (Attribute attr : preparedAttrs.getRight()) { - syncopeAttrs.put( - attr.getName(), - attr.getValue() == null ? null : new HashSet<>(attr.getValue())); + syncopeAttrs.put(attr.getName(), getValues(attr)); } final Map> resourceAttrs = new HashMap<>(); @@ -310,9 +324,7 @@ public class ReconciliationReportlet extends AbstractReportlet { if (!OperationalAttributes.PASSWORD_NAME.equals(attr.getName()) && !OperationalAttributes.ENABLE_NAME.equals(attr.getName())) { - resourceAttrs.put( - attr.getName(), - attr.getValue() == null ? null : new HashSet<>(attr.getValue())); + resourceAttrs.put(attr.getName(), getValues(attr)); } } @@ -332,10 +344,7 @@ public class ReconciliationReportlet extends AbstractReportlet { for (Map.Entry> entry : resourceAttrs.entrySet()) { if (syncopeAttrs.containsKey(entry.getKey())) { - if (!Objects.equals( - SetUtils.emptyIfNull(syncopeAttrs.get(entry.getKey())), - SetUtils.emptyIfNull(entry.getValue()))) { - + if (!Objects.equals(syncopeAttrs.get(entry.getKey()), entry.getValue())) { misaligned.add(new Misaligned( resource.getKey(), connObjectKeyValue,