You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/07/22 13:27:15 UTC

[isis] branch master updated (f9c516e -> a2c3cac)

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git.


 discard f9c516e  ISIS-2297: ImpersonatedUserHolderForWicket: guards against RequestCycle not available
     new a2c3cac  ISIS-2816: ImpersonatedUserHolderForWicket: guards against RequestCycle not available

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (f9c516e)
            \
             N -- N -- N   refs/heads/master (a2c3cac)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:

[isis] 01/01: ISIS-2816: ImpersonatedUserHolderForWicket: guards against RequestCycle not available

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git

commit a2c3cac965641e6ee74421cb1a2a84fef0bd34f3
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu Jul 22 15:26:57 2021 +0200

    ISIS-2816: ImpersonatedUserHolderForWicket: guards against RequestCycle
    not available
---
 .../viewer/services/ImpersonatedUserHolderForWicket.java       | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/viewers/wicket/viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/services/ImpersonatedUserHolderForWicket.java b/viewers/wicket/viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/services/ImpersonatedUserHolderForWicket.java
index 660758e..0a03dbd 100644
--- a/viewers/wicket/viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/services/ImpersonatedUserHolderForWicket.java
+++ b/viewers/wicket/viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/services/ImpersonatedUserHolderForWicket.java
@@ -23,12 +23,15 @@ import java.util.Optional;
 import javax.inject.Named;
 
 import org.apache.wicket.Session;
+import org.apache.wicket.request.cycle.RequestCycle;
 import org.springframework.stereotype.Component;
 
 import org.apache.isis.applib.annotation.PriorityPrecedence;
 import org.apache.isis.applib.services.user.ImpersonatedUserHolder;
 import org.apache.isis.applib.services.user.UserMemento;
 
+import lombok.val;
+
 /**
  * Implementation that supports impersonation, using the Wicket {@link Session}
  * to store the value.
@@ -71,7 +74,12 @@ public class ImpersonatedUserHolderForWicket implements ImpersonatedUserHolder {
     }
 
     private static Optional<Session> session() {
-        return Optional.ofNullable(Session.get());
+        //XXX[ISIS-2816] guards against RequestCycle not available,
+        // when in the process of expiring the Session
+        val requestCycle = RequestCycle.get();
+        return requestCycle != null
+                ? Optional.of(Session.get())
+                : Optional.empty();
     }
 
 }