cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1489370 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
Date Tue, 04 Jun 2013 10:18:08 GMT
Author: sergeyb
Date: Tue Jun  4 10:18:08 2013
New Revision: 1489370

URL: http://svn.apache.org/r1489370
Log:
Getting all of the code needed to set a field value run as privileged

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=1489370&r1=1489369&r2=1489370&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
Tue Jun  4 10:18:08 2013
@@ -74,7 +74,6 @@ import org.apache.cxf.common.i18n.Bundle
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.ClassHelper;
 import org.apache.cxf.common.util.PrimitiveUtils;
-import org.apache.cxf.common.util.ReflectionUtil;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.jaxrs.ext.MessageContext;
@@ -169,21 +168,26 @@ public final class InjectionUtils {
     public static void injectFieldValue(final Field f, 
                                         final Object o, 
                                         final Object v) {
-        ReflectionUtil.setAccessible(f);
-        try {
-            f.set(o, v);
-        } catch (IllegalAccessException ex) {
-            reportServerError("FIELD_ACCESS_FAILURE", 
-                              f.getType().getName());
-        }
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
+            public Object run() {
+                try {
+                    f.setAccessible(true);
+                    f.set(o, v);
+                } catch (IllegalAccessException ex) {
+                    reportServerError("FIELD_ACCESS_FAILURE", 
+                                      f.getType().getName());
+                }
+                return null;
+            }
+        });
     }
 
     public static Object extractFieldValue(final Field f, 
                                         final Object o) {
         return AccessController.doPrivileged(new PrivilegedAction<Object>() {
             public Object run() {
-                f.setAccessible(true);
                 try {
+                    f.setAccessible(true);
                     return f.get(o);
                 } catch (IllegalAccessException ex) {
                     reportServerError("FIELD_ACCESS_FAILURE", 



Mime
View raw message