Hi Andy
Thanks, FYI, just in case,
there could be some helper methods available in
https://github.com/apache/cxf/blob/master/core/src/main/java/org/apache/cxf/common/util/ReflectionUtil.java
Cheers. Sergey
On 26/10/17 16:55, amccri...@apache.org wrote:
This is an automated email from the ASF dual-hosted git repository.
amccright pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/master by this push:
new 294e7aa Add doPrivs
294e7aa is described below
commit 294e7aa05790c6a5925accac99841b0a0ceee1ea
Author: Andy McCright <j.andrew.mccri...@gmail.com>
AuthorDate: Wed Oct 25 15:54:15 2017 -0500
Add doPrivs
---
.../apache/cxf/jaxrs/model/BeanResourceInfo.java | 34 ++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/BeanResourceInfo.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/BeanResourceInfo.java
index 2f48fec..6134e9d 100644
---
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/BeanResourceInfo.java
+++
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/BeanResourceInfo.java
@@ -17,11 +17,32 @@
* under the License.
*/
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.apache.cxf.jaxrs.model;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -59,7 +80,7 @@ public abstract class BeanResourceInfo extends
AbstractResourceInfo {
if (Object.class == cls || cls == null) {
return;
}
- for (Field f : cls.getDeclaredFields()) {
+ for (Field f : getDeclaredFields(cls)) {
for (Annotation a : f.getAnnotations()) {
if
(AnnotationUtils.isParamAnnotationClass(a.annotationType())) {
if (paramFields == null) {
@@ -110,4 +131,13 @@ public abstract class BeanResourceInfo extends
AbstractResourceInfo {
return paramFields == null ? Collections.<Field>emptyList()
:
Collections.unmodifiableList(paramFields);
}
-}
+
+ private static Field[] getDeclaredFields(final Class<?> cls) {
+ return AccessController.doPrivileged(new PrivilegedAction<Field[]>() {
+
+ @Override
+ public Field[] run() {
+ return cls.getDeclaredFields();
+ } });
+ }
+}
\ No newline at end of file