harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r472443 - /incubator/harmony/enhanced/classlib/trunk/modules/suncompat/src/main/java/sun/misc/Unsafe.java
Date Wed, 08 Nov 2006 10:30:23 GMT
Author: tellison
Date: Wed Nov  8 02:30:23 2006
New Revision: 472443

URL: http://svn.apache.org/viewvc?view=rev&rev=472443
Log:
Added Unsafe security check comment.

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=472443&r1=472442&r2=472443
==============================================================================
--- 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
Wed Nov  8 02:30:23 2006
@@ -41,9 +41,14 @@
      * @return An instance of Unsafe.
      */
     public static Unsafe getUnsafe() {
+        /* Check that the caller of this method is in system code (i.e. on the
+         * bootclasspath).  Unsafe methods are not designed to be called directly
+         * by applications.  We assume that system code will not reveal the instance.
+         */
         if (VM.callerClassLoader() != null) {
             throw new SecurityException("Unsafe");
         }
+
         return AccessController.doPrivileged(new PrivilegedAction<Unsafe>() {
             public Unsafe run() {
                 return INSTANCE;



Mime
View raw message