[jboss-jira] [JBoss JIRA] Created: (JBAS-8237) Fix JavaClassIsolationUnitTestCase

Brian Stansberry (JIRA) jira-events at lists.jboss.org
Thu Jul 22 11:52:40 EDT 2010


Fix JavaClassIsolationUnitTestCase
----------------------------------

                 Key: JBAS-8237
                 URL: https://jira.jboss.org/browse/JBAS-8237
             Project: JBoss Application Server
          Issue Type: Sub-task
      Security Level: Public (Everyone can see)
          Components: ClassLoading, Test Suite
            Reporter: Brian Stansberry
            Priority: Blocker
             Fix For: 6.0.0.Final


Per Ales:

This one
* http://hudson.qa.jboss.com/hudson/view/JBoss%20AS/job/JBoss-AS-6.0.x-testSuite-sun16/lastCompletedBuild/testReport/org.jboss.test.isolation.test/JavaClassIsolationUnitTestCase/testJavaClassIsNotLoadedFromIsolatedClassLoader/
looks somehow expected, but the behavior changed a bit.

We explicitly build "illegal" resources

      <!-- build test-java-class-isolation.sar -->
      <mkdir dir="${build.resources}/isolation/java/org/jboss/test"/>
      <copy file="${build.classes}/org/jboss/test/isolation/mbean/JavaClassIsolationMBean.class"
            tofile="${build.resources}/isolation/java/org/jboss/test/Test.class"/>

      <mkdir dir="${build.resources}/isolation/java/rmi/registry"/>
      <copy file="${build.classes}/org/jboss/test/isolation/mbean/JavaClassIsolationMBean.class"
            tofile="${build.resources}/isolation/java/rmi/registry/Registry.class"/>

      <jar destfile="${build.lib}/test-java-class-isolation.sar">
         <fileset dir="${build.classes}">
            <include name="org/jboss/test/isolation/mbean/**"/>
         </fileset>
         <fileset dir="${build.resources}/isolation/">
            <include name="META-INF/*.xml"/>
            <include name="java/**"/>
         </fileset>
      </jar>

only to test them here

   public void test() throws Exception
   {
      // Use our scoped classloader
      ClassLoader cl = getClass().getClassLoader();

      // Should be able to find the class as a resource
      URL resource = cl.getResource("java/org/jboss/test/Test.class");
      if (resource == null)
         throw new RuntimeException("Unable to find resource java/org/jboss/test/Test.class");

      // Should not be able to load the resource
      try
      {
         cl.loadClass("java.org.jboss.test.Test");
         throw new RuntimeException("Should not be able to load class");
      }
      catch (ClassNotFoundException expected) // HERE --- we get security exception now instead
      {
         // Should not be able to load it
         log.info("Got expected exception", expected);
      }

      // Should be able to load the resgistry class even though it is in our deployment
      cl.loadClass("java.rmi.registry.Registry");
   }

resulting in

DEPLOYMENTS IN ERROR:
  Deployment "vfs:///qa/services/hudson/hudson_workspace/workspace/JBoss-AS-6.0.x-testSuite-sun16/JBossAS/testsuite/output/lib/test-java-class-isolation.sar" is in error due to the following reason(s): java.lang.SecurityException: Prohibited package name: java.org.jboss.test

The question is what was changed in our CL layer. :-)


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list