This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git
commit 892638f54994f683cd18a5d42682ffc6ce0a0824
Author: Francesco Chicchiriccò
AuthorDate: Fri Mar 5 14:34:27 2021 +0100
Reflow
---
.../syncope/client/console/SyncopeConsoleSession.java | 11 +--
.../syncope/client/enduser/SyncopeEnduserSession.java | 14 +++---
2 files changed, 8 insertions(+), 17 deletions(-)
diff --git
a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
index a66019f..0569905 100644
---
a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
+++
b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
@@ -141,14 +141,6 @@ public class SyncopeConsoleSession extends
AuthenticatedWebSession implements Ba
return sce.getType().name() + ": " +
sce.getElements().stream().collect(Collectors.joining(", "));
}
-/**
- * Extract and localize (if translation available) the actual message from
the given exception; then, report it
- * via {@link Session#error(java.io.Serializable)}.
- *
- * @see org.apache.syncope.client.lib.RestClientExceptionMapper
- *
- * @param e raised exception
- */
@Override
public void onException(final Exception e) {
Throwable root = ExceptionUtils.getRootCause(e);
@@ -157,8 +149,7 @@ public class SyncopeConsoleSession extends
AuthenticatedWebSession implements Ba
if (root instanceof SyncopeClientException) {
SyncopeClientException sce = (SyncopeClientException) root;
message = sce.isComposite()
-? sce.asComposite().getExceptions().stream().
-map(c -> message(c)).collect(Collectors.joining(";
"))
+?
sce.asComposite().getExceptions().stream().map(this::message).collect(Collectors.joining(";
"))
: message(sce);
} else if (root instanceof AccessControlException || root instanceof
ForbiddenException) {
Error error = StringUtils.containsIgnoreCase(message, "expired")
diff --git
a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
index 1404289..e9052f5 100644
---
a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
+++
b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
@@ -44,7 +44,6 @@ import org.apache.syncope.client.ui.commons.BaseSession;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.IdRepoEntitlement;
import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.wicket.Session;
@@ -98,6 +97,10 @@ public class SyncopeEnduserSession extends WebSession
implements BaseSession {
executor.initialize();
}
+protected String message(final SyncopeClientException sce) {
+return sce.getType().name() + ": " +
sce.getElements().stream().collect(Collectors.joining(", "));
+}
+
@Override
public void onException(final Exception e) {
Throwable root = ExceptionUtils.getRootCause(e);
@@ -105,12 +108,9 @@ public class SyncopeEnduserSession extends WebSession
implements BaseSession {
if (root instanceof SyncopeClientException) {
SyncopeClientException sce = (SyncopeClientException) root;
-if (sce.getType() == ClientExceptionType.InvalidSecurityAnswer) {
-message =
getApplication().getResourceSettings().getLocalizer().
-getString("invalid.security.answer", null);
-} else if (!sce.isComposite()) {
-message =
sce.getElements().stream().collect(Collectors.joining(", "));
-}
+message = sce.isComposite()
+?
sce.asComposite().getExceptions().stream().map(this::message).collect(Collectors.joining(";
"))
+: message(sce);
} else if (root instanceof AccessControlException || root instanceof
ForbiddenException) {
Error error = StringUtils.containsIgnoreCase(message, "expired")
? Error.SESSION_EXPIRED