tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Gagnon <>
Subject Bug + Patch on StandardPipeline.removeValve(Valve valve) for T5.5.16+
Date Mon, 05 Jun 2006 12:40:18 GMT
Hi all,

  I run into this problem with T5 when tring to add/remove/add a valve 
to the standard engine. 
-For what I understand an empty pipeline has:
basic = StandardEngineValve (For example);
first = null;

-If you add a valve you will get
basic = StandardEngineValve
first = myValve (with = StandardEngineValve)

-If you remove the valve you will get
basic =StandardEngineValve
first = StandardEngineValve
Note that StandardEngineValve is in first too here.

-If I try to add a new valve given the actual code in  addValve the 
valve will not be added because (see the **) current = basic and 
current.getNext() = null;

addValve(Valve valve) {

        // Add this Valve to the set associated with this Pipeline
        if (first == null) {
            first = valve;
        } else {
            Valve current = first;
            while (current != null) {
**                if (current.getNext() == basic) {
                current = current.getNext();


For what I understand the right patch will be in the removeValve 
method.  We need to remove the basic valve when that the only one in the 

 public void removeValve(Valve valve) {

        Valve current;
        if(first == valve) {
            first = first.getNext();
            current = null;
        } else {
            current = first;
        while (current != null) {
            if (current.getNext() == valve) {
            current = current.getNext();

         // PATCH: Empty the pipeline if only the basic valve is there
        if (first == basic) first == null;

        if (valve instanceof Contained)
            ((Contained) valve).setContainer(null);

        // Stop this valve if necessary
        if (started) {
            if (valve instanceof Lifecycle) {
                try {
                    ((Lifecycle) valve).stop();
                } catch (LifecycleException e) {
                    log.error("StandardPipeline.removeValve: stop: ", e);
            // Unregister the removed valave

Hope that oki.  I look the 5.5.17 code and the problem is still there.  
Is that the right way to submit a Patch. If I need to open a bug 
directly, let me know

Best Regard

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message