costin      2003/02/28 15:39:21

  Modified:    modeler/src/java/org/apache/commons/modeler
                        BaseModelMBean.java
  Log:
  Fix weird bug ( that caused backward compat problems ).
  
  Now commons-modeler works fine as a replacement in tomcat4.1.21 ( for example
  if you use some components in config that don't have a description in the
  static descriptor )
  
  Revision  Changes    Path
  1.15      +10 -7     
jakarta-commons/modeler/src/java/org/apache/commons/modeler/BaseModelMBean.java
  
  Index: BaseModelMBean.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/BaseModelMBean.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- BaseModelMBean.java       3 Feb 2003 22:13:16 -0000       1.14
  +++ BaseModelMBean.java       28 Feb 2003 23:39:20 -0000      1.15
  @@ -280,7 +280,10 @@
   
           Object result = null;
           try {
  -            if( m.getDeclaringClass() == this.getClass() ) {
  +            Class declaring=m.getDeclaringClass();
  +            // workaround for catalina weird mbeans - the declaring class is 
BaseModelMBean.
  +            // but this is the catalina class.
  +            if( declaring.isAssignableFrom(this.getClass()) ) {
                   result = m.invoke(this, NO_ARGS_PARAM );
               } else {
                   result = m.invoke(resource, NO_ARGS_PARAM );
  @@ -432,7 +435,7 @@
           // Invoke the selected method on the appropriate object
           Object result = null;
           try {
  -            if( method.getDeclaringClass() == this.getClass() ) {
  +            if( method.getDeclaringClass().isAssignableFrom( this.getClass()) ) {
                   result = method.invoke(this, params );
               } else {
                   result = method.invoke(resource, params);
  @@ -591,7 +594,7 @@
   
           Object result = null;
           try {
  -            if( m.getDeclaringClass() == this.getClass() ) {
  +            if( m.getDeclaringClass().isAssignableFrom( this.getClass()) ) {
                   result = m.invoke(this, new Object[] { value });
               } else {
                   result = m.invoke(resource, new Object[] { value });
  
  
  

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

Reply via email to