You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Kevin Zhou (JIRA)" <ji...@apache.org> on 2009/01/12 08:36:59 UTC

[jira] Closed: (HARMONY-6042) [classlib][luni] Classes can not be loaded correctly in sealed-packages

     [ https://issues.apache.org/jira/browse/HARMONY-6042?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Zhou closed HARMONY-6042.
-------------------------------


Thanks, Sean!

> [classlib][luni] Classes can not be loaded correctly in sealed-packages
> -----------------------------------------------------------------------
>
>                 Key: HARMONY-6042
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6042
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Kevin Zhou
>            Assignee: Sean Qiu
>             Fix For: 5.0M9
>
>         Attachments: HARMONY-6042.diff, hyts_d.jar, hyts_d1.jar, hyts_d2.jar
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Given a  test case [1], conduct it on HARMONY and RI.
> RI works well while HARMONY can not.
> In addition, to run this test, you need to deploy three new jars to [support]/src/test/java/tests/resources/Package.
> (1) hyts_d.jar: unsealed/no-manifest
> (2) hyts_d1.jar: unsealed/manifest
> (3) hyts_d2.jar: sealed/mainfest 
> [1] Test Case
> public void test_SealedPackage_forName() throws Exception {
>         Support_Resources.copyFile(resources, "Package", "hyts_c.jar");
>         Support_Resources.copyFile(resources, "Package", "hyts_d.jar");
>         Support_Resources.copyFile(resources, "Package", "hyts_d1.jar");
>         Support_Resources.copyFile(resources, "Package", "hyts_d2.jar");
>         URL resourceURL1 = new URL("file:/" + resPath + "/Package/hyts_c.jar");
>         URL resourceURL2 = new URL("file:/" + resPath + "/Package/hyts_d.jar");
>         URL resourceURL3 = new URL("file:/" + resPath + "/Package/hyts_d1.jar");
>         URL resourceURL4 = new URL("file:/" + resPath + "/Package/hyts_d2.jar");
>         URL resourceURL5 = new URL("file:/" + resPath + "/");
>         URLClassLoader uclClassLoader;
>         // load from the sealed jar, then an unsealed jar with no manifest
>         uclClassLoader = new java.net.URLClassLoader(new URL[] { resourceURL1,
>                 resourceURL2 }, null);
>         Class.forName("p.C", true, uclClassLoader);
>         try {
>             Class.forName("p.D", true, uclClassLoader);
>             fail("should throw SecurityException");
>         } catch (SecurityException e) {
>             // Expected
>         }
>         // setup for next test
>         Support_Resources.copyFile(resources, "p", "");
>         InputStream in = uclClassLoader.getResourceAsStream("p/D.class");
>         Support_Resources.copyLocalFileto(new File(resources.toString(),
>                 "p/D.class"), in);
>         // load from a sealed jar, then the directory
>         uclClassLoader = new java.net.URLClassLoader(new URL[] { resourceURL1,
>                 resourceURL5 }, null);
>         Class.forName("p.C", true, uclClassLoader);
>         try {
>             Class.forName("p.D", true, uclClassLoader);
>             fail("should throw SecurityException");
>         } catch (SecurityException e) {
>             // Expected
>         }
>         // load from a directory, then the sealed jar
>         uclClassLoader = new java.net.URLClassLoader(new URL[] { resourceURL1,
>                 resourceURL5 }, null);
>         Class.forName("p.D", true, uclClassLoader);
>         try {
>             Class.forName("p.C", true, uclClassLoader);
>             fail("should throw SecurityException");
>         } catch (SecurityException e) {
>             // Expected
>         }
>         // load from an unsealed jar with no manifest, then the sealed jar
>         uclClassLoader = new java.net.URLClassLoader(new URL[] { resourceURL1,
>                 resourceURL2 }, null);
>         Class.forName("p.D", true, uclClassLoader);
>         try {
>             Class.forName("p.C", true, uclClassLoader);
>             fail("should throw SecurityException");
>         } catch (SecurityException e) {
>             // Expected
>         }
>         // load from an unsealed jar with a manifest, then the sealed jar
>         uclClassLoader = new java.net.URLClassLoader(new URL[] { resourceURL1,
>                 resourceURL3 }, null);
>         Class.forName("p.C", true, uclClassLoader);
>         try {
>             Class.forName("p.D", true, uclClassLoader);
>             fail("should throw SecurityException");
>         } catch (SecurityException e) {
>             // Expected
>         }
>         // load from an sealed jar, then the unsealed jar with a manifest
>         uclClassLoader = new java.net.URLClassLoader(new URL[] { resourceURL1,
>                 resourceURL3 }, null);
>         Class.forName("p.D", true, uclClassLoader);
>         try {
>             Class.forName("p.C", true, uclClassLoader);
>             fail("should throw SecurityException");
>         } catch (SecurityException e) {
>             // Expected
>         }
>         // load from the sealed jar, then another sealed jar
>         uclClassLoader = new java.net.URLClassLoader(new URL[] { resourceURL1,
>                 resourceURL4 }, null);
>         Class.forName("p.C", true, uclClassLoader);
>         try {
>             Class.forName("p.D", true, uclClassLoader);
>             fail("should throw SecurityException");
>         } catch (SecurityException e) {
>             // Expected
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.