You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2023/03/24 09:53:57 UTC
[syncope] branch 3_0_X updated: Partial revert of last change
This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch 3_0_X
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/3_0_X by this push:
new e4a31a6be6 Partial revert of last change
e4a31a6be6 is described below
commit e4a31a6be6abab3faf4ab881e686cf610a21f007
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Fri Mar 24 10:53:48 2023 +0100
Partial revert of last change
---
.../core/persistence/jpa/dao/AbstractJPAJSONAnyDAO.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractJPAJSONAnyDAO.java b/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractJPAJSONAnyDAO.java
index fef2e418e5..1101148d7c 100644
--- a/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractJPAJSONAnyDAO.java
+++ b/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractJPAJSONAnyDAO.java
@@ -341,14 +341,14 @@ abstract class AbstractJPAJSONAnyDAO extends AbstractDAO<AbstractEntity> impleme
for (PlainAttr<?> attr : any.getPlainAttrs()) {
if (attr.getUniqueValue() != null && attr instanceof JSONPlainAttr) {
PlainSchema schema = attr.getSchema();
- findByPlainAttrUniqueValue(table, anyUtils, schema, attr.getUniqueValue(), false).
- map(other -> !other.getKey().equals(any.getKey())).ifPresentOrElse(
- other -> {
- throw new DuplicateException(
- "Value " + attr.getUniqueValue().getValueAsString()
- + " existing for " + schema.getKey());
- },
- () -> LOG.debug("No duplicate value found for {}", attr.getUniqueValue().getValueAsString()));
+ Optional<A> other = findByPlainAttrUniqueValue(table, anyUtils, schema, attr.getUniqueValue(), false);
+ if (other.isEmpty() || other.get().getKey().equals(any.getKey())) {
+ LOG.debug("No duplicate value found for {}", attr.getUniqueValue().getValueAsString());
+ } else {
+ throw new DuplicateException(
+ "Value " + attr.getUniqueValue().getValueAsString()
+ + " existing for " + schema.getKey());
+ }
}
}