ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166y/ConcurrentLinkedDeque.java
(Generate patch)

Comparing jsr166/src/jsr166y/ConcurrentLinkedDeque.java (file contents):
Revision 1.4 by jsr166, Sun Oct 21 06:40:20 2012 UTC vs.
Revision 1.5 by jsr166, Wed Jan 9 02:51:37 2013 UTC

# Line 1446 | Line 1446 | public class ConcurrentLinkedDeque<E>
1446      static sun.misc.Unsafe getUnsafe() {
1447          try {
1448              return sun.misc.Unsafe.getUnsafe();
1449 <        } catch (SecurityException se) {
1450 <            try {
1451 <                return java.security.AccessController.doPrivileged
1452 <                    (new java.security
1453 <                     .PrivilegedExceptionAction<sun.misc.Unsafe>() {
1454 <                        public sun.misc.Unsafe run() throws Exception {
1455 <                            java.lang.reflect.Field f = sun.misc
1456 <                                .Unsafe.class.getDeclaredField("theUnsafe");
1457 <                            f.setAccessible(true);
1458 <                            return (sun.misc.Unsafe) f.get(null);
1459 <                        }});
1460 <            } catch (java.security.PrivilegedActionException e) {
1461 <                throw new RuntimeException("Could not initialize intrinsics",
1462 <                                           e.getCause());
1463 <            }
1449 >        } catch (SecurityException tryReflectionInstead) {}
1450 >        try {
1451 >            return java.security.AccessController.doPrivileged
1452 >            (new java.security.PrivilegedExceptionAction<sun.misc.Unsafe>() {
1453 >                public sun.misc.Unsafe run() throws Exception {
1454 >                    Class<sun.misc.Unsafe> k = sun.misc.Unsafe.class;
1455 >                    for (java.lang.reflect.Field f : k.getDeclaredFields()) {
1456 >                        f.setAccessible(true);
1457 >                        Object x = f.get(null);
1458 >                        if (k.isInstance(x))
1459 >                            return k.cast(x);
1460 >                    }
1461 >                    throw new NoSuchFieldError("the Unsafe");
1462 >                }});
1463 >        } catch (java.security.PrivilegedActionException e) {
1464 >            throw new RuntimeException("Could not initialize intrinsics",
1465 >                                       e.getCause());
1466          }
1467      }
1466
1468   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines