darn, I thought you might fall for that :-)

ok, so lets change it to:

Index: .
===================================================================
--- .    (revision 579354)
+++ .    (working copy)
@@ -305,6 +305,11 @@
     */
    public static void unset()
    {
+        Session session = (Session)current.get();
+        if (session != null)
+    {
+        session.detach();
+    }
        current.set(null);
    }



In my current project well fell over this looking at:

WicketFilter.getLastModified(final HttpServletRequest servletRequest)
where cachable resources lead over Session.findOrCreate to Session.set(Session) 
to Session.attach()

but the Session.unset() doesn't lead to a Session.detach()

Martin



Martijn Dashorst schrieb:
Why do you want a NullPointerException to occur in unset? :-)

Martijn

On 9/25/07, Martin Funk <[EMAIL PROTECTED]> wrote:
Hi,

what is the contract of Session.attach() and Session.detach() ?

Especially, is it intended that after a call to attach() that there will
be at least one call to detach() before the request goes back to the client?
If that's the case, then there might be a bug in Session and I propose
the following patch on org.apache.wicket.Session

Index: .
===================================================================
--- .    (revision 579354)
+++ .    (working copy)
@@ -305,6 +305,11 @@
      */
     public static void unset()
     {
+        Session session = (Session)current.get();
+        if (session == null)
+    {
+        session.detach();
+    }
         current.set(null);
     }


Martin






Reply via email to