bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/26990] SecurityManager.checkExit() problem


From: tromey at gcc dot gnu dot org
Subject: [Bug classpath/26990] SecurityManager.checkExit() problem
Date: 4 Apr 2006 19:26:27 -0000


------- Comment #1 from tromey at gcc dot gnu dot org  2006-04-04 19:26 -------
Extending the test case shows some interesting behavior.
jamvm passes the original test but appears to do so by
uninstalling the security manager.
The JDK bypasses the security manager for an ordinary exit
but otherwise leaves it in place -- the new test throws
an exception during shutdown.

import java.io.*;
public class ExitTest
{
  public static void main (String args[]) throws Exception
  {
    Runnable r = new Runnable() {
        public void run() {
          new File("/tmp/hibob").delete();
        }
      };
    Thread t =  new Thread(r);
    Runtime.getRuntime().addShutdownHook(t);
    System.setSecurityManager(new SecurityManager()
                              {
                                public void checkExit(int status)
                                {
                                  throw new SecurityException("This is a bug");
                                }
                                public void checkDelete(String filename)
                                {
                                  throw new SecurityException("hi bob");
                                }
                              });
  }
}


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-04-04 19:26:27
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26990





reply via email to

[Prev in Thread] Current Thread [Next in Thread]