remm        2003/07/23 06:31:59

  Modified:    catalina/src/share/org/apache/catalina/core
                        StandardPipeline.java
  Log:
  - Valves should only be registered and unregistered when:
    - addValve or removeValve is called and the associated pipeline is started
    - on start and stop of the pipeline
  - This fixes bug 21822.
  
  Revision  Changes    Path
  1.13      +21 -17    
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardPipeline.java
  
  Index: StandardPipeline.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardPipeline.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- StandardPipeline.java     26 May 2003 22:03:59 -0000      1.12
  +++ StandardPipeline.java     23 Jul 2003 13:31:59 -0000      1.13
  @@ -481,15 +481,17 @@
               ((Contained) valve).setContainer(this.container);
   
           // Start the new component if necessary
  -        if (started && (valve instanceof Lifecycle)) {
  -            try {
  -                ((Lifecycle) valve).start();
  -            } catch (LifecycleException e) {
  -                log.error("StandardPipeline.addValve: start: ", e);
  +        if (started) {
  +            if (valve instanceof Lifecycle) {
  +                try {
  +                    ((Lifecycle) valve).start();
  +                } catch (LifecycleException e) {
  +                    log.error("StandardPipeline.addValve: start: ", e);
  +                }
               }
  +            // Register the newly added valve
  +            registerValve(valve);
           }
  -        // Register the newly added valve
  -        registerValve(valve);
   
           // Add this Valve to the set associated with this Pipeline
           synchronized (valves) {
  @@ -606,15 +608,17 @@
           }
   
           // Stop this valve if necessary
  -        if (started && (valve instanceof Lifecycle)) {
  -            try {
  -                ((Lifecycle) valve).stop();
  -            } catch (LifecycleException e) {
  -                log.error("StandardPipeline.removeValve: stop: ", e);
  +        if (started) {
  +            if (valve instanceof Lifecycle) {
  +                try {
  +                    ((Lifecycle) valve).stop();
  +                } catch (LifecycleException e) {
  +                    log.error("StandardPipeline.removeValve: stop: ", e);
  +                }
               }
  +            // Unregister the removed valave
  +            unregisterValve(valve);
           }
  -        // Unregister the removed valave
  -        unregisterValve(valve);
   
       }
   
  
  
  

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

Reply via email to