tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/logging JasperLogger.java
Date Fri, 15 Dec 2000 00:16:26 GMT
craigmcc    00/12/14 16:16:24

  Modified:    jasper/src/share/org/apache/jasper/logging JasperLogger.java
  Log:
  Encapsulate creation of a background logging thread inside a
  doPrivileged() block to avoid problems when running under a security
  manager.
  
  Submitted by:	Vivek Nagar <vivek.nagar@eng.sun.com>
  
  Revision  Changes    Path
  1.3       +19 -3     jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/logging/JasperLogger.java
  
  Index: JasperLogger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/logging/JasperLogger.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JasperLogger.java	2000/09/26 21:39:53	1.2
  +++ JasperLogger.java	2000/12/15 00:16:24	1.3
  @@ -59,7 +59,8 @@
   import java.io.Writer;
   import java.io.StringWriter;
   import java.io.PrintWriter;
  -
  +import java.security.AccessController;
  +import java.security.PrivilegedAction;
   import java.util.Date;
   import javax.servlet.ServletException;
   import javax.servlet.ServletContext;
  @@ -162,8 +163,23 @@
       private void init() {
   	if (logDaemon == null || logQueue == null) {
   	    logQueue = new Queue();
  -	    logDaemon = new LogDaemon(logQueue, servletContext);
  -	    logDaemon.start();
  +            class createDaemon implements PrivilegedAction {
  +                private Queue logQueue;
  +                private ServletContext servletContext;
  +                public createDaemon(Queue logQueue,
  +                                    ServletContext servletContext) {
  +                    this.logQueue = logQueue;
  +                    this.servletContext = servletContext;
  +                }
  +                public Object run() {
  +                    LogDaemon logDaemon =
  +                        new LogDaemon(logQueue, servletContext);
  +                    logDaemon.start();
  +                    return (logDaemon);
  +                }
  +            }
  +            createDaemon cd = new createDaemon(logQueue, servletContext);
  +            logDaemon = (LogDaemon) AccessController.doPrivileged(cd);
   	}
       }
       
  
  
  

Mime
View raw message