You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/05/02 19:49:42 UTC
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util SessionUtil.java
costin 01/05/02 10:49:42
Modified: src/share/org/apache/tomcat/util Tag: tomcat_32
SessionUtil.java
Log:
Fixing SessionUtil for JDK1.1 compatibility, using the jdk compat package.
The fix is backported from 3.3 ( the difference is that 3.3 avoids static
methods - the fix has been adapted for 3.2 and SessionIdGenerator )
Revision Changes Path
No revision
No revision
1.5.2.4 +27 -15 jakarta-tomcat/src/share/org/apache/tomcat/util/Attic/SessionUtil.java
Index: SessionUtil.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/Attic/SessionUtil.java,v
retrieving revision 1.5.2.3
retrieving revision 1.5.2.4
diff -u -r1.5.2.3 -r1.5.2.4
--- SessionUtil.java 2000/12/28 22:15:29 1.5.2.3
+++ SessionUtil.java 2001/05/02 17:49:37 1.5.2.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/Attic/SessionUtil.java,v 1.5.2.3 2000/12/28 22:15:29 glenn Exp $
- * $Revision: 1.5.2.3 $
- * $Date: 2000/12/28 22:15:29 $
+ * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/Attic/SessionUtil.java,v 1.5.2.4 2001/05/02 17:49:37 costin Exp $
+ * $Revision: 1.5.2.4 $
+ * $Date: 2001/05/02 17:49:37 $
*
* ====================================================================
*
@@ -67,6 +67,7 @@
import javax.servlet.http.Cookie;
import org.apache.tomcat.core.*;
+import org.apache.tomcat.util.compat.*;
import java.security.*;
@@ -76,7 +77,7 @@
*
* @author Craig R. McClanahan
* @author Shai Fultheim [shai@brm.com]
- * @version $Revision: 1.5.2.3 $ $Date: 2000/12/28 22:15:29 $
+ * @version $Revision: 1.5.2.4 $ $Date: 2001/05/02 17:49:37 $
*/
public final class SessionUtil {
@@ -174,6 +175,8 @@
}
+ static Jdk11Compat jdk11Compat=Jdk11Compat.getJdkCompat();
+
/**
* Generate and return a new session identifier.
*/
@@ -185,21 +188,30 @@
* JSP or servlet may not have sufficient Permissions.
*/
if( System.getSecurityManager() != null ) {
- class doInit implements PrivilegedAction {
- private String jsIdent;
- public doInit(String ident) {
- jsIdent = ident;
- }
- public Object run() {
- return SessionIdGenerator.generateId(jsIdent);
- }
- }
- doInit di = new doInit(jsIdent);
- return (String)AccessController.doPrivileged(di);
+ PriviledgedIdGenerator di=new PriviledgedIdGenerator(jsIdent);
+ try {
+ return (String)jdk11Compat.doPrivileged(di);
+ } catch( Exception ex) {
+ ex.printStackTrace();
+ return null;
+ }
} else {
return SessionIdGenerator.generateId(jsIdent);
}
}
+
+ static class PriviledgedIdGenerator extends Action {
+ // SessionIdGenerator sg;
+ String jsIdent;
+ public PriviledgedIdGenerator(String jsIdent ) {
+ //this.sg=sg;
+ this.jsIdent=jsIdent;
+ }
+ public Object run() {
+ // return sg.getIdentifier(jsIdent);
+ return SessionIdGenerator.generateId(jsIdent);
+ }
+ }
/**
* Return the session id from the specified array of cookies,