[seam-commits] Seam SVN: r9300 - trunk/src/main/org/jboss/seam/util.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Oct 14 08:41:21 EDT 2008


Author: shane.bryzak at jboss.com
Date: 2008-10-14 08:41:21 -0400 (Tue, 14 Oct 2008)
New Revision: 9300

Modified:
   trunk/src/main/org/jboss/seam/util/Reflections.java
Log:
JBSEAM-3556

Modified: trunk/src/main/org/jboss/seam/util/Reflections.java
===================================================================
--- trunk/src/main/org/jboss/seam/util/Reflections.java	2008-10-14 12:40:56 UTC (rev 9299)
+++ trunk/src/main/org/jboss/seam/util/Reflections.java	2008-10-14 12:41:21 UTC (rev 9300)
@@ -46,8 +46,10 @@
    
    public static Object get(Field field, Object target) throws Exception
    {
+      boolean accessible = field.isAccessible();
       try
       {
+         field.setAccessible(true);
          return field.get(target);
       }
       catch (IllegalArgumentException iae)
@@ -56,6 +58,10 @@
             " on: " + target.getClass().getName();
          throw new IllegalArgumentException(message, iae);
       }
+      finally
+      {
+         field.setAccessible(accessible);
+      }
    }
    
    public static void set(Field field, Object target, Object value) throws Exception
@@ -83,8 +89,10 @@
    
    public static Object getAndWrap(Field field, Object target)
    {
+      boolean accessible = field.isAccessible();
       try
       {
+         field.setAccessible(true);
          return get(field, target);
       }
       catch (Exception e)
@@ -98,6 +106,10 @@
             throw new IllegalArgumentException("exception setting: " + field.getName(), e);
          }
       }
+      finally
+      {
+         field.setAccessible(accessible);
+      }
    }
    
    public static void setAndWrap(Field field, Object target, Object value)




More information about the seam-commits mailing list