tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 51315] New: Removing Valve from StandardContext causes IllegalArgumentException
Date Fri, 03 Jun 2011 09:02:08 GMT
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: violetagg@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message