protected void addListener(AbstractApplicationContext wac) { try { //spring 2 vs spring 3 return type is different Method m = wac.getClass().getMethod("getApplicationListeners"); Collection<Object> c = CastUtils.cast((Collection<?>)ReflectionUtil .setAccessible(m).invoke(wac)); c.add(this); } catch (Throwable t) { //ignore. } }
try { Field delegateField = Service.class.getDeclaredField(DELEGATE_FIELD_NAME); ReflectionUtil.setAccessible(delegateField); delegate = (ServiceImpl)delegateField.get(service); } catch (Exception e) { try { Field delegateField = Service.class.getDeclaredField(DELEGATE_FIELD_NAME2); ReflectionUtil.setAccessible(delegateField); delegate = (ServiceImpl)delegateField.get(service); } catch (Exception e2) {
private OutputStream connectAndGetOutputStream(Boolean b) throws IOException { OutputStream cout = null; if (b != null && b) { String method = connection.getRequestMethod(); connection.connect(); try { java.lang.reflect.Field f = ReflectionUtil.getDeclaredField(HttpURLConnection.class, "method"); ReflectionUtil.setAccessible(f).set(connection, "POST"); cout = connection.getOutputStream(); ReflectionUtil.setAccessible(f).set(connection, method); } catch (Throwable t) { logStackTrace(t); } } else { cout = connection.getOutputStream(); } return cout; } protected void setupWrappedStream() throws IOException {
ReflectionUtil.setAccessible(method); } catch (Throwable t) {
public JAXWSProviderMethodDispatcher(JaxWsImplementorInfo implInfo) { try { invoke = ReflectionUtil.getMethod(implInfo.getImplementorClass(), "invoke", new Class[] {implInfo.getProviderParameterType()}); ReflectionUtil.setAccessible(invoke); } catch (Exception e1) { //fall back to the raw Provider provided invoke method try { invoke = Provider.class.getMethod("invoke", new Class[] {Object.class}); } catch (Exception e) { throw new ServiceConstructionException(e); } } }
for (final Field f : ReflectionUtil.getDeclaredFields(Authenticator.class)) { if (f.getType().equals(Authenticator.class)) { ReflectionUtil.setAccessible(f); try { wrapped = (Authenticator)f.get(null); ReflectionUtil.setAccessible(m).invoke(loader, ReferencingAuthenticator.class.getName(), b, 0, b.length); cls = loader.loadClass(ReferencingAuthenticator.class.getName()); ReflectionUtil.setAccessible(f).set(loader, null); } catch (Throwable t) {
java.lang.reflect.Field f2 = ReflectionUtil.getDeclaredField(connection.getClass(), "delegate"); Object c = ReflectionUtil.setAccessible(f2).get(connection); if (c instanceof HttpURLConnection) { ReflectionUtil.setAccessible(f).set(c, httpRequestMethod); HttpsURLConnection c2 = (HttpsURLConnection)ReflectionUtil.setAccessible(f2) .get(c); ReflectionUtil.setAccessible(f).set(c2, httpRequestMethod); } catch (Throwable t) { ReflectionUtil.setAccessible(f).set(connection, httpRequestMethod); message.put(HTTPURL_CONNECTION_METHOD_REFLECTION, true); } catch (Throwable t) {
ReflectionUtil.setAccessible(c); setSSLSocketFactory.invoke(connection, c.newInstance(socketFactory));
private void setEncoding(String s) { if (s != null) { try { //requires XJC 2.2.5 or newer Field f = CodeWriter.class.getDeclaredField("encoding"); ReflectionUtil.setAccessible(f).set(this, s); } catch (Throwable t) { //ignore - should be caught in JAXBDataBinding.checkEncoding already } } }
public int getOpcode(int ireturn) { try { return (Integer)ReflectionUtil.setAccessible(m2).invoke(tp, ireturn); } catch (Exception e) { throw new RuntimeException(e); } } };
public int getOpcode(int ireturn) { try { return (Integer)ReflectionUtil.setAccessible(m2).invoke(tp, ireturn); } catch (Exception e) { throw new RuntimeException(e); } } };
private void setEncoding(String s) { if (s != null) { try { //requires XJC 2.2.5 or newer Field f = CodeWriter.class.getDeclaredField("encoding"); ReflectionUtil.setAccessible(f).set(this, s); } catch (Throwable t) { //ignore - should be caught in JAXBDataBinding.checkEncoding already } } }
public int getOpcode(int ireturn) { try { return (Integer)ReflectionUtil.setAccessible(m2).invoke(tp, ireturn); } catch (Exception e) { throw new RuntimeException(e); } } };
public int getOpcode(int ireturn) { try { return (Integer)ReflectionUtil.setAccessible(m2).invoke(tp, ireturn); } catch (Exception e) { throw new RuntimeException(e); } } };
private void setServiceFactory(Object factoryBean, Object serviceFactoryBean2) { for (Method m : factoryBean.getClass().getMethods()) { if ("setServiceFactory".equals(m.getName()) && m.getParameterTypes()[0].isInstance(serviceFactoryBean2)) { try { ReflectionUtil.setAccessible(m).invoke(factoryBean, serviceFactoryBean2); } catch (Exception e) { throw new RuntimeException(e); } } } }
protected void addListener(AbstractApplicationContext wac) { try { //spring 2 vs spring 3 return type is different Method m = wac.getClass().getMethod("getApplicationListeners"); Collection<Object> c = CastUtils.cast((Collection<?>)ReflectionUtil .setAccessible(m).invoke(wac)); c.add(this); } catch (Throwable t) { //ignore. } }
private Request getCurrentRequest() { AbstractConnection con = getCurrentConnection(); try { return (Request)ReflectionUtil .setAccessible(con.getClass().getMethod("getRequest")).invoke(con); } catch (Exception e) { //ignore } return null; } }
protected void addListener(AbstractApplicationContext wac) { try { //spring 2 vs spring 3 return type is different Method m = wac.getClass().getMethod("getApplicationListeners"); Collection<Object> c = CastUtils.cast((Collection<?>)ReflectionUtil .setAccessible(m).invoke(wac)); c.add(this); } catch (Throwable t) { //ignore. } }
private void setASM(boolean b) throws Exception { Field f = ASMHelper.class.getDeclaredField("badASM"); ReflectionUtil.setAccessible(f); f.set(null, !b); }
public JAXWSProviderMethodDispatcher(JaxWsImplementorInfo implInfo) { try { invoke = ReflectionUtil.getMethod(implInfo.getImplementorClass(), "invoke", new Class[] {implInfo.getProviderParameterType()}); ReflectionUtil.setAccessible(invoke); } catch (Exception e1) { //fall back to the raw Provider provided invoke method try { invoke = Provider.class.getMethod("invoke", new Class[] {Object.class}); } catch (Exception e) { throw new ServiceConstructionException(e); } } }