Author: coheigea
Date: Mon Oct 22 09:45:05 2012
New Revision: 1400816
URL: http://svn.apache.org/viewvc?rev=1400816&view=rev
Log:
Changed all setAccessibles to use ReflectionUtil
Modified:
cxf/trunk/api/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java
cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
cxf/trunk/api/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodDispatcher.java
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ServiceDelegateAccessor.java
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java
cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
Modified:
cxf/trunk/api/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java?rev=1400816&r1=1400815&r2=1400816&view=diff
==============================================================================
---
cxf/trunk/api/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java
(original)
+++
cxf/trunk/api/src/main/java/org/apache/cxf/configuration/spring/SpringBeanQNameMap.java
Mon Oct 22 09:45:05 2012
@@ -19,14 +19,13 @@
package org.apache.cxf.configuration.spring;
import java.lang.reflect.Field;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collection;
import javax.xml.namespace.QName;
import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.common.util.ReflectionUtil;
import org.apache.cxf.helpers.CastUtils;
import org.springframework.beans.Mergeable;
import org.springframework.beans.PropertyValue;
@@ -86,12 +85,7 @@ public class SpringBeanQNameMap<V>
Class<?> cls = context.getType(beanNames[i]);
try {
final Field f = cls.getDeclaredField(staticFieldName);
- AccessController.doPrivileged(new
PrivilegedAction<Void>() {
- public Void run() {
- f.setAccessible(true);
- return null;
- }
- });
+ ReflectionUtil.setAccessible(f);
Collection<QName> sids =
CastUtils.cast((Collection<?>)f.get(null));
if (sids != null) {
Modified:
cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java?rev=1400816&r1=1400815&r2=1400816&view=diff
==============================================================================
---
cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
(original)
+++
cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
Mon Oct 22 09:45:05 2012
@@ -38,6 +38,7 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.ReflectionUtil;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.databinding.DataBinding;
import org.apache.cxf.databinding.DataReader;
@@ -189,7 +190,7 @@ public class ClientFaultConverter extend
Field f;
try {
f = Throwable.class.getDeclaredField("detailMessage");
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(f);
f.set(e, fault.getMessage());
} catch (Exception e1) {
//ignore
@@ -317,8 +318,8 @@ public class ClientFaultConverter extend
for (Field f : fields) {
try {
Field beanField =
faultBean.getClass().getDeclaredField(f.getName());
- beanField.setAccessible(true);
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(beanField);
+ ReflectionUtil.setAccessible(f);
f.set(e, beanField.get(faultBean));
} catch (NoSuchFieldException e1) {
//do nothing
Modified:
cxf/trunk/api/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java?rev=1400816&r1=1400815&r2=1400816&view=diff
==============================================================================
---
cxf/trunk/api/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java
(original)
+++
cxf/trunk/api/src/test/java/org/apache/cxf/phase/PhaseInterceptorChainTest.java
Mon Oct 22 09:45:05 2012
@@ -26,6 +26,7 @@ import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
+import org.apache.cxf.common.util.ReflectionUtil;
import org.apache.cxf.common.util.SortedArraySet;
import org.apache.cxf.continuations.SuspendedInvocationException;
import org.apache.cxf.interceptor.Interceptor;
@@ -411,19 +412,19 @@ public class PhaseInterceptorChainTest e
b = new SortedArraySet<String>();
}
Field f = AbstractPhaseInterceptor.class.getDeclaredField("before");
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(f);
f.set(p, b);
f = AbstractPhaseInterceptor.class.getDeclaredField("after");
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(f);
f.set(p, a);
f = AbstractPhaseInterceptor.class.getDeclaredField("phase");
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(f);
f.set(p, phase);
f = AbstractPhaseInterceptor.class.getDeclaredField("id");
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(f);
f.set(p, id);
return p;
Modified:
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java?rev=1400816&r1=1400815&r2=1400816&view=diff
==============================================================================
---
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
(original)
+++
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
Mon Oct 22 09:45:05 2012
@@ -481,7 +481,7 @@ public final class JAXBEncoderDecoder {
}
Type type = f.getGenericType();
if (JAXBContextInitializer.isFieldAccepted(f, accessType))
{
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(f);
if (JAXBSchemaInitializer.isArray(type)) {
Class<?> compType = JAXBSchemaInitializer
.getArrayComponentType(type);
@@ -914,7 +914,7 @@ public final class JAXBEncoderDecoder {
//ignore
}
Field f = ReflectionUtil.getDeclaredField(c.getClass(),
"mNamespaces");
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(f);
String ns[] = (String[])f.get(c);
for (int x = 0; x < ns.length; x += 2) {
if (ns[x] == null) {
@@ -928,7 +928,7 @@ public final class JAXBEncoderDecoder {
//internal JDK/xerces version
try {
Field f = ReflectionUtil.getDeclaredField(c.getClass(),
"fNamespaceContext");
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(f);
Object c2 = f.get(c);
Enumeration<?> enm =
(Enumeration<?>)c2.getClass().getMethod("getAllPrefixes").invoke(c2);
while (enm.hasMoreElements()) {
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=1400816&r1=1400815&r2=1400816&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
Mon Oct 22 09:45:05 2012
@@ -68,6 +68,7 @@ import org.apache.cxf.common.classloader
import org.apache.cxf.common.i18n.BundleUtils;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.PrimitiveUtils;
+import org.apache.cxf.common.util.ReflectionUtil;
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.jaxrs.ext.MessageContext;
import org.apache.cxf.jaxrs.ext.ProtocolHeaders;
@@ -160,19 +161,13 @@ public final class InjectionUtils {
public static void injectFieldValue(final Field f,
final Object o,
final Object v) {
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- f.setAccessible(true);
- try {
- f.set(o, v);
- } catch (IllegalAccessException ex) {
- reportServerError("FIELD_ACCESS_FAILURE",
- f.getType().getName());
- }
- return null;
- }
- });
-
+ ReflectionUtil.setAccessible(f);
+ try {
+ f.set(o, v);
+ } catch (IllegalAccessException ex) {
+ reportServerError("FIELD_ACCESS_FAILURE",
+ f.getType().getName());
+ }
}
public static Object extractFieldValue(final Field f,
Modified:
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodDispatcher.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodDispatcher.java?rev=1400816&r1=1400815&r2=1400816&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodDispatcher.java
(original)
+++
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodDispatcher.java
Mon Oct 22 09:45:05 2012
@@ -30,6 +30,7 @@ import javax.xml.ws.Response;
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.ReflectionUtil;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.jaxws.support.JaxWsImplementorInfo;
import org.apache.cxf.service.factory.ServiceConstructionException;
@@ -109,7 +110,7 @@ public class JAXWSMethodDispatcher exten
method = m2;
}
try {
- method.setAccessible(true);
+ ReflectionUtil.setAccessible(method);
} catch (Throwable t) {
//ignore
}
Modified:
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java?rev=1400816&r1=1400815&r2=1400816&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
(original)
+++
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
Mon Oct 22 09:45:05 2012
@@ -388,7 +388,7 @@ public class ProviderImpl extends javax.
}
}
- private JAXBContext getJAXBContext() {
+ private static JAXBContext getJAXBContext() {
if (jaxbContext == null) {
try {
jaxbContext =
JAXBContext.newInstance(W3CEndpointReference.class);
Modified:
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ServiceDelegateAccessor.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ServiceDelegateAccessor.java?rev=1400816&r1=1400815&r2=1400816&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ServiceDelegateAccessor.java
(original)
+++
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ServiceDelegateAccessor.java
Mon Oct 22 09:45:05 2012
@@ -27,11 +27,12 @@ import javax.xml.ws.Service;
import javax.xml.ws.WebServiceException;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.ReflectionUtil;
import org.apache.cxf.jaxws.ServiceImpl;
/**
* A utility that allows access to the 'private' implementation specific
delegate
- * of a Service. Usefull when extensions to the JAXWS Service supported methods
+ * of a Service. Useful when extensions to the JAXWS Service supported methods
* are required.
*/
public final class ServiceDelegateAccessor {
@@ -57,12 +58,12 @@ public final class ServiceDelegateAccess
ServiceImpl delegate = null;
try {
Field delegateField =
Service.class.getDeclaredField(DELEGATE_FIELD_NAME);
- delegateField.setAccessible(true);
+ ReflectionUtil.setAccessible(delegateField);
delegate = (ServiceImpl)delegateField.get(service);
} catch (Exception e) {
try {
Field delegateField =
Service.class.getDeclaredField(DELEGATE_FIELD_NAME2);
- delegateField.setAccessible(true);
+ ReflectionUtil.setAccessible(delegateField);
delegate = (ServiceImpl)delegateField.get(service);
} catch (Exception e2) {
WebServiceException wse = new WebServiceException("Failed to
access Field named "
Modified:
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java?rev=1400816&r1=1400815&r2=1400816&view=diff
==============================================================================
---
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java
(original)
+++
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java
Mon Oct 22 09:45:05 2012
@@ -24,9 +24,8 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
+import org.apache.cxf.common.util.ReflectionUtil;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.PhaseInterceptorChain;
@@ -44,12 +43,7 @@ public class CXFAuthenticator extends Au
try {
for (final Field f : Authenticator.class.getDeclaredFields()) {
if (f.getType().equals(Authenticator.class)) {
- AccessController.doPrivileged(new PrivilegedAction<Void>()
{
- public Void run() {
- f.setAccessible(true);
- return null;
- }
- });
+ ReflectionUtil.setAccessible(f);
wrapped = (Authenticator)f.get(null);
}
@@ -76,22 +70,12 @@ public class CXFAuthenticator extends Au
try {
for (final Field f : Authenticator.class.getDeclaredFields()) {
if (!Modifier.isStatic(f.getModifiers())) {
- AccessController.doPrivileged(new
PrivilegedAction<Void>() {
- public Void run() {
- f.setAccessible(true);
- return null;
- }
- });
+ ReflectionUtil.setAccessible(f);
f.set(wrapped, f.get(this));
}
}
final Method m =
Authenticator.class.getDeclaredMethod("getPasswordAuthentication");
- AccessController.doPrivileged(new PrivilegedAction<Void>() {
- public Void run() {
- m.setAccessible(true);
- return null;
- }
- });
+ ReflectionUtil.setAccessible(m);
auth = (PasswordAuthentication)m.invoke(wrapped);
} catch (Throwable t) {
//ignore
Modified:
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java?rev=1400816&r1=1400815&r2=1400816&view=diff
==============================================================================
---
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java
(original)
+++
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java
Mon Oct 22 09:45:05 2012
@@ -39,6 +39,7 @@ import javax.net.ssl.X509KeyManager;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.ReflectionInvokationHandler;
+import org.apache.cxf.common.util.ReflectionUtil;
import org.apache.cxf.configuration.jsse.SSLUtils;
import org.apache.cxf.configuration.jsse.TLSClientParameters;
@@ -222,7 +223,7 @@ public class HttpsURLConnectionFactory {
//a JSSE SSLSocketFactory so we'll try and use that
Constructor<?> c = getSSLSocketFactory.getReturnType()
.getDeclaredConstructor(SSLSocketFactory.class);
- c.setAccessible(true);
+ ReflectionUtil.setAccessible(c);
setSSLSocketFactory.invoke(connection,
c.newInstance(socketFactory));
}
} catch (Exception ex) {
Modified:
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=1400816&r1=1400815&r2=1400816&view=diff
==============================================================================
---
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
(original)
+++
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
Mon Oct 22 09:45:05 2012
@@ -56,6 +56,7 @@ import org.apache.cxf.binding.soap.Soap1
import org.apache.cxf.binding.soap.SoapFault;
import org.apache.cxf.common.WSDLConstants;
import org.apache.cxf.common.util.ASMHelper;
+import org.apache.cxf.common.util.ReflectionUtil;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
import org.apache.cxf.helpers.IOUtils;
@@ -410,7 +411,7 @@ public class ClientServerMiscTest extend
private void setASM(boolean b) throws Exception {
Field f = ASMHelper.class.getDeclaredField("badASM");
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(f);
f.set(null, !b);
}
Modified:
cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java?rev=1400816&r1=1400815&r2=1400816&view=diff
==============================================================================
---
cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java
(original)
+++
cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/AbstractClientServerTestBase.java
Mon Oct 22 09:45:05 2012
@@ -25,14 +25,13 @@ import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.MalformedURLException;
import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.xml.ws.BindingProvider;
+import org.apache.cxf.common.util.ReflectionUtil;
import org.apache.cxf.endpoint.Client;
import org.junit.AfterClass;
@@ -150,12 +149,7 @@ public abstract class AbstractClientServ
if (c == null) {
try {
final Method m = o.getClass().getDeclaredMethod("getClient");
- AccessController.doPrivileged(new PrivilegedAction<Void>() {
- public Void run() {
- m.setAccessible(true);
- return null;
- }
- });
+ ReflectionUtil.setAccessible(m);
c = (Client)m.invoke(o);
} catch (Throwable t) {
Modified:
cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java?rev=1400816&r1=1400815&r2=1400816&view=diff
==============================================================================
---
cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
(original)
+++
cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
Mon Oct 22 09:45:05 2012
@@ -32,6 +32,7 @@ import org.apache.activemq.broker.Broker
import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
+import org.apache.cxf.common.util.ReflectionUtil;
import org.apache.cxf.wsdl.WSDLManager;
public class EmbeddedJMSBrokerLauncher extends AbstractBusTestServerBase {
@@ -110,14 +111,14 @@ public class EmbeddedJMSBrokerLauncher e
} else {
try {
Field f =
e.getClass().getDeclaredField("jmsNamingProperty");
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(f);
List<?> props = (List<?>)f.get(e);
for (Object prop : props) {
f =
prop.getClass().getDeclaredField("name");
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(f);
if
("java.naming.provider.url".equals(f.get(prop))) {
f =
prop.getClass().getDeclaredField("value");
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(f);
f.set(prop, url);
}
}
Modified:
cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=1400816&r1=1400815&r2=1400816&view=diff
==============================================================================
---
cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
(original)
+++
cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
Mon Oct 22 09:45:05 2012
@@ -97,6 +97,7 @@ import org.apache.cxf.catalog.OASISCatal
import org.apache.cxf.common.WSDLConstants;
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.ReflectionUtil;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.common.util.URIParserUtil;
import org.apache.cxf.common.xmlschema.SchemaCollection;
@@ -470,7 +471,7 @@ public class JAXBDataBinding implements
Options opts) {
try {
Field f = schemaCompiler.getClass().getDeclaredField("forest");
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(f);
XMLSchemaInternalizationLogic logic = new
XMLSchemaInternalizationLogic() {
public XMLFilterImpl createExternalReferenceFinder(DOMForest
parent) {
return new ReferenceFinder(parent, catalog);
@@ -1011,7 +1012,7 @@ public class JAXBDataBinding implements
//no accessors :-(
try {
Field f =
jdc.getClass().getDeclaredField("enumConstantsByName");
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(f);
Map<?, ?> map = (Map<?, ?>)f.get(jdc);
Set<String> values = CastUtils.cast(map.keySet());
String first = defaultValues.chooseEnumValue(path,
values);
@@ -1037,7 +1038,7 @@ public class JAXBDataBinding implements
JType tp2 = tp.erasure();
try {
Field f = tp2.getClass().getDeclaredField("_class");
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(f);
Class<?> cls = (Class<?>)f.get(tp2);
if (List.class.isAssignableFrom(cls)) {
found = true;
@@ -1047,7 +1048,7 @@ public class JAXBDataBinding implements
writer.write("();");
f = tp.getClass().getDeclaredField("args");
- f.setAccessible(true);
+ ReflectionUtil.setAccessible(f);
List<JClass> lcl = CastUtils.cast((List<?>)f.get(tp));
JClass cl = lcl.get(0);