harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Markov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-2955) [classlib][luni]File.deleteOnExit should implement with doPrivileged
Date Wed, 10 Jan 2007 06:56:27 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-2955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12463480
] 

Mikhail Markov commented on HARMONY-2955:
-----------------------------------------

Tony, are you sure  your test passes on RI?

I've tried the following testcase (below) and got:
on RI:
Exception in thread "main" java.lang.NoClassDefFoundError
        at java.lang.System.setSecurityManager0(System.java:275)
        at java.lang.System.setSecurityManager(System.java:244)
        at Test.main(Test.java:13)

on Harmony with DRLVM:
No exceptions

on Harmony with IBM VME:
Exception in thread "main" java.security.AccessControlException: Access denied (java.security.SecurityPermission
getProperty.package.access)
        at java.security.AccessController.checkPermission(AccessController.java:94)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:746)
        at MySecurityManager.checkPermission(Test.java:24)
        at java.lang.SecurityManager.checkSecurityAccess(SecurityManager.java:422)
        at java.security.Security.getProperty(Security.java:360)
        at org.apache.harmony.luni.util.PriviAction.run(PriviAction.java:131)
        at java.security.AccessController.doPrivileged(AccessController.java:179)
        at java.lang.SecurityManager.checkPackageProperty(SecurityManager.java:333)
        at java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:34)
        at com.ibm.oti.vm.URLSystemClassLoader.loadClass(URLSystemClassLoader.java:54)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:620)
        at com.ibm.oti.vm.URLSystemClassLoader.loadClass(URLSystemClassLoader.java:60)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:594)
        at MySecurityManager.checkPermission(Test.java:21)
        at java.lang.SecurityManager.checkSecurityAccess(SecurityManager.java:422)
        at java.security.Security.getProperty(Security.java:360)
        at org.apache.harmony.luni.util.PriviAction.run(PriviAction.java:131)
        at java.security.AccessController.doPrivileged(AccessController.java:179)
        at java.lang.SecurityManager.checkPackageProperty(SecurityManager.java:333)
        at java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:34)
        at com.ibm.oti.vm.URLSystemClassLoader.loadClass(URLSystemClassLoader.java:54)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:594)
        at MySecurityManager.checkPermission(Test.java:21)
        at java.lang.System.setSecurityManager(System.java:838)
        at Test.main(Test.java:13)

------------ Test.java ----------------
import java.io.*;
import java.security.Permission;

public class Test {
    public static void main(String[] args) throws Exception {
        File dir = File.createTempFile("hytemp", "");
        dir.deleteOnExit();
        SecurityManager backup = System.getSecurityManager();

        try {
            System.setSecurityManager(new MySecurityManager());
        } finally {
            System.setSecurityManager(backup);
        }
        System.out.println("No exceptions");
    }
}

class MySecurityManager extends SecurityManager {
    public void checkPermission(Permission perm) {
        if ("setSecurityManager".equals(perm.getName())) {
            return;
        }
        super.checkPermission(perm);
    }
}
------------------------------------

> [classlib][luni]File.deleteOnExit should implement with doPrivileged
> --------------------------------------------------------------------
>
>                 Key: HARMONY-2955
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2955
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Tony Wu
>
> As title, following testcase passes on RI whereas throws "AccessControlException:Access
denied" on Harmony
>     public void test() throws IOException {
>         File dir = File.createTempFile("hytemp", "");
>         dir.deleteOnExit();
>         SecurityManager backup = System.getSecurityManager();
>         try {
>             System.setSecurityManager(new MySecurityManager());
>         } finally {
>             System.setSecurityManager(backup);
>         }
>     }
>     class MySecurityManager extends SecurityManager {
>         public void checkPermission(Permission perm) {
>             if ("setSecurityManager".equals(perm.getName())) {
>                 return;
>             }
>             super.checkPermission(perm);
>         }
>     }

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

        

Mime
View raw message