tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gl...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/log SystemLogHandler.java
Date Wed, 26 Jun 2002 12:36:00 GMT
glenn       2002/06/26 05:36:00

  Modified:    util/java/org/apache/tomcat/util/log SystemLogHandler.java
  Log:
  Bug fix, can't peek if a stack is empty
  
  Revision  Changes    Path
  1.2       +7 -10     jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/log/SystemLogHandler.java
  
  Index: SystemLogHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/log/SystemLogHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SystemLogHandler.java	23 May 2002 17:21:09 -0000	1.1
  +++ SystemLogHandler.java	26 Jun 2002 12:36:00 -0000	1.2
  @@ -124,18 +124,15 @@
       public static void startCapture() {
           CaptureLog log = null;
           if (!reuse.isEmpty()) {
  -            try {
  -                log = (CaptureLog)reuse.pop();
  -            } catch(Exception e) {
  -            }
  -        }
  -        if (log == null) {
  +            log = (CaptureLog)reuse.pop();
  +        } else {
               log = new CaptureLog();
           }
  -        Stack stack = (Stack)logs.get(Thread.currentThread());
  +        Thread thread = Thread.currentThread();
  +        Stack stack = (Stack)logs.get(thread);
           if (stack == null) {
               stack = new Stack();
  -            logs.put(Thread.currentThread(), stack);
  +            logs.put(thread, stack);
           }
           stack.push(log);
       }
  @@ -146,7 +143,7 @@
        */
       public static String stopCapture() {
           Stack stack = (Stack)logs.get(Thread.currentThread());
  -        if (stack == null) {
  +        if (stack == null || stack.isEmpty()) {
               return null;
           }
           CaptureLog log = (CaptureLog)stack.pop();
  @@ -168,7 +165,7 @@
        */
       protected PrintStream findStream() {
           Stack stack = (Stack)logs.get(Thread.currentThread());
  -        if (stack != null) {
  +        if (stack != null && !stack.isEmpty()) {
               CaptureLog log = (CaptureLog)stack.peek();
               if (log != null) {
                   PrintStream ps = log.getStream();
  
  
  

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


Mime
View raw message