tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 47502] clustering fails on serializing javax.security.auth.subject
Date Thu, 05 Nov 2009 18:10:36 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=47502

--- Comment #1 from Tim Funk <funkman@apache.org> 2009-11-05 10:10:32 UTC ---
StandardSession excludes the session attribute named
javax.security.auth.subject from being serialized. DeltaSession does not. 

Here's what StandardSession excludes from serializing:
    protected static final String[] excludedAttributes = {
        Globals.SUBJECT_ATTR
    };


Of course ... I suspect (without a deeper code dive) that excluding this from
serialization might mean that you are not logged in across the whole cluster.

How to test ...

Here is the existing code in DeltaSession.writeObject
        for (int i = 0; i < keys.length; i++) {
            Object value = null;
            value = attributes.get(keys[i]);
            if (value == null)
                continue;
            else if (value instanceof Serializable) {
                saveNames.add(keys[i]);
                saveValues.add(value);
            }
        }

try changing it to (so we are excluding it from serialization) 
        for (int i = 0; i < keys.length; i++) {
            Object value = null;
            value = attributes.get(keys[i]);
            if (value == null || exclude(keys[i]))
                continue;
            else if (value instanceof Serializable) {
                saveNames.add(keys[i]);
                saveValues.add(value);
            }
        }


HERE is the patch ...
Index: java/org/apache/catalina/ha/session/DeltaSession.java
===================================================================
--- java/org/apache/catalina/ha/session/DeltaSession.java       (revision
833086)
+++ java/org/apache/catalina/ha/session/DeltaSession.java       (working copy)
@@ -731,7 +731,7 @@
         for (int i = 0; i < keys.length; i++) {
             Object value = null;
             value = attributes.get(keys[i]);
-            if (value == null)
+            if (value == null || exclude(keys[i]))
                 continue;
             else if (value instanceof Serializable) {
                 saveNames.add(keys[i]);

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message