harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r472240 - /incubator/harmony/enhanced/classlib/trunk/modules/suncompat/src/main/java/sun/misc/Unsafe.java
Date Tue, 07 Nov 2006 20:42:47 GMT
Author: tellison
Date: Tue Nov  7 12:42:47 2006
New Revision: 472240

URL: http://svn.apache.org/viewvc?view=rev&rev=472240
Log:
Add security check for accessing Unsafe, and initialize threads inst var.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/suncompat/src/main/java/sun/misc/Unsafe.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/suncompat/src/main/java/sun/misc/Unsafe.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/suncompat/src/main/java/sun/misc/Unsafe.java?view=diff&rev=472240&r1=472239&r2=472240
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/suncompat/src/main/java/sun/misc/Unsafe.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/suncompat/src/main/java/sun/misc/Unsafe.java
Tue Nov  7 12:42:47 2006
@@ -23,6 +23,7 @@
 
 import org.apache.harmony.kernel.vm.Objects;
 import org.apache.harmony.kernel.vm.Threads;
+import org.apache.harmony.kernel.vm.VM;
 
 /**
  * <p>The Unsafe service.</p>
@@ -40,6 +41,9 @@
      * @return An instance of Unsafe.
      */
     public static Unsafe getUnsafe() {
+        if (VM.callerClassLoader() != null) {
+            throw new SecurityException("Unsafe");
+        }
         return AccessController.doPrivileged(new PrivilegedAction<Unsafe>() {
             public Unsafe run() {
                 return INSTANCE;
@@ -53,6 +57,7 @@
     private Unsafe() {
         super();
         this.objects = Objects.getInstance();
+        this.threads = Threads.getInstance();
     }
 
     /**



Mime
View raw message