You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vasily Zakharov (JIRA)" <ji...@apache.org> on 2007/05/10 11:50:15 UTC
[jira] Closed: (HARMONY-3786) [drlvm][netbeans]
SecurityManager.getStackClasses() return incorrect
[ https://issues.apache.org/jira/browse/HARMONY-3786?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vasily Zakharov closed HARMONY-3786.
------------------------------------
Resolution: Duplicate
Ok, I agree. Thank you, Mikhail. Closing as a duplicate of HARMONY-2451.
> [drlvm][netbeans] SecurityManager.getStackClasses() return incorrect
> --------------------------------------------------------------------
>
> Key: HARMONY-3786
> URL: https://issues.apache.org/jira/browse/HARMONY-3786
> Project: Harmony
> Issue Type: Bug
> Components: App-Oriented Bug Reports, DRLVM
> Reporter: Vasily Zakharov
> Priority: Minor
>
> I'm not sure whether this issue should have been filed against classlib/luni, classlib/security, DRLVM/kernel_classes or DRLVM itself, but it only occurs on DRLVM. Please suggest the correct component if you know one.
> Consider the following simple test. It installs a security manager that prints the return of SecurityManager.getClassContext() as well as the stack trace at the same point when System.getProperty("test") is called:
> public class Test {
> static boolean success = true;
> public static void main(String args[]) throws Exception {
> System.setSecurityManager(new TestSecurityManager());
> System.getProperty("test");
> System.out.println(success ? "SUCCESS" : "FAIL");
> }
> static class TestSecurityManager extends SecurityManager {
> public void checkPropertyAccess(String name) {
> if (name.equals("test")) {
> Class[] context = getClassContext();
> System.out.println("checkPropertyAccess(" + name + ") class context: ");
> for (int i = 0; i < context.length; i++) {
> Class cls = context[i];
> if (cls == SecurityManager.class) {
> success = false;
> }
> System.out.println("\t" + cls.getName());
> }
> System.out.print("found at stack: ");
> new Throwable().printStackTrace(System.out);
> }
> }
> }
> }
> Output on RI:
> checkPropertyAccess(test) class context:
> Test$TestSecurityManager
> java.lang.System
> Test
> found at stack: java.lang.Throwable
> at Test$TestSecurityManager.checkPropertyAccess(Test.java:24)
> at java.lang.System.getProperty(Unknown Source)
> at Test.main(Test.java:6)
> SUCCESS
> Output on Harmony/IBM VM:
> checkPropertyAccess(test) class context:
> Test$TestSecurityManager
> java.lang.System
> java.lang.System
> Test
> found at stack: java.lang.Throwable
> at Test$TestSecurityManager.checkPropertyAccess(Test.java:24)
> at java.lang.System.getProperty(System.java:675)
> at java.lang.System.getProperty(System.java:660)
> at Test.main(Test.java:6)
> SUCCESS
> Output on Harmony/DRL VM:
> checkPropertyAccess(test) class context:
> java.lang.SecurityManager
> Test$TestSecurityManager
> java.lang.System
> java.lang.System
> Test
> found at stack: java.lang.Throwable
> at Test$TestSecurityManager.checkPropertyAccess(Test.java:24)
> at java.lang.System.getProperty(System.java:158)
> at java.lang.System.getProperty(System.java:149)
> at Test.main(Test.java:6)
> FAIL
> Logically, the list of classes in the class context and in the stack trace should be identical. This is true for RI and Harmony/IBMVM, but on Harmony/DRLVM extra java.lang.SecurityManager appears on the top of class context for some reason. The problem occurs on both Jit and Interpreter.
> The test provided here probably won't make a good regression. Maybe SecurityManager.getClassContext()[i].getName() should be compared to new Throwable().getStackTrace()[i].getClassName() or something like that. I'm not sure which approach is the most correct and effective one in this case.
> This bug was found while trying to run NetBeans on Harmony. It is indicated by the following line in NetBeans log:
> "Warning: use of system property netbeans.home in java.lang.SecurityManager has been obsoleted in favor of InstalledFileLocator"
> that is printed from org.netbeans.TopSecurityManager.checkPropertyAccess() method, line 197.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.