From: Jeanfrancois Arcand <[EMAIL PROTECTED]>
Reply-To: "Tomcat Developers List" <[EMAIL PROTECTED]>
To: Tomcat Developers List <[EMAIL PROTECTED]>
Subject: Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java
Date: Thu, 01 Apr 2004 14:13:42 -0500




daniel andefors wrote:

Hi,

IMO, this will not work if you are trying to avoid serializing attributes with the name "javax.security.auth.subject".

You are right. The key will not be serializable, but the value will be. I also need to make the value (e.g. the Subject) transient.

Actually, i think that will not help either. AFAIK, the transient keyword
should only be used on non-static fields to make the *default* serialization
mechanism exclude that field (i.e., oos.defaultWriteObject() will not write
transient fields, oos.writeObject(...) will write whatever object used as
argument assuming it implements java.io.Serializable or java.io.Externalizable).
Although, i might be wrong, and if I am I should probably give you my
SCJP diploma ;-)


Daniel



Thanks!


-- Jeanfrancois



Daniel



From: [EMAIL PROTECTED]
Reply-To: "Tomcat Developers List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java
Date: 1 Apr 2004 17:39:53 -0000


jfarcand 2004/04/01 09:39:53

Modified: catalina/src/share/org/apache/catalina Globals.java
catalina/src/share/org/apache/catalina/session
StandardSession.java
Log:
Minor fixe. Instead of using an exclude list, make the variable transient.


Revision Changes Path
1.8 +2 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Globals.java



Index: Globals.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Globals.java,v


  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Globals.java    27 Feb 2004 14:58:38 -0000    1.7
  +++ Globals.java    1 Apr 2004 17:39:53 -0000    1.8
  @@ -287,7 +287,7 @@
       /**
        * The subject under which the AccessControlContext is running.
        */
  -    public static final String SUBJECT_ATTR =
  +    public static transient final String SUBJECT_ATTR =
           "javax.security.auth.subject";





1.42 +2 -26 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardSession.java


Index: StandardSession.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardSession.java,v


  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- StandardSession.java    25 Mar 2004 22:17:54 -0000    1.41
  +++ StandardSession.java    1 Apr 2004 17:39:53 -0000    1.42
  @@ -160,14 +160,6 @@


/** - * Set of attribute names which are not allowed to be persisted. - */ - private static final String[] excludedAttributes = { - Globals.SUBJECT_ATTR - }; - - - /** * We are currently processing a session expiration, so bypass * certain IllegalStateException tests. NOTE: This value is not * included in the serialized version of this object. @@ -1393,8 +1385,7 @@ } if (value == null) continue; - else if ( (value instanceof Serializable) - && (!exclude(keys[i]) )) { + else if ( (value instanceof Serializable) ) { saveNames.add(keys[i]); saveValues.add(value); } else { @@ -1422,21 +1413,6 @@ } }

  -    }
  -
  -
  -    /**
  -     * Exclude attribute that cannot be serialized.
  -     * @param name the attribute's name
  -     */
  -    protected boolean exclude(String name){
  -
  -        for (int i = 0; i < excludedAttributes.length; i++) {
  -            if (name.equalsIgnoreCase(excludedAttributes[i]))
  -                return true;
  -        }
  -
  -        return false;
       }






--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
Chat: Ha en fest på Habbo Hotel http://habbohotel.msn.se/habbo/sv/channelizer Checka in här!



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________ Auktioner: Tjäna en hacka på gamla prylar http://tradera.msn.se


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to