Title: [2025] trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/Sun14ReflectionProvider.java: Use Unsafe directly, we import it already!
Revision
2025
Author
joehni
Date
2013-02-27 19:14:38 -0600 (Wed, 27 Feb 2013)

Log Message

Use Unsafe directly, we import it already!

Modified Paths


Diff

Modified: trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/Sun14ReflectionProvider.java (2024 => 2025)


--- trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/Sun14ReflectionProvider.java	2013-02-28 00:32:57 UTC (rev 2024)
+++ trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/Sun14ReflectionProvider.java	2013-02-28 01:14:38 UTC (rev 2025)
@@ -35,12 +35,9 @@
         Unsafe u = null;
         Exception ex = null;
         try {
-            Class unsafeClass = Class.forName("sun.misc.Unsafe");
-            Field unsafeField = unsafeClass.getDeclaredField("theUnsafe");
+            Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe");
             unsafeField.setAccessible(true);
             u = (Unsafe) unsafeField.get(null);
-        } catch (ClassNotFoundException e) {
-            ex = e;
         } catch (SecurityException e) {
             ex = e;
         } catch (NoSuchFieldException e) {

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to