User: starksm 
  Date: 02/02/19 11:45:03

  Modified:    src/main/org/jboss/test/jbossmx/implementation/server/support
                        ContextCL.java
  Removed:     src/main/org/jboss/test/jbossmx/implementation/server/support
                        TestClassLoader.java TestClassLoaderMBean.java
  Log:
  Update the testcase to property demonstrate the class loading problem
  seen with Bug#519699.
  
  Revision  Changes    Path
  1.2       +26 -10    
jbosstest/src/main/org/jboss/test/jbossmx/implementation/server/support/ContextCL.java
  
  Index: ContextCL.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/jbossmx/implementation/server/support/ContextCL.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ContextCL.java    18 Feb 2002 23:54:33 -0000      1.1
  +++ ContextCL.java    19 Feb 2002 19:45:03 -0000      1.2
  @@ -1,36 +1,52 @@
   package org.jboss.test.jbossmx.implementation.server.support;
   
   import java.io.IOException;
  +import java.io.*;
   import java.rmi.MarshalledObject;
   
   import org.apache.log4j.Category;
   
  -/** The ContextCL standard MBean interface
  +/** The ContextCL standard MBean implementation.
    *
    * @author  [EMAIL PROTECTED]
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class ContextCL implements ContextCLMBean
   {
      private static Category log = Category.getInstance(ContextCL.class);
  -   private MarshalledObject data;
  +   private TestData data0;
   
  +   /** The TestData.class ClassLoader will be the ClassLoader of the ContextCL
  +    *mbean because we have a static reference to the TestData class. This
  +    *causes the VM to call the ClassLoader.loadClassInternal method.
  +    */
      public ContextCL() throws IOException
      {
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
  -      log.info("ctor ClassLoader: "+cl);
  -      TestData test = new TestData();
  -      data = new MarshalledObject(test);
  +      log.info("ContextCL ClassLoader: "+getClass().getClassLoader());
  +      log.info("ctor Context ClassLoader: "+cl);
  +      data0 = new TestData();
  +      log.info("TestData.class ProtectionDomain: 
"+TestData.class.getProtectionDomain());
      }
   
  -   /** An operation that retrieves a TestData object from a MarshalledObject
  -    *created during the ContextCL MBean ctor
  +   /** An operation that load the TestData class using the current thread
  +    *context class loader (TCL) and the Class.forName(String, boolean, ClassLoader)
  +    *operation to validate that the class loader used to load TestData in
  +    *the ctor is compatible with the operation TCL.
       */
      public void useTestData() throws Exception
      {
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         log.info("useTestData ClassLoader: "+cl);
  -      Object test = data.get();
  -      TestData testData = (TestData) test;
  +      Class c0 = data0.getClass();
  +      log.info("TestData #0 ProtectionDomain: "+c0.getProtectionDomain());
  +      Class c1 = 
Class.forName("org.jboss.test.jbossmx.implementation.server.support.TestData",
  +         false, cl);
  +      log.info("TestData #1 ProtectionDomain: "+c1.getProtectionDomain());
  +      if( c1.isInstance(data0) == false )
  +      {
  +         log.error("Assertion failed: data0 is NOT compatible with c1");
  +         throw new IllegalStateException("data0 is NOT compatible with c1");
  +      }
      }
   }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to