scheu 02/04/22 13:54:19
Modified: java/src/org/apache/axis/utils BeanUtils.java
Log:
Added patch from Greg Truty to allow BeanDeserializer to run
with Java 2 Security.
Revision Changes Path
1.3 +23 -2 xml-axis/java/src/org/apache/axis/utils/BeanUtils.java
Index: BeanUtils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/BeanUtils.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BeanUtils.java 20 Apr 2002 00:22:25 -0000 1.2
+++ BeanUtils.java 22 Apr 2002 20:54:19 -0000 1.3
@@ -58,6 +58,9 @@
import org.apache.axis.description.TypeDesc;
import org.apache.axis.description.FieldDesc;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
import java.beans.PropertyDescriptor;
import java.beans.Introspector;
import java.util.Vector;
@@ -67,7 +70,7 @@
public class BeanUtils {
- public static final Object[] noArgs = new Object[] {}; // For convenience
+ public static final Object[] noArgs = new Object[] {};
/**
* Create a BeanPropertyDescriptor array for the indicated class.
@@ -75,7 +78,25 @@
public static BeanPropertyDescriptor[] getPd(Class javaType) {
BeanPropertyDescriptor[] pd;
try {
- PropertyDescriptor[] rawPd =
Introspector.getBeanInfo(javaType).getPropertyDescriptors();
+ final Class secJavaType = javaType;
+
+ // Need doPrivileged access to do introspection.
+ PropertyDescriptor[] rawPd =
+ (PropertyDescriptor[])
+ AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Object run() {
+ PropertyDescriptor[] result = null;
+ try {
+ // privileged code goes here
+ result = Introspector.
+ getBeanInfo(secJavaType).
+ getPropertyDescriptors();
+ } catch (java.beans.IntrospectionException Iie) {
+ }
+ return result;
+ }
+ });
pd = processPropertyDescriptors(rawPd,javaType);
} catch (Exception e) {
// this should never happen