Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 40596 invoked from network); 8 May 2007 04:50:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 May 2007 04:50:36 -0000 Received: (qmail 4491 invoked by uid 500); 8 May 2007 04:50:43 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 4467 invoked by uid 500); 8 May 2007 04:50:42 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 4458 invoked by uid 99); 8 May 2007 04:50:42 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 May 2007 21:50:42 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 May 2007 21:50:35 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 94FBD714044 for ; Mon, 7 May 2007 21:50:15 -0700 (PDT) Message-ID: <27249997.1178599815607.JavaMail.jira@brutus> Date: Mon, 7 May 2007 21:50:15 -0700 (PDT) From: "Mikhail Markov (JIRA)" To: commits@harmony.apache.org Subject: [jira] Commented: (HARMONY-3786) [drlvm][netbeans] SecurityManager.getStackClasses() return incorrect In-Reply-To: <3288668.1177815435429.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-3786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494186 ] Mikhail Markov commented on HARMONY-3786: ----------------------------------------- Vasily, perhaps you meant package protected method Class.getStackClasses() in this issue description? I've checked - this issue duplicates HARMONY-2451 as protected method SecurityManager.getClassContext() calls package protected one Class.getStackClasses(). So, the patch for 2451 also fixes this problem as well and this issue could be closed as duplicate. > [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.