cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java StandardManager.java

2005-06-16 Thread remm
remm2005/06/16 02:50:12

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java StandardManager.java
  Log:
  - 34760: Passivating session should not make stop fail.
  
  Revision  ChangesPath
  1.60  +3 -2  
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.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- StandardSession.java  15 Jun 2005 23:50:12 -  1.59
  +++ StandardSession.java  16 Jun 2005 09:50:12 -  1.60
  @@ -53,6 +53,7 @@
   import org.apache.catalina.util.StringManager;
   
   import org.apache.catalina.security.SecurityUtil;
  +
   /**
* Standard implementation of the bSession/b interface.  This object is
* serializable, so that it can be stored in persistent storage or 
transferred
  @@ -1452,7 +1453,7 @@
   saveNames.add(keys[i]);
   saveValues.add(value);
   } else {
  -removeAttribute(keys[i]);
  +removeAttributeInternal(keys[i], true);
   }
   }
   
  
  
  
  1.31  +3 -3  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardManager.java
  
  Index: StandardManager.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardManager.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- StandardManager.java  31 Mar 2005 10:31:53 -  1.30
  +++ StandardManager.java  16 Jun 2005 09:50:12 -  1.31
  @@ -664,8 +664,8 @@
   // Write out sessions
   try {
   unload();
  -} catch (IOException e) {
  -log.error(sm.getString(standardManager.managerUnload), e);
  +} catch (Throwable t) {
  +log.error(sm.getString(standardManager.managerUnload), t);
   }
   
   // Expire all active sessions
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2005-06-15 Thread luehe
luehe   2005/06/15 16:41:25

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  After deserializing a StandardSession, reinit its transient
  listeners and notes fields, to prevent NPEs when they are
  accessed.
  
  Revision  ChangesPath
  1.58  +8 -1  
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.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- StandardSession.java  31 Mar 2005 10:31:53 -  1.57
  +++ StandardSession.java  15 Jun 2005 23:41:25 -  1.58
  @@ -1393,6 +1393,13 @@
   }
   isValid = isValidSave;
   
  +if (listeners == null) {
  +listeners = new ArrayList();
  +}
  +
  +if (notes == null) {
  +notes = new HashMap();
  +}
   }
   
   
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2005-06-15 Thread luehe
luehe   2005/06/15 16:50:12

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Reverted the scope of readObject() and writeObject() from protected to
  private, in order to give subclasses an opportunity to implement their
  own.
  
  A class that wants to customize its Serialization must declare its
  readObject() and writeObject() with private scope.
  
  This won't be possible for subclasses of StandardSession.java, if the
  StandardSession.java superclass has already declared these methods with
  protected scope.
  
  Revision  ChangesPath
  1.59  +3 -3  
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.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- StandardSession.java  15 Jun 2005 23:41:25 -  1.58
  +++ StandardSession.java  15 Jun 2005 23:50:12 -  1.59
  @@ -1355,7 +1355,7 @@
* @exception ClassNotFoundException if an unknown class is specified
* @exception IOException if an input/output error occurs
*/
  -protected void readObject(ObjectInputStream stream)
  +private void readObject(ObjectInputStream stream)
   throws ClassNotFoundException, IOException {
   
   // Deserialize the scalar instance variables (except Manager)
  @@ -1422,7 +1422,7 @@
*
* @exception IOException if an input/output error occurs
*/
  -protected void writeObject(ObjectOutputStream stream) throws IOException 
{
  +private void writeObject(ObjectOutputStream stream) throws IOException {
   
   // Write the scalar instance variables (except Manager)
   stream.writeObject(new Long(creationTime));
  
  
  

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



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2005-03-25 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
luehe   2005/03/25 08:49:28
  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Commented out session validity check in StandardSession.getId().
  Will revisit for 5.5.10.
There will be two options for the internal components, I think:
1) use a new getIdInternal method
2) call isValild before doing the stuff (this might be better)
Rémy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2005-03-23 Thread Jan Luehe
Yoav,

Yoav Shapira wrote:
 Hola,
 
 
My believe is that the above errata will be reflected in the next
(maintenance) release of the servlet spec. I will remind the servlet
spec lead that this needs to happen.

Jan
 
 
 What's the ETA on this maintenance spec release?

work is supposed to start sometime this summer,
and will be completed in time for J2EE 5.0 FCS.

Jan


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



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2005-03-22 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
billbarker2005/03/21 19:50:03
  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  From the comments for R1.11, it seems that some early version of the spec had an exception here.  However, this didn't survive to the final spec version, so we can once again allow access to getLastAccessedTime from an invalid session.
  
  Fix for Bug #34107
I didn't know that, as the javadoc actually says:
getLastAccessedTime
public long getLastAccessedTime()
Returns the last time the client sent a request associated with 
this session, as the number of milliseconds since midnight January 1, 
1970 GMT, and marked by the time the container received the request.

Actions that your application takes, such as getting or setting a 
value associated with the session, do not affect the access time.

Returns:
a long representing the last time the client sent a request 
associated with this session, expressed in milliseconds since 1/1/1970 GMT
Throws:
java.lang.IllegalStateException - if this method is called 
on an invalidated session

Which paragraph in the spec has the conflicting statement ?
Rémy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2005-03-22 Thread Bill Barker
- Original Message - 
From: Remy Maucherat [EMAIL PROTECTED]
To: Tomcat Developers List tomcat-dev@jakarta.apache.org
Sent: Tuesday, March 22, 2005 1:57 AM
Subject: Re: cvs commit: 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session 
StandardSession.java


[EMAIL PROTECTED] wrote:
billbarker2005/03/21 19:50:03
  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  From the comments for R1.11, it seems that some early version of the 
spec had an exception here.  However, this didn't survive to the final 
spec version, so we can once again allow access to getLastAccessedTime 
from an invalid session.
  Fix for Bug #34107
I didn't know that, as the javadoc actually says:
getLastAccessedTime
public long getLastAccessedTime()
Returns the last time the client sent a request associated with this 
session, as the number of milliseconds since midnight January 1, 1970 GMT, 
and marked by the time the container received the request.

Actions that your application takes, such as getting or setting a 
value associated with the session, do not affect the access time.

Returns:
a long representing the last time the client sent a request 
associated with this session, expressed in milliseconds since 1/1/1970 GMT
Throws:
java.lang.IllegalStateException - if this method is called
on an invalidated session

Which paragraph in the spec has the conflicting statement ?
It's the java-doc for jakarta-servletapi-5 that is wrong.  The javadocs in 
the servlet spec do not contain a 'throws' clause.  See also: 
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSession.html#getLastAccessedTime()

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


This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication 
in error, please notify us immediately by e-mail and then delete all copies of 
this message and any attachments.
In addition you should be aware that ordinary (unencrypted) e-mail sent through 
the Internet is not secure. Do not send confidential or sensitive information, 
such as social security numbers, account numbers, personal identification 
numbers and passwords, to us via ordinary (unencrypted) e-mail.

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

Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2005-03-22 Thread Remy Maucherat
Bill Barker wrote:
- Original Message - From: Remy Maucherat [EMAIL PROTECTED]
To: Tomcat Developers List tomcat-dev@jakarta.apache.org
Sent: Tuesday, March 22, 2005 1:57 AM
Subject: Re: cvs commit: 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session 
StandardSession.java


[EMAIL PROTECTED] wrote:
billbarker2005/03/21 19:50:03
  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  From the comments for R1.11, it seems that some early version of 
the spec had an exception here.  However, this didn't survive to the 
final spec version, so we can once again allow access to 
getLastAccessedTime from an invalid session.
  Fix for Bug #34107

I didn't know that, as the javadoc actually says:
getLastAccessedTime
public long getLastAccessedTime()
Returns the last time the client sent a request associated with 
this session, as the number of milliseconds since midnight January 1, 
1970 GMT, and marked by the time the container received the request.

Actions that your application takes, such as getting or setting a 
value associated with the session, do not affect the access time.

Returns:
a long representing the last time the client sent a request 
associated with this session, expressed in milliseconds since 1/1/1970 
GMT
Throws:
java.lang.IllegalStateException - if this method is called
on an invalidated session

Which paragraph in the spec has the conflicting statement ?
It's the java-doc for jakarta-servletapi-5 that is wrong.  The javadocs 
in the servlet spec do not contain a 'throws' clause.  See also: 
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSession.html#getLastAccessedTime() 
Here: 
http://jcp.org/aboutJava/communityprocess/maintenance/jsr154/154errata.txt

I now read:
2. Fix typos in HttpSession.java
   Replace:
 * @exeption IllegalStateException if this method is called on an
 * invalidated session
   in javadoc of getId() and getLastAccessedTime()
   With:
 * @exception IllegalStateException if this method is called on an
 *  invalidated session
   This fix causes the following addition to HttpSession.getId() and
   HttpSession.getLastAccessedTime() methods. Since these two methods are
   already implemented in all containers to throw this exception and the
   spec clearly intends to do so, this is not changing the spec.
   SRV.15.1.7.1 Page 267, 268
 Throws:
 IllegalStateException - if this method is called on an invalidated
 session
There's highly conflicting information ...
Rémy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2005-03-22 Thread billbarker
billbarker2005/03/22 07:26:44

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Reverting change.
  
  Note to self:  Next time check the errata as well as -fr
  
  Revision  ChangesPath
  1.53  +6 -2  
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.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- StandardSession.java  22 Mar 2005 03:50:03 -  1.52
  +++ StandardSession.java  22 Mar 2005 15:26:44 -  1.53
  @@ -409,7 +409,11 @@
*/
   public long getLastAccessedTime() {
   
  -return (this.lastAccessedTime);
  + if ( !isValid() ) {
  + throw new IllegalStateException
  + (sm.getString(standardSession.getLastAccessedTime.ise));
  + }
  + return (this.lastAccessedTime);
   
   }
   
  
  
  

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



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2005-03-22 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
billbarker2005/03/22 07:26:44
  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Reverting change.
  
  Note to self:  Next time check the errata as well as -fr
I think someone closer to the spec needs to comment on these 
contradictions, because the errata also says getId should throw an ISE 
(while we do not).

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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2005-03-22 Thread Bill Barker
- Original Message - 
From: Remy Maucherat [EMAIL PROTECTED]
To: Tomcat Developers List tomcat-dev@jakarta.apache.org
Sent: Tuesday, March 22, 2005 7:46 AM
Subject: Re: cvs commit: 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session 
StandardSession.java


[EMAIL PROTECTED] wrote:
billbarker2005/03/22 07:26:44
  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Reverting change.
  Note to self:  Next time check the errata as well as -fr
I think someone closer to the spec needs to comment on these 
contradictions, because the errata also says getId should throw an ISE 
(while we do not).
Agreed.  If we start throwing an ISE on getId, we are going to break every 
app that uses HttpSessionBindingListener.  However, if the expert group says 
we must, then we must.

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


This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication 
in error, please notify us immediately by e-mail and then delete all copies of 
this message and any attachments.
In addition you should be aware that ordinary (unencrypted) e-mail sent through 
the Internet is not secure. Do not send confidential or sensitive information, 
such as social security numbers, account numbers, personal identification 
numbers and passwords, to us via ordinary (unencrypted) e-mail.

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

Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2005-03-22 Thread Jan Luehe


Remy Maucherat wrote:
 Bill Barker wrote:
 
- Original Message - From: Remy Maucherat [EMAIL PROTECTED]
To: Tomcat Developers List tomcat-dev@jakarta.apache.org
Sent: Tuesday, March 22, 2005 1:57 AM
Subject: Re: cvs commit: 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session 
StandardSession.java



[EMAIL PROTECTED] wrote:


billbarker2005/03/21 19:50:03

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  From the comments for R1.11, it seems that some early version of 
the spec had an exception here.  However, this didn't survive to the 
final spec version, so we can once again allow access to 
getLastAccessedTime from an invalid session.
  Fix for Bug #34107


I didn't know that, as the javadoc actually says:

getLastAccessedTime

public long getLastAccessedTime()

Returns the last time the client sent a request associated with 
this session, as the number of milliseconds since midnight January 1, 
1970 GMT, and marked by the time the container received the request.

Actions that your application takes, such as getting or setting a 
value associated with the session, do not affect the access time.

Returns:
a long representing the last time the client sent a request 
associated with this session, expressed in milliseconds since 1/1/1970 
GMT
Throws:

   java.lang.IllegalStateException - if this method is called

on an invalidated session

Which paragraph in the spec has the conflicting statement ?


It's the java-doc for jakarta-servletapi-5 that is wrong.  The javadocs 
in the servlet spec do not contain a 'throws' clause.  See also: 
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSession.html#getLastAccessedTime()
 
 
 
 Here: 
 http://jcp.org/aboutJava/communityprocess/maintenance/jsr154/154errata.txt
 
 I now read:
 2. Fix typos in HttpSession.java
 
 Replace:
 
   * @exeption IllegalStateException if this method is called on an
   * invalidated session
 
 in javadoc of getId() and getLastAccessedTime()
 With:
 
   * @exception IllegalStateException if this method is called on an
   *  invalidated session
 
 This fix causes the following addition to HttpSession.getId() and
 HttpSession.getLastAccessedTime() methods. Since these two methods are
 already implemented in all containers to throw this exception and the
 spec clearly intends to do so, this is not changing the spec.
 
 SRV.15.1.7.1 Page 267, 268
 
   Throws:
   IllegalStateException - if this method is called on an invalidated
   session
 
 There's highly conflicting information ...


I think the intention is for both methods to throw an ISE in case
they're being called on an invalidated session, as has been clarified
by the errata.

It seems this has been the intent for both methods from the very
beginning, except that the throws clauses in the javadocs at
  http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSession.html

which are also copied in the servlet spec, were never generated for
these 2 methods because of a stupid typo (@exeption vs @exception) in
the HttpSession.java source file.

The HttpSession.java source in jakarta-servletapi-5 already has the fix.

My believe is that the above errata will be reflected in the next
(maintenance) release of the servlet spec. I will remind the servlet
spec lead that this needs to happen.


Jan






 Rémy
 
 -
 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]



RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2005-03-22 Thread Yoav Shapira
Hola,

 My believe is that the above errata will be reflected in the next
 (maintenance) release of the servlet spec. I will remind the servlet
 spec lead that this needs to happen.
 
 Jan

What's the ETA on this maintenance spec release?

Yoav


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



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2005-03-21 Thread Bill Barker

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, March 21, 2005 8:25 AM
Subject: cvs commit:
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session
StandardSession.java


 remm2005/03/21 08:25:53

   Modified:catalina/src/share/org/apache/catalina/session
 StandardSession.java
   Log:
   - 34107: I would think the session should still be seen as valid when
notifying attributes of unbinding.
   - Does this cause regressions or not ?


As promised, a big -1 on this.  It breaks the servlet-spec, which
specifically states that the session is invalid.



This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication 
in error, please notify us immediately by e-mail and then delete all copies of 
this message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through 
the Internet is not secure. Do not send confidential or sensitive information, 
such as social security numbers, account numbers, personal identification 
numbers and passwords, to us via ordinary (unencrypted) e-mail.


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

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2005-03-21 Thread remm
remm2005/03/21 12:02:21

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  - Undo change.
  
  Revision  ChangesPath
  1.51  +4 -4  
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.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- StandardSession.java  21 Mar 2005 16:25:53 -  1.50
  +++ StandardSession.java  21 Mar 2005 20:02:21 -  1.51
  @@ -709,14 +709,14 @@
   fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null);
   }
   
  +// We have completed expire of this session
  +expiring = false;
  +
   // Unbind any objects associated with this session
   String keys[] = keys();
   for (int i = 0; i  keys.length; i++)
   removeAttributeInternal(keys[i], notify);
   
  -// We have completed expire of this session
  -expiring = false;
  -
   }
   
   }
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2005-03-21 Thread billbarker
billbarker2005/03/21 19:50:03

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  From the comments for R1.11, it seems that some early version of the spec had 
an exception here.  However, this didn't survive to the final spec version, so 
we can once again allow access to getLastAccessedTime from an invalid session.
  
  Fix for Bug #34107
  
  Revision  ChangesPath
  1.52  +2 -5  
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.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- StandardSession.java  21 Mar 2005 20:02:21 -  1.51
  +++ StandardSession.java  22 Mar 2005 03:50:03 -  1.52
  @@ -408,10 +408,7 @@
* a value associated with the session, do not affect the access time.
*/
   public long getLastAccessedTime() {
  -if ( !isValid() ) {
  -throw new IllegalStateException
  -(sm.getString(standardSession.getLastAccessedTime.ise));
  -}
  +
   return (this.lastAccessedTime);
   
   }
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-07-15 Thread remm
remm2004/07/15 07:42:39

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  - I looked in the spec, and I don't think the notifications should be sent when 
replacing an attribute with the
same instance.
  - Also add some (small) syncs on set and remove so that the HashMap structure 
doesn't become corrupted.
We'll see if that's really needed, but I don't think this has any noticeable 
performance impact.
  
  Revision  ChangesPath
  1.46  +21 -21
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.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- StandardSession.java  23 Jun 2004 16:59:42 -  1.45
  +++ StandardSession.java  15 Jul 2004 14:42:38 -  1.46
  @@ -715,7 +715,7 @@
   HttpSessionEvent event = null;
   String keys[] = keys();
   for (int i = 0; i  keys.length; i++) {
  -Object attribute = getAttributeInternal(keys[i]);
  +Object attribute = attributes.get(keys[i]);
   if (attribute instanceof HttpSessionActivationListener) {
   if (event == null)
   event = new HttpSessionEvent(getSession());
  @@ -742,7 +742,7 @@
   HttpSessionEvent event = null;
   String keys[] = keys();
   for (int i = 0; i  keys.length; i++) {
  -Object attribute = getAttributeInternal(keys[i]);
  +Object attribute = attributes.get(keys[i]);
   if (attribute instanceof HttpSessionActivationListener) {
   if (event == null)
   event = new HttpSessionEvent(getSession());
  @@ -1212,20 +1212,27 @@
   
   // Call the valueBound() method if necessary
   if (value instanceof HttpSessionBindingListener) {
  -event = new HttpSessionBindingEvent(getSession(), name, value);
  -try {
  -((HttpSessionBindingListener) value).valueBound(event);
  -} catch (Throwable t){
  -manager.getContainer().getLogger().error
  +// Don't call any notification if replacing with the same value
  +Object oldValue = attributes.get(name);
  +if (value != oldValue) {
  +event = new HttpSessionBindingEvent(getSession(), name, value);
  +try {
  +((HttpSessionBindingListener) value).valueBound(event);
  +} catch (Throwable t){
  +manager.getContainer().getLogger().error
   (sm.getString(standardSession.bindingEvent), t); 
  +}
   }
   }
   
   // Replace or add this attribute
  -Object unbound = attributes.put(name, value);
  +Object unbound = null;
  +synchronized (attributes) {
  +unbound = attributes.put(name, value);
  +}
   
   // Call the valueUnbound() method if necessary
  -if ((unbound != null) 
  +if ((unbound != null)  (unbound != value) 
   (unbound instanceof HttpSessionBindingListener)) {
   try {
   ((HttpSessionBindingListener) unbound).valueUnbound
  @@ -1530,16 +1537,6 @@
   
   
   /**
  - * Return the value of an attribute without a check for validity.
  - */
  -protected Object getAttributeInternal(String name) {
  -
  -return (attributes.get(name));
  -
  -}
  -
  -
  -/**
* Remove the object bound with the specified name from this session.  If
* the session does not have an object bound with this name, this method
* does nothing.
  @@ -1555,7 +1552,10 @@
   protected void removeAttributeInternal(String name, boolean notify) {
   
   // Remove this attribute from our collection
  -Object value = attributes.remove(name);
  +Object value = null;
  +synchronized (attributes) {
  +value = attributes.remove(name);
  +}
   
   // Do we need to do valueUnbound() and attributeRemoved() notification?
   if (!notify || (value == null)) {
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-06-02 Thread remm
remm2004/06/02 03:18:21

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  - Replace this with getSession() as suggested by Filip.
  
  Revision  ChangesPath
  1.44  +11 -9 
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.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- StandardSession.java  1 Apr 2004 20:18:15 -   1.43
  +++ StandardSession.java  2 Jun 2004 10:18:20 -   1.44
  @@ -725,7 +725,7 @@
   Object attribute = getAttributeInternal(keys[i]);
   if (attribute instanceof HttpSessionActivationListener) {
   if (event == null)
  -event = new HttpSessionEvent(this);
  +event = new HttpSessionEvent(getSession());
   try {
   ((HttpSessionActivationListener)attribute)
   .sessionWillPassivate(event);
  @@ -751,7 +751,7 @@
   Object attribute = getAttributeInternal(keys[i]);
   if (attribute instanceof HttpSessionActivationListener) {
   if (event == null)
  -event = new HttpSessionEvent(this);
  +event = new HttpSessionEvent(getSession());
   try {
   ((HttpSessionActivationListener)attribute)
   .sessionDidActivate(event);
  @@ -1217,7 +1217,7 @@
   
   // Call the valueBound() method if necessary
   if (value instanceof HttpSessionBindingListener) {
  -event = new HttpSessionBindingEvent(this, name, value);
  +event = new HttpSessionBindingEvent(getSession(), name, value);
   try {
   ((HttpSessionBindingListener) value).valueBound(event);
   } catch (Throwable t){
  @@ -1233,7 +1233,7 @@
   (unbound instanceof HttpSessionBindingListener)) {
   try {
   ((HttpSessionBindingListener) unbound).valueUnbound
  -(new HttpSessionBindingEvent(this, name));
  +(new HttpSessionBindingEvent(getSession(), name));
   } catch (Throwable t) {
   log(sm.getString(standardSession.bindingEvent), t);
   }
  @@ -1256,7 +1256,7 @@
  listener);
   if (event == null) {
   event = new HttpSessionBindingEvent
  -(this, name, unbound);
  +(getSession(), name, unbound);
   }
   listener.attributeReplaced(event);
   fireContainerEvent(context,
  @@ -1267,7 +1267,8 @@
  beforeSessionAttributeAdded,
  listener);
   if (event == null) {
  -event = new HttpSessionBindingEvent(this, name, value);
  +event = new HttpSessionBindingEvent
  +(getSession(), name, value);
   }
   listener.attributeAdded(event);
   fireContainerEvent(context,
  @@ -1561,7 +1562,7 @@
   // Call the valueUnbound() method if necessary
   HttpSessionBindingEvent event = null;
   if (value instanceof HttpSessionBindingListener) {
  -event = new HttpSessionBindingEvent(this, name, value);
  +event = new HttpSessionBindingEvent(getSession(), name, value);
   ((HttpSessionBindingListener) value).valueUnbound(event);
   }
   
  @@ -1580,7 +1581,8 @@
  beforeSessionAttributeRemoved,
  listener);
   if (event == null) {
  -event = new HttpSessionBindingEvent(this, name, value);
  +event = new HttpSessionBindingEvent
  +(getSession(), name, value);
   }
   listener.attributeRemoved(event);
   fireContainerEvent(context,
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-04-01 Thread jfarcand
jfarcand2004/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  ChangesPath
  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 -  1.7
  +++ Globals.java  1 Apr 2004 17:39:53 -   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 -  1.41
  +++ StandardSession.java  1 Apr 2004 17:39:53 -   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]



RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-04-01 Thread daniel andefors
Hi,

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

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 -

jfarcand2004/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  ChangesPath
  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 -	1.7
  +++ Globals.java	1 Apr 2004 17:39:53 -	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 -	1.41
  +++ StandardSession.java	1 Apr 2004 17:39:53 -	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]


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-04-01 Thread Jeanfrancois Arcand


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.

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 -

jfarcand2004/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  ChangesPath
  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.java27 Feb 2004 14:58:38 -1.7
  +++ Globals.java1 Apr 2004 17:39:53 -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.java25 Mar 2004 22:17:54 -1.41
  +++ StandardSession.java1 Apr 2004 17:39:53 -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]


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-04-01 Thread daniel andefors



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 -

jfarcand2004/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  ChangesPath
  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.java27 Feb 2004 14:58:38 -1.7
  +++ Globals.java1 Apr 2004 17:39:53 -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.java25 Mar 2004 22:17:54 -1.41
  +++ StandardSession.java1 Apr 2004 17:39:53 -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

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-04-01 Thread jfarcand
jfarcand2004/04/01 12:18:15

  Modified:catalina/src/share/org/apache/catalina Globals.java
   catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Re-add initinal work since it doesn't seems to work (my bad)
  
  Thanks to daniel_andefors at hotmail.com
  
  Revision  ChangesPath
  1.9   +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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Globals.java  1 Apr 2004 17:39:53 -   1.8
  +++ Globals.java  1 Apr 2004 20:18:15 -   1.9
  @@ -287,7 +287,7 @@
   /**
* The subject under which the AccessControlContext is running.
*/
  -public static transient final String SUBJECT_ATTR =
  +public static final String SUBJECT_ATTR =
   javax.security.auth.subject;
   
   
  
  
  
  1.43  +25 -1 
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.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- StandardSession.java  1 Apr 2004 17:39:53 -   1.42
  +++ StandardSession.java  1 Apr 2004 20:18:15 -   1.43
  @@ -160,6 +160,14 @@
   
   
   /**
  + * 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.
  @@ -1385,7 +1393,8 @@
   }
   if (value == null)
   continue;
  -else if ( (value instanceof Serializable) ) {
  +else if ( (value instanceof Serializable) 
  + (!exclude(keys[i]) )) {
   saveNames.add(keys[i]);
   saveValues.add(value);
   } else {
  @@ -1413,6 +1422,21 @@
   }
   }
   
  +}
  +
  +
  +/**
  + * 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]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-03-25 Thread markt
markt   2004/03/25 14:17:54

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  - Fix bug 18479. Non-serializable sessions attributes should be removed (so 
valueUnbound is called).
This aligns the actual functionality with the writeObject() implementation javadoc 
comment.
  - Ported from TC4.
  
  Revision  ChangesPath
  1.41  +3 -1  
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.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- StandardSession.java  12 Mar 2004 22:36:46 -  1.40
  +++ StandardSession.java  25 Mar 2004 22:17:54 -  1.41
  @@ -1397,6 +1397,8 @@
(!exclude(keys[i]) )) {
   saveNames.add(keys[i]);
   saveValues.add(value);
  +} else {
  +removeAttribute(keys[i]);
   }
   }
   
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-03-12 Thread luehe
luehe   2004/03/12 14:36:46

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  set accessCount to 0 (instead of 1) in recycle()
  
  Revision  ChangesPath
  1.40  +2 -2  
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.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- StandardSession.java  12 Mar 2004 19:45:43 -  1.39
  +++ StandardSession.java  12 Mar 2004 22:36:46 -  1.40
  @@ -802,7 +802,7 @@
   id = null;
   lastAccessedTime = 0L;
   maxInactiveInterval = -1;
  -accessCount = 1;
  +accessCount = 0;
   notes.clear();
   setPrincipal(null);
   isNew = false;
  
  
  

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



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-03-11 Thread Jan Luehe
Remy Maucherat wrote:
Remy Maucherat wrote:

[EMAIL PROTECTED] wrote:

luehe   2004/03/10 20:18:31

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Fixed regression re: Bugtraq 4839736
  (HttpSession.setMaxInactiveInterval() doesn't behave as expected),
  which had been originally fixed in revision 1.20


-1. I don't agree with this change: the session is (apparently) 
supposed to be valid while it is being accessed, regardless of 
MaxInactiveInterval.


See bug 26051.
Your example from revision 1.20 seems invalid.
Yes, you're right, and I'm going to revert the change.

Jan



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


cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-03-11 Thread luehe
luehe   2004/03/11 11:56:52

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Reverted previous change, as it breaks the fix for Bugzilla 26051.
  Test case for Bugtraq 4839736 (see revision 1.20) is invalid.
  
  Revision  ChangesPath
  1.38  +5 -5  
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.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- StandardSession.java  11 Mar 2004 04:18:31 -  1.37
  +++ StandardSession.java  11 Mar 2004 19:56:52 -  1.38
  @@ -555,16 +555,16 @@
   return false;
   }
   
  +if (accessCount  0) {
  +return true;
  +}
  +
   if (maxInactiveInterval = 0) { 
   long timeNow = System.currentTimeMillis();
   int timeIdle = (int) ((timeNow - thisAccessedTime) / 1000L);
   if (timeIdle = maxInactiveInterval) {
   expire(true);
   }
  -}
  -
  -if (accessCount  0) {
  -return true;
   }
   
   return (this.isValid);
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-03-10 Thread luehe
luehe   2004/03/10 20:18:31

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Fixed regression re: Bugtraq 4839736
  (HttpSession.setMaxInactiveInterval() doesn't behave as expected),
  which had been originally fixed in revision 1.20
  
  Revision  ChangesPath
  1.37  +6 -6  
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.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- StandardSession.java  4 Mar 2004 17:51:16 -   1.36
  +++ StandardSession.java  11 Mar 2004 04:18:31 -  1.37
  @@ -276,7 +276,7 @@
   
   
   /**
  - * The access count for thsi session.
  + * The access count for this session.
*/
   protected transient int accessCount = 1;
   
  @@ -555,16 +555,16 @@
   return false;
   }
   
  -if (accessCount  0) {
  -return true;
  -}
  -
   if (maxInactiveInterval = 0) { 
   long timeNow = System.currentTimeMillis();
   int timeIdle = (int) ((timeNow - thisAccessedTime) / 1000L);
   if (timeIdle = maxInactiveInterval) {
   expire(true);
   }
  +}
  +
  +if (accessCount  0) {
  +return true;
   }
   
   return (this.isValid);
  
  
  

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



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-03-10 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
luehe   2004/03/10 20:18:31

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Fixed regression re: Bugtraq 4839736
  (HttpSession.setMaxInactiveInterval() doesn't behave as expected),
  which had been originally fixed in revision 1.20
-1. I don't agree with this change: the session is (apparently) supposed 
to be valid while it is being accessed, regardless of MaxInactiveInterval.

  -if (accessCount  0) {
  -return true;
  -}
  -
   if (maxInactiveInterval = 0) { 
   long timeNow = System.currentTimeMillis();
   int timeIdle = (int) ((timeNow - thisAccessedTime) / 1000L);
   if (timeIdle = maxInactiveInterval) {
   expire(true);
   }
  +}
  +
  +if (accessCount  0) {
  +return true;
   }
Rémy

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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-03-10 Thread Remy Maucherat
Remy Maucherat wrote:
[EMAIL PROTECTED] wrote:

luehe   2004/03/10 20:18:31

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Fixed regression re: Bugtraq 4839736
  (HttpSession.setMaxInactiveInterval() doesn't behave as expected),
  which had been originally fixed in revision 1.20


-1. I don't agree with this change: the session is (apparently) supposed 
to be valid while it is being accessed, regardless of MaxInactiveInterval.
See bug 26051.
Your example from revision 1.20 seems invalid.
Rémy

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


cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-03-04 Thread jfarcand
jfarcand2004/03/04 09:51:16

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Avoid serializing Subject/Principal when persisting the session.
  
  Revision  ChangesPath
  1.36  +27 -2 
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.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- StandardSession.java  27 Feb 2004 14:58:46 -  1.35
  +++ StandardSession.java  4 Mar 2004 17:51:16 -   1.36
  @@ -44,6 +44,7 @@
   import javax.servlet.http.HttpSessionListener;
   
   import org.apache.catalina.Context;
  +import org.apache.catalina.Globals;
   import org.apache.catalina.Manager;
   import org.apache.catalina.Session;
   import org.apache.catalina.SessionEvent;
  @@ -159,6 +160,14 @@
   
   
   /**
  + * 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.
  @@ -1384,7 +1393,8 @@
   }
   if (value == null)
   continue;
  -else if (value instanceof Serializable) {
  +else if ( (value instanceof Serializable) 
  + (!exclude(keys[i]) )) {
   saveNames.add(keys[i]);
   saveValues.add(value);
   }
  @@ -1410,6 +1420,21 @@
   }
   }
   
  +}
  +
  +
  +/**
  + * 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]



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-01-23 Thread remm
remm2004/01/23 14:29:32

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  - Bug 26341: When calling the removeAttributes during session expiration,
notified attributes should see the session as invalid.
  
  Revision  ChangesPath
  1.32  +76 -56
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.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- StandardSession.java  22 Jan 2004 18:21:21 -  1.31
  +++ StandardSession.java  23 Jan 2004 22:29:32 -  1.32
  @@ -732,11 +732,6 @@
   if (manager != null)
   manager.remove(this);
   
  -// Unbind any objects associated with this session
  -String keys[] = keys();
  -for (int i = 0; i  keys.length; i++)
  -removeAttribute(keys[i], notify);
  -
   // Notify interested session event listeners
   if (notify) {
   fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null);
  @@ -745,6 +740,11 @@
   // We have completed expire of this session
   expiring = false;
   
  +// Unbind any objects associated with this session
  +String keys[] = keys();
  +for (int i = 0; i  keys.length; i++)
  +removeAttributeInternal(keys[i], notify);
  +
   }
   
   }
  @@ -1182,53 +1182,7 @@
   throw new IllegalStateException
   (sm.getString(standardSession.removeAttribute.ise));
   
  -// Remove this attribute from our collection
  -Object value = attributes.remove(name);
  -
  -// Do we need to do valueUnbound() and attributeRemoved() notification?
  -if (!notify || (value == null)) {
  -return;
  -}
  -
  -// Call the valueUnbound() method if necessary
  -HttpSessionBindingEvent event = null;
  -if (value instanceof HttpSessionBindingListener) {
  -event = new HttpSessionBindingEvent(this, name, value);
  -((HttpSessionBindingListener) value).valueUnbound(event);
  -}
  -
  -// Notify interested application event listeners
  -Context context = (Context) manager.getContainer();
  -Object listeners[] = context.getApplicationEventListeners();
  -if (listeners == null)
  -return;
  -for (int i = 0; i  listeners.length; i++) {
  -if (!(listeners[i] instanceof HttpSessionAttributeListener))
  -continue;
  -HttpSessionAttributeListener listener =
  -(HttpSessionAttributeListener) listeners[i];
  -try {
  -fireContainerEvent(context,
  -   beforeSessionAttributeRemoved,
  -   listener);
  -if (event == null) {
  -event = new HttpSessionBindingEvent(this, name, value);
  -}
  -listener.attributeRemoved(event);
  -fireContainerEvent(context,
  -   afterSessionAttributeRemoved,
  -   listener);
  -} catch (Throwable t) {
  -try {
  -fireContainerEvent(context,
  -   afterSessionAttributeRemoved,
  -   listener);
  -} catch (Exception e) {
  -;
  -}
  -log(sm.getString(standardSession.attributeEvent), t);
  -}
  -}
  +removeAttributeInternal(name, notify);
   
   }
   
  @@ -1589,6 +1543,72 @@
   protected Object getAttributeInternal(String name) {
   
   return (attributes.get(name));
  +
  +}
  +
  +
  +/**
  + * Remove the object bound with the specified name from this session.  If
  + * the session does not have an object bound with this name, this method
  + * does nothing.
  + * p
  + * After this method executes, and if the object implements
  + * codeHttpSessionBindingListener/code, the container calls
  + * codevalueUnbound()/code on the object.
  + *
  + * @param name Name of the object to remove from this session.
  + * @param notify Should we notify interested listeners that this
  + *  attribute is being removed?
  + */
  +protected void removeAttributeInternal(String name, boolean notify) {
  +
  +// Remove this attribute from our collection
  +Object value = attributes.remove(name);
  +
  +// Do 

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-01-22 Thread remm
remm2004/01/22 10:21:21

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  - Improvements to session activity tracking, handling the case where the
session is new, as well as cross context.
  - If this doesn't work, I give up ;)
  
  Revision  ChangesPath
  1.31  +8 -7  
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.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- StandardSession.java  21 Jan 2004 10:46:58 -  1.30
  +++ StandardSession.java  22 Jan 2004 18:21:21 -  1.31
  @@ -316,7 +316,7 @@
   /**
* The access count for thsi session.
*/
  -protected transient int accessCount = 0;
  +protected transient int accessCount = 1;
   
   
   // - Session Properties
  @@ -630,7 +630,6 @@
*/
   public void access() {
   
  -this.isNew = false;
   this.lastAccessedTime = this.thisAccessedTime;
   this.thisAccessedTime = System.currentTimeMillis();
   
  @@ -646,6 +645,7 @@
*/
   public void endAccess() {
   
  +isNew = false;
   accessCount--;
   
   }
  @@ -725,6 +725,7 @@
   }
   }
   }
  +accessCount = 0;
   setValid(false);
   
   // Remove this session from our manager's active sessions
  @@ -839,7 +840,7 @@
   id = null;
   lastAccessedTime = 0L;
   maxInactiveInterval = -1;
  -accessCount = 0;
  +accessCount = 1;
   notes.clear();
   setPrincipal(null);
   isNew = false;
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-01-21 Thread remm
remm2004/01/21 02:46:59

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  - Remove some synchronization.
  - Avoid useless event objects allocation.
  - Minimize the amount of hashmap lookups.
  - Bug 26051: session must not expire even if the request processing time is
bigger than the session timeout. I'll revert this patch if it causes problems; for
example, it could cause sessions to never timeout.
  
  Revision  ChangesPath
  1.30  +83 -79
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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- StandardSession.java  19 Jan 2004 23:39:05 -  1.29
  +++ StandardSession.java  21 Jan 2004 10:46:58 -  1.30
  @@ -146,6 +146,12 @@
   
   
   /**
  + * Type array.
  + */
  +protected static final String EMPTY_ARRAY[] = new String[0];
  +
  +
  +/**
* The dummy attribute value serialized when a NotSerializableException is
* encountered in codewriteObject()/code.
*/
  @@ -241,7 +247,7 @@
   /**
* The Manager with which this Session is associated.
*/
  -protected Manager manager = null;
  +protected transient Manager manager = null;
   
   
   /**
  @@ -307,6 +313,12 @@
   protected long thisAccessedTime = creationTime;
   
   
  +/**
  + * The access count for thsi session.
  + */
  +protected transient int accessCount = 0;
  +
  +
   // - Session Properties
   
   
  @@ -415,7 +427,6 @@
   } catch (Exception e) {
   ;
   }
  -// FIXME - should we do anything besides log these?
   log(sm.getString(standardSession.sessionEvent), t);
   }
   }
  @@ -574,14 +585,18 @@
*/
   public boolean isValid() {
   
  -if (this.expiring){
  +if (this.expiring) {
   return true;
   }
   
   if (!this.isValid ) {
   return false;
   }
  -
  +
  +if (accessCount  0) {
  +return true;
  +}
  +
   if (maxInactiveInterval = 0) { 
   long timeNow = System.currentTimeMillis();
   int timeIdle = (int) ((timeNow - thisAccessedTime) / 1000L);
  @@ -620,6 +635,19 @@
   this.thisAccessedTime = System.currentTimeMillis();
   
evaluateIfValid();
  +
  +accessCount++;
  +
  +}
  +
  +
  +/**
  + * End the access.
  + */
  +public void endAccess() {
  +
  +accessCount--;
  +
   }
   
   
  @@ -628,9 +656,7 @@
*/
   public void addSessionListener(SessionListener listener) {
   
  -synchronized (listeners) {
  -listeners.add(listener);
  -}
  +listeners.add(listener);
   
   }
   
  @@ -695,7 +721,6 @@
   } catch (Exception e) {
   ;
   }
  -// FIXME - should we do anything besides log these?
   log(sm.getString(standardSession.sessionEvent), t);
   }
   }
  @@ -738,8 +763,12 @@
   if (attribute instanceof HttpSessionActivationListener) {
   if (event == null)
   event = new HttpSessionEvent(this);
  -// FIXME: Should we catch throwables?
  -
((HttpSessionActivationListener)attribute).sessionWillPassivate(event);
  +try {
  +((HttpSessionActivationListener)attribute)
  +.sessionWillPassivate(event);
  +} catch (Throwable t) {
  +log(sm.getString(standardSession.attributeEvent), t);
  +}
   }
   }
   
  @@ -760,8 +789,12 @@
   if (attribute instanceof HttpSessionActivationListener) {
   if (event == null)
   event = new HttpSessionEvent(this);
  -// FIXME: Should we catch throwables?
  -
((HttpSessionActivationListener)attribute).sessionDidActivate(event);
  +try {
  +((HttpSessionActivationListener)attribute)
  +.sessionDidActivate(event);
  +} catch (Throwable t) {
  +log(sm.getString(standardSession.attributeEvent), t);
  +}
   }
   }
   
  @@ -776,9 +809,7 @@
*/
   public Object 

RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-01-19 Thread Mark Thomas
 My hair splitting detector is beeping.
 
 This session code will need to be optimized, BTW.

Will do. Tomorrow OK?

 
 Rémy



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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-01-19 Thread remm
remm2004/01/19 15:39:05

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  - Don't call expire after calling isValid.
  - Bug 26261, submitted by Paul Harvey.
  
  Revision  ChangesPath
  1.29  +5 -11 
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.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- StandardSession.java  18 Jan 2004 20:37:52 -  1.28
  +++ StandardSession.java  19 Jan 2004 23:39:05 -  1.29
  @@ -1496,13 +1496,7 @@
   if (!this.isValid || expiring || maxInactiveInterval  0)
   return;
   
  -if (!isValid()) {
  -try {
  -expire();
  -} catch (Throwable t) {
  -log(sm.getString(standardSession.expireException), t);
  -}
  -}
  +isValid();
   
   }
   
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-01-18 Thread markt
markt   2004/01/18 12:37:52

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  - Fix bug 12363. valueBound() must be called before the object is made available
  via getAttribute() .
  Submitted by: Pablo Morales
  
  Revision  ChangesPath
  1.28  +18 -15
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.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- StandardSession.java  31 Dec 2003 21:24:56 -  1.27
  +++ StandardSession.java  18 Jan 2004 20:37:52 -  1.28
  @@ -1283,6 +1283,14 @@
   throw new IllegalArgumentException
   (sm.getString(standardSession.setAttribute.iae));
   
  +// Construct an event with the new value
  +HttpSessionBindingEvent event = new HttpSessionBindingEvent
  +((HttpSession) this, name, value);
  +
  +// Call the valueBound() method if necessary
  +if (value instanceof HttpSessionBindingListener)
  +((HttpSessionBindingListener) value).valueBound(event);
  +
   // Replace or add this attribute
   Object unbound = null;
   synchronized (attributes) {
  @@ -1292,21 +1300,16 @@
   
   // Call the valueUnbound() method if necessary
   if ((unbound != null) 
  -(unbound instanceof HttpSessionBindingListener)) {
  +(unbound instanceof HttpSessionBindingListener)) {
   ((HttpSessionBindingListener) unbound).valueUnbound
  -  (new HttpSessionBindingEvent((HttpSession) this, name));
  +(new HttpSessionBindingEvent((HttpSession) this, name));
   }
   
  -// Call the valueBound() method if necessary
  -HttpSessionBindingEvent event = null;
  +// Replace the current event with one containing 
  +// the old value if necesary
   if (unbound != null)
  -event = new HttpSessionBindingEvent
  -((HttpSession) this, name, unbound);
  -else
  -event = new HttpSessionBindingEvent
  -((HttpSession) this, name, value);
  -if (value instanceof HttpSessionBindingListener)
  -((HttpSessionBindingListener) value).valueBound(event);
  +event = new HttpSessionBindingEvent((HttpSession) this,
  +name, unbound);
   
   // Notify interested application event listeners
   Context context = (Context) manager.getContainer();
  
  
  

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



RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2004-01-18 Thread Mark Thomas
Resending from right account.

 My hair splitting detector is beeping.
 
 This session code will need to be optimized, BTW.

Will do. Tomorrow OK?

 
 Rémy



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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2003-12-31 Thread remm
remm2003/12/31 13:24:56

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  - Bug 25792: Fix session timeout implementation, which could lead to incorrect
invalidation in some cases.
  - Submitted by Jarno Peltoniemi.
  - Ths patch needs to be tested for possible regressions.
  
  Revision  ChangesPath
  1.27  +5 -5  
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.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- StandardSession.java  29 Nov 2003 18:06:35 -  1.26
  +++ StandardSession.java  31 Dec 2003 21:24:56 -  1.27
  @@ -584,7 +584,7 @@
   
   if (maxInactiveInterval = 0) { 
   long timeNow = System.currentTimeMillis();
  -int timeIdle = (int) ((timeNow - lastAccessedTime) / 1000L);
  +int timeIdle = (int) ((timeNow - thisAccessedTime) / 1000L);
   if (timeIdle = maxInactiveInterval) {
   expire(true);
   }
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2003-11-25 Thread remm
remm2003/11/24 23:56:27

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  - It seems that, for consistency, getLastAccessedTime should not throw an
ISE while expiring. This allows addressing bug 9077.
  - Patch submitted by Brian Stansberry.
  
  Revision  ChangesPath
  1.25  +7 -8  
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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- StandardSession.java  3 Oct 2003 01:53:17 -   1.24
  +++ StandardSession.java  25 Nov 2003 07:56:27 -  1.25
  @@ -443,10 +443,9 @@
* a value associated with the session, do not affect the access time.
*/
   public long getLastAccessedTime() {
  -if ( !isValid ) {
  -throw new IllegalStateException(
  -sm.getString(standardSession.getLastAccessedTime));
  -
  +if ( !isValid() ) {
  +throw new IllegalStateException
  +(sm.getString(standardSession.getLastAccessedTime.ise));
   }
   return (this.lastAccessedTime);
   
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2003-10-02 Thread jfarcand
jfarcand2003/10/02 10:10:54

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Fix for bugzilla 23525 HttpSessionListener implementors are called to late according 
to Servlet Specification 2.4 Final Draft 3.
  
  Revision  ChangesPath
  1.23  +11 -7 
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.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- StandardSession.java  2 Sep 2003 21:22:01 -   1.22
  +++ StandardSession.java  2 Oct 2003 17:10:54 -   1.23
  @@ -575,10 +575,14 @@
*/
   public boolean isValid() {
   
  -if (!this.isValid || this.expiring) {
  +if (this.expiring){
  +return true;
  +}
  +
  +if (!this.isValid ) {
   return false;
   }
  - 
  +
   if (maxInactiveInterval = 0) { 
   long timeNow = System.currentTimeMillis();
   int timeIdle = (int) ((timeNow - lastAccessedTime) / 1000L);
  @@ -1154,7 +1158,7 @@
   public void removeAttribute(String name, boolean notify) {
   
   // Validate our current state
  -if (!expiring  !isValid())
  +if (!isValid())
   throw new IllegalStateException
   (sm.getString(standardSession.removeAttribute.ise));
   
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2003-10-02 Thread jfarcand
jfarcand2003/10/02 18:53:17

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  We also need to call the listener when the session is invalidated because we can't 
predict the interval between the time the session is marked invalid and the 
StandardrMmanager expires the session.
  
  Revision  ChangesPath
  1.24  +5 -5  
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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- StandardSession.java  2 Oct 2003 17:10:54 -   1.23
  +++ StandardSession.java  3 Oct 2003 01:53:17 -   1.24
  @@ -587,7 +587,7 @@
   long timeNow = System.currentTimeMillis();
   int timeIdle = (int) ((timeNow - lastAccessedTime) / 1000L);
   if (timeIdle = maxInactiveInterval) {
  -this.isValid = false;
  +expire(true);
   }
   }
   
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2003-08-10 Thread remm
remm2003/08/09 12:04:29

  Modified:catalina/src/share/org/apache/catalina Context.java
   catalina/src/share/org/apache/catalina/core
ApplicationContext.java StandardContext.java
StandardContextValve.java
   catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  - Split the applicationListeners array in two, for performance reasons.
  
  Revision  ChangesPath
  1.9   +29 -8 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Context.java
  
  Index: Context.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Context.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Context.java  22 Jul 2003 21:01:26 -  1.8
  +++ Context.java  9 Aug 2003 19:04:29 -   1.9
  @@ -120,24 +120,45 @@
   
   
   /**
  - * Return the set of initialized application listener objects,
  + * Return the set of initialized application event listener objects,
* in the order they were specified in the web application deployment
* descriptor, for this application.
*
* @exception IllegalStateException if this method is called before
*  this application has started, or after it has been stopped
*/
  -public Object[] getApplicationListeners();
  +public Object[] getApplicationEventListeners();
   
   
   /**
  - * Store the set of initialized application listener objects,
  + * Store the set of initialized application event listener objects,
* in the order they were specified in the web application deployment
* descriptor, for this application.
*
* @param listeners The set of instantiated listener objects.
*/
  -public void setApplicationListeners(Object listeners[]);
  +public void setApplicationEventListeners(Object listeners[]);
  +
  +
  +/**
  + * Return the set of initialized application lifecycle listener objects,
  + * in the order they were specified in the web application deployment
  + * descriptor, for this application.
  + *
  + * @exception IllegalStateException if this method is called before
  + *  this application has started, or after it has been stopped
  + */
  +public Object[] getApplicationLifecycleListeners();
  +
  +
  +/**
  + * Store the set of initialized application lifecycle listener objects,
  + * in the order they were specified in the web application deployment
  + * descriptor, for this application.
  + *
  + * @param listeners The set of instantiated listener objects.
  + */
  +public void setApplicationLifecycleListeners(Object listeners[]);
   
   
   /**
  
  
  
  1.15  +6 -6  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java
  
  Index: ApplicationContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ApplicationContext.java   5 Aug 2003 13:22:03 -   1.14
  +++ ApplicationContext.java   9 Aug 2003 19:04:29 -   1.15
  @@ -751,7 +751,7 @@
   }
   
   // Notify interested application event listeners
  -Object listeners[] = context.getApplicationListeners();
  +Object listeners[] = context.getApplicationEventListeners();
   if ((listeners == null) || (listeners.length == 0))
   return;
   ServletContextAttributeEvent event =
  @@ -814,7 +814,7 @@
   }
   
   // Notify interested application event listeners
  -Object listeners[] = context.getApplicationListeners();
  +Object listeners[] = context.getApplicationEventListeners();
   if ((listeners == null) || (listeners.length == 0))
   return;
   ServletContextAttributeEvent event = null;
  
  
  
  1.80  +74 -21
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java
  
  Index: StandardContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- StandardContext.java  2 Aug 2003 17:42:59 -   1.79
  +++ StandardContext.java  9 Aug 2003 19:04:29 -   1.80
  @@ -77,12 +77,7 @@
   import java.util.Hashtable;
   import java.util.Stack;
   import java.net.URLDecoder;
  -import javax.servlet.FilterConfig;
  -import javax.servlet.ServletContext;
  -import 

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2003-03-12 Thread luehe
luehe   2003/03/12 18:26:32

  Modified:catalina/src/share/org/apache/catalina/core
StandardHostValve.java
   catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Fixed Bugtraq 4661001: setMaxInactiveInterval method does not function as expected.
  
  Revision  ChangesPath
  1.2   +5 -5  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostValve.java
  
  Index: StandardHostValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostValve.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StandardHostValve.java18 Jul 2002 16:48:06 -  1.1
  +++ StandardHostValve.java13 Mar 2003 02:26:32 -  1.2
  @@ -171,7 +171,7 @@
   Manager manager = context.getManager();
   if (manager != null) {
   Session session = manager.findSession(sessionId);
  -if ((session != null)  session.isValid())
  +if (session != null)
   session.access();
   }
   }
  
  
  
  1.15  +27 -4 
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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- StandardSession.java  12 Mar 2003 03:53:15 -  1.14
  +++ StandardSession.java  13 Mar 2003 02:26:32 -  1.15
  @@ -605,6 +605,7 @@
   this.lastAccessedTime = this.thisAccessedTime;
   this.thisAccessedTime = System.currentTimeMillis();
   
  + evaluateIfValid();
   }
   
   
  @@ -1501,6 +1502,28 @@
   if (debug = 2)
   log(  storing attribute ' + saveNames.get(i) +
   ' with value NOT_SERIALIZED);
  +}
  +}
  +
  +}
  +
  +
  +private void evaluateIfValid() {
  +/*
  +  * If this session has expired or is in the process of expiring or
  +  * will never expire, return
  +  */
  +if (!this.isValid || expiring || maxInactiveInterval  0)
  +return;
  +
  +long timeNow = System.currentTimeMillis();
  +int timeIdle =  (int) ((timeNow - lastAccessedTime) / 1000L);
  +
  +if (timeIdle = maxInactiveInterval) {
  +try {
  +expire();
  +} catch (Throwable t) {
  +log(sm.getString(standardSession.expireException), t);
   }
   }
   
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2003-03-11 Thread jfarcand
jfarcand2003/03/11 19:53:15

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Forgot to commit this one. Add a doPrivileged block.
  
  Revision  ChangesPath
  1.14  +18 -6 
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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- StandardSession.java  19 Feb 2003 00:33:27 -  1.13
  +++ StandardSession.java  12 Mar 2003 03:53:15 -  1.14
  @@ -73,7 +73,9 @@
   import java.io.ObjectOutputStream;
   import java.io.Serializable;
   import java.lang.reflect.Method;
  +import java.security.AccessController;
   import java.security.Principal;
  +import java.security.PrivilegedAction;
   import java.util.ArrayList;
   import java.util.Enumeration;
   import java.util.HashMap;
  @@ -551,8 +553,18 @@
*/
   public HttpSession getSession() {
   
  -if (facade == null)
  -facade = new StandardSessionFacade(this);
  +if (facade == null){
  +if (System.getSecurityManager() != null){
  +final StandardSession fsession = this;
  +facade = (StandardSessionFacade)AccessController.doPrivileged(new 
PrivilegedAction(){
  +public Object run(){
  +return new StandardSessionFacade(fsession);
  +}
  +});
  +} else {
  +facade = new StandardSessionFacade(this);
  +}
  +}
   return (facade);
   
   }
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2003-02-18 Thread luehe
luehe   2003/02/18 16:33:28

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Fix for Bugtraq 4688277:
  
  Invoking session.invalidate() after setting max inactive interval to 0
  does not throw IllegalStateException
  
  The reason for this failure has been that setMaxInactiveInterval does not
  expire the session immediately if the 'interval' argument equals 0.
  
  Revision  ChangesPath
  1.13  +7 -4  
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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- StandardSession.java  10 Feb 2003 09:59:01 -  1.12
  +++ StandardSession.java  19 Feb 2003 00:33:27 -  1.13
  @@ -495,6 +495,9 @@
   public void setMaxInactiveInterval(int interval) {
   
   this.maxInactiveInterval = interval;
  +if (isValid  interval == 0) {
  +expire();
  +}
   
   }
   
  
  
  

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




cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2003-02-10 Thread remm
remm2003/02/10 01:59:01

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  - Experiment: add some syncing in Session.expire.
  
  Revision  ChangesPath
  1.12  +58 -49
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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- StandardSession.java  11 Jan 2003 02:50:06 -  1.11
  +++ StandardSession.java  10 Feb 2003 09:59:01 -  1.12
  @@ -624,65 +624,74 @@
*  this session?
*/
   public void expire(boolean notify) {
  +
   // Mark this session as being expired if needed
   if (expiring)
   return;
  -expiring = true;
  +
  +synchronized (this) {
  +
  +if (manager == null)
  +return;
  +
  +expiring = true;
   
  -// Notify interested application event listeners
  -// FIXME - Assumes we call listeners in reverse order
  -Context context = (Context) manager.getContainer();
  -Object listeners[] = context.getApplicationListeners();
  -if (notify  (listeners != null)) {
  -HttpSessionEvent event =
  -  new HttpSessionEvent(getSession());
  -for (int i = 0; i  listeners.length; i++) {
  -int j = (listeners.length - 1) - i;
  -if (!(listeners[j] instanceof HttpSessionListener))
  -continue;
  -HttpSessionListener listener =
  -(HttpSessionListener) listeners[j];
  -try {
  -fireContainerEvent(context,
  -   beforeSessionDestroyed,
  -   listener);
  -listener.sessionDestroyed(event);
  -fireContainerEvent(context,
  -   afterSessionDestroyed,
  -   listener);
  -} catch (Throwable t) {
  +// Notify interested application event listeners
  +// FIXME - Assumes we call listeners in reverse order
  +Context context = (Context) manager.getContainer();
  +Object listeners[] = context.getApplicationListeners();
  +if (notify  (listeners != null)) {
  +HttpSessionEvent event =
  +new HttpSessionEvent(getSession());
  +for (int i = 0; i  listeners.length; i++) {
  +int j = (listeners.length - 1) - i;
  +if (!(listeners[j] instanceof HttpSessionListener))
  +continue;
  +HttpSessionListener listener =
  +(HttpSessionListener) listeners[j];
   try {
   fireContainerEvent(context,
  +   beforeSessionDestroyed,
  +   listener);
  +listener.sessionDestroyed(event);
  +fireContainerEvent(context,
  afterSessionDestroyed,
  listener);
  -} catch (Exception e) {
  -;
  +} catch (Throwable t) {
  +try {
  +fireContainerEvent(context,
  +   afterSessionDestroyed,
  +   listener);
  +} catch (Exception e) {
  +;
  +}
  +// FIXME - should we do anything besides log these?
  +log(sm.getString(standardSession.sessionEvent), t);
   }
  -// FIXME - should we do anything besides log these?
  -log(sm.getString(standardSession.sessionEvent), t);
   }
   }
  -}
  -setValid(false);
  +setValid(false);
  +
  +// Remove this session from our manager's active sessions
  +if (manager != null)
  +manager.remove(this);
  +
  +// Unbind any objects associated with this session
  +String keys[] = keys();
  +for (int i = 0; i  keys.length; i++)
  +removeAttribute(keys[i], notify);
  +
  +// Notify interested session event listeners
  +if (notify) {
  +

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2002-12-31 Thread glenn
glenn   2002/12/31 04:48:24

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Fix typo in LocalStrings property
  
  Revision  ChangesPath
  1.9   +5 -5  
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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StandardSession.java  12 Dec 2002 15:11:53 -  1.8
  +++ StandardSession.java  31 Dec 2002 12:48:24 -  1.9
  @@ -1275,7 +1275,7 @@
   if ((manager != null)  manager.getDistributable() 
 !(value instanceof Serializable))
   throw new IllegalArgumentException
  -(sm.getString(standardSession.setAttribute.iae));
  +(sm.getString(standardSession.setAttribute.ise));
   
   // Replace or add this attribute
   Object unbound = null;
  
  
  

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




cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2002-12-31 Thread glenn
glenn   2002/12/31 04:53:45

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  oops, revert last change
  
  Revision  ChangesPath
  1.10  +5 -5  
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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- StandardSession.java  31 Dec 2002 12:48:24 -  1.9
  +++ StandardSession.java  31 Dec 2002 12:53:45 -  1.10
  @@ -1275,7 +1275,7 @@
   if ((manager != null)  manager.getDistributable() 
 !(value instanceof Serializable))
   throw new IllegalArgumentException
  -(sm.getString(standardSession.setAttribute.ise));
  +(sm.getString(standardSession.setAttribute.iae));
   
   // Replace or add this attribute
   Object unbound = null;
  
  
  

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




cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2002-11-26 Thread jfarcand
jfarcand2002/11/26 11:56:10

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  Change HttpSessionListener.sessionDestroyed() from notifying after the invalidation 
to notifying before the invalidation (Servlet 2.4 spec change).
  
  Revision  ChangesPath
  1.6   +23 -23
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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StandardSession.java  29 Aug 2002 22:23:38 -  1.5
  +++ StandardSession.java  26 Nov 2002 19:56:09 -  1.6
  @@ -611,27 +611,11 @@
*  this session?
*/
   public void expire(boolean notify) {
  -
   // Mark this session as being expired if needed
   if (expiring)
   return;
   expiring = true;
  -setValid(false);
  -
  -// Remove this session from our manager's active sessions
  -if (manager != null)
  -manager.remove(this);
  -
  -// Unbind any objects associated with this session
  -String keys[] = keys();
  -for (int i = 0; i  keys.length; i++)
  -removeAttribute(keys[i], notify);
  -
  -// Notify interested session event listeners
  -if (notify) {
  -fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null);
  -}
  -
  +
   // Notify interested application event listeners
   // FIXME - Assumes we call listeners in reverse order
   Context context = (Context) manager.getContainer();
  @@ -666,6 +650,21 @@
   }
   }
   }
  +setValid(false);
  +
  +// Remove this session from our manager's active sessions
  +if (manager != null)
  +manager.remove(this);
  +
  +// Unbind any objects associated with this session
  +String keys[] = keys();
  +for (int i = 0; i  keys.length; i++)
  +removeAttribute(keys[i], notify);
  +
  +// Notify interested session event listeners
  +if (notify) {
  +fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null);
  +}
   
   // We have completed expire of this session
   expiring = false;
  @@ -1516,7 +1515,6 @@
* @param data Event data
*/
   public void fireSessionEvent(String type, Object data) {
  -
   if (listeners.size()  1)
   return;
   SessionEvent event = new SessionEvent(this, type, data);
  @@ -1524,8 +1522,10 @@
   synchronized (listeners) {
   list = (SessionListener[]) listeners.toArray(list);
   }
  -for (int i = 0; i  list.length; i++)
  +
  +for (int i = 0; i  list.length; i++){
   ((SessionListener) list[i]).sessionEvent(event);
  +}
   
   }
   
  
  
  

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




cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2002-08-29 Thread bobh

bobh2002/08/29 15:23:38

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  - fix for some of bug 12147 Namely, logout() was deferring to the
  SingleSignOn bit to perform the logout - however if SingleSignOn isn't
  being used then the current logout() implementation doesn't do squat.
  Now it correctly invalidates the current session when SingleSignOn
  isn't present.
  
  Revision  ChangesPath
  1.5   +10 -6 
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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StandardSession.java  12 Aug 2002 19:12:44 -  1.4
  +++ StandardSession.java  29 Aug 2002 22:23:38 -  1.5
  @@ -1066,9 +1066,13 @@
   throw new IllegalStateException
   (sm.getString(standardSession.isNew.ise));
   
  -
  -// kills all sessions
  +// NOTE: The SingleSignOn Valve/SessionListener will expire
  +// all sessions, if it is being used.
   fireSessionEvent(Session.SESSION_DESTROYED_EVENT, logout);
  + 
  +// If the SingleSignOn didnt expire it, lets do it now.
  +if (isValid) 
  +expire(false);
   
   }
   
  
  
  

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




cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2002-08-12 Thread patrickl

patrickl2002/08/12 12:12:44

  Modified:catalina/src/share/org/apache/catalina/authenticator
SingleSignOn.java
   catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  This patch causes logout() and invalidate() to do the Servlet spec 2.4 right 
thing.  It is implemented using the Data field of SessionEvent to distinguish between 
logout/invalidate.
  Submitted by: Bob Herrmann ([EMAIL PROTECTED])
  
  Revision  ChangesPath
  1.2   +62 -7 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/SingleSignOn.java
  
  Index: SingleSignOn.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/SingleSignOn.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SingleSignOn.java 18 Jul 2002 16:48:03 -  1.1
  +++ SingleSignOn.java 12 Aug 2002 19:12:44 -  1.2
  @@ -293,6 +293,7 @@
   Session session = event.getSession();
   if (debug = 1)
   log(Process session destroyed on  + session);
  +
   String ssoId = null;
   synchronized (reverse) {
   ssoId = (String) reverse.get(session);
  @@ -300,8 +301,22 @@
   if (ssoId == null)
   return;
   
  -// Deregister this single session id, invalidating associated sessions
  -deregister(ssoId);
  +if ( event.getData() != null 
  +  logout.equals( event.getData().toString() )) {
  +
  +log(X logout event on  + ssoId);
  +
  +// logout of all applications
  +deregister(ssoId);
  +
  +} else {
  +
  +log(X invalidate of just one session  + ssoId +   + session);
  +
  +// invalidate just one session
  +deregister(ssoId, session);
  +
  +}
   
   }
   
  @@ -442,6 +457,35 @@
   
   }
   
  +/**
  + * Deregister the specified session.  If it is the last session,
  + * then also get rid of the single sign on identifier
  + *
  + * @param ssoId Single sign on identifier
  + * @param session Session to be deregistered
  + */
  +private void deregister(String ssoId, Session session) {
  +
  +synchronized (reverse) {
  +reverse.remove(session);
  +}
  +
  +SingleSignOnEntry sso = lookup(ssoId);
  +if ( sso == null )
  +return;
  +
  +sso.removeSession( session );
  +
  +// see if we are the last session, if so blow away ssoId
  +Session sessions[] = sso.findSessions();
  +if ( sessions == null || sessions.length == 0 ) {
  +synchronized (cache) {
  +sso = (SingleSignOnEntry) cache.remove(ssoId);
  +}
  +}
  +
  +}
  +
   
   /**
* Deregister the specified single sign on identifier, and invalidate
  @@ -449,7 +493,7 @@
*
* @param ssoId Single sign on identifier to deregister
*/
  -void deregister(String ssoId) {
  +private void deregister(String ssoId) {
   
   if (debug = 1)
   log(Deregistering sso id ' + ssoId + ');
  @@ -459,6 +503,7 @@
   synchronized (cache) {
   sso = (SingleSignOnEntry) cache.remove(ssoId);
   }
  +
   if (sso == null)
   return;
   
  @@ -601,6 +646,16 @@
   results[sessions.length] = session;
   sessions = results;
   session.addSessionListener(sso);
  +}
  +
  +public synchronized void removeSession(Session session) {
  +Session[] nsessions = new Session[sessions.length - 1];
  +for (int i = 0, j = 0; i  sessions.length; i++) {
  +if (session == sessions[i])
  +continue;
  +nsessions[j++] = sessions[i];
  +}
  +sessions = nsessions;
   }
   
   public synchronized Session[] findSessions() {
  
  
  
  1.4   +8 -5  
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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StandardSession.java  8 Aug 2002 04:03:44 -   1.3
  +++ StandardSession.java  12 Aug 2002 19:12:44 -  1.4
  @@ -1066,7 +1066,10 @@
   throw new IllegalStateException
   (sm.getString(standardSession.isNew.ise));
   
  -invalidate();
  +
  +// kills all sessions
  +fireSessionEvent(Session.SESSION_DESTROYED_EVENT, logout);
  +
   }
   
   
  
  
  

--
To unsubscribe, e-mail:   

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardSession.java

2002-07-23 Thread remm

remm2002/07/23 05:49:55

  Modified:catalina/src/share/org/apache/catalina/session
StandardSession.java
  Log:
  - Set manager to null before recycling.
  - Patch submitted by Arvind Srinivasan arvind.srinivasan at sun.com
  
  Revision  ChangesPath
  1.2   +8 -8  
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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StandardSession.java  18 Jul 2002 16:47:54 -  1.1
  +++ StandardSession.java  23 Jul 2002 12:49:55 -  1.2
  @@ -766,12 +766,12 @@
   setPrincipal(null);
   isNew = false;
   isValid = false;
  +Manager savedManager = manager;
  +manager = null;
   
   // Tell our Manager that this Session has been recycled
  -if ((manager != null)  (manager instanceof ManagerBase))
  -((ManagerBase) manager).recycle(this);
  -
  -manager = null;
  +if ((savedManager != null)  (savedManager instanceof ManagerBase))
  +((ManagerBase) savedManager).recycle(this);
   
   }
   
  
  
  

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