Details

      Description

      Per Ales:

      This one

      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.

        Attachments

          Activity

            People

            Assignee:
            ajustin@redhat.com Ales Justin
            Reporter:
            bstansbe@redhat.com Brian Stansberry
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: