https://issues.apache.org/bugzilla/show_bug.cgi?id=51315

             Bug #: 51315
           Summary: Removing Valve from StandardContext causes
                    IllegalArgumentException
           Product: Tomcat 6
           Version: 6.0.32
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: violet...@apache.org
    Classification: Unclassified


Hello,

I have the following scenario - runtime I want to remove one Valve from a
specified StandardContext.

I'm using the following method:

org.apache.catalina.core.StandardContext.removeValve(Valve valve)

which invokes

org.apache.catalina.core.StandardPipeline.removeValve(Valve valve)


The problem is that the following exception is thrown:

Caused by: java.lang.IllegalArgumentException: Configuration error:  Must be
attached to a Context
       at
org.apache.catalina.authenticator.AuthenticatorBase.setContainer(AuthenticatorBase.java:277)
       at
org.apache.catalina.core.StandardPipeline.removeValve(StandardPipeline.java:537)

It appears that setContainer is invoked with "null" which leads to this
IlleagalArgumentException.

I want to propose the following change:

Index: AuthenticatorBase.java
===================================================================
--- AuthenticatorBase.java    (revision 1100912)
+++ AuthenticatorBase.java    (working copy)
@@ -273,7 +273,7 @@
      */
     public void setContainer(Container container) {

-        if (!(container instanceof Context))
+        if (container != null && !(container instanceof Context))
             throw new IllegalArgumentException
                 (sm.getString("authenticator.notContext"));

Please tell me if there is more appropriate way to remove a Valve if the one
above that I'm describing is not the correct one.

Thanks in advance.
Regards
Violeta Georgieva

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to