【问题经验】掉进spingaop的陷阱-aop导致controller私有requestmapping方法NPE异常

问题描述

环境:spring mvc  4.3.17

现象:org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException

描述:很早以前的老代码,以前同事没注意,某个Controller里面的RequestMapping方法用了private修饰(因为Spring是反射调用所以也能接受到请求)。最近,另一位同事针对这个Controller加了一段aop。测试环境自测就发现报NPE异常了。

代码现场:我模拟问题代码写了一段,首先是controller类文件,helloPri是private修饰的私有方法

@RestController
@RequestMapping("/focuse")
public class DemoController {

    @Resource
    private  DemoPrinter demoPrinter;

    @RequestMapping("hello")
    public String hello(@RequestParam("text") String text) {
        return demoPrinter.print(text);
    }

    @RequestMapping("hello_pri")
    private String helloPri(@RequestParam("text") String text) {
        return demoPrinter.print(text);
    }
}

其次是aop的配置,就是BeanNameAutoProxyCreator,(只是模拟问题代码现场,配置尽量简单了)


        
            
                demoController
            
        
    

请求/focuse/hello_pri抛异常,请求/focuse/hello正常

【问题经验】掉进spingaop的陷阱-aop导致controller私有requestmapping方法NPE异常_第1张图片

原因分析

    这个问题不容易看出来(火眼金睛能注意到前面的private),我们是debug断点发现,当前对象并不是DemoContrller而是CGLIB生成的类,觉得有点奇怪。再对比一下没问题的请求,它的对象就是DemoController。

有问题的请求:

没问题的请求:【问题经验】掉进spingaop的陷阱-aop导致controller私有requestmapping方法NPE异常_第2张图片

为什么会出现如此情况? 那得看看spring容器在初始化bean的过程中何时初始化aop,生成动态代理类;又是何时自动设置依赖属性的。

Spring容器设置Bean的依赖属性、aop初始化都是通过BeanPostProcessor机制实现的。@Resource是通过CommonAnnotationBeanPostProcessor实现的,@Autowired、@Value是通过AutowiredAnnotationBeanPostProcessor实现的,BeanNameAutoProxyCreator本身就是BeanPostProcessor,这三个都是特殊的BeanPostProcessor(InstantiationAwareBeanPostProcessor)。

public interface InstantiationAwareBeanPostProcessor extends BeanPostProcessor {

	......

	PropertyValues postProcessPropertyValues(
			PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeansException;

    ......
}

如上,InstantiationAwareBeanPostProcessor比常规的BeanPostProcess多几个方法(这里只列了跟这个问题相关的一个),CommonAnnotationBeanPostProcessor和AutowiredAnnotationBeanPostProcessor就是在postProcessPropertyValues的实现方法中对bean的属性进行设置。

而BeanNameAutoProxyCreator是在postProcessAfterInitialization的实现方法中对bean进行动态代理。AbstractAutoProxyCreator是BeanNameAutoProxyCreator的父类,wrapIfNecessary方法就实现了对bean的动态代理。

public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
		implements SmartInstantiationAwareBeanPostProcessor, BeanFactoryAware {
    ......

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
		if (bean != null) {
			Object cacheKey = getCacheKey(bean.getClass(), beanName);
			if (!this.earlyProxyReferences.contains(cacheKey)) {
				return wrapIfNecessary(bean, beanName, cacheKey);
			}
		}
		return bean;
	}
    
    ......
}

postProcessPropertyValues的执行时机要早于postProcessAfterInitialization,postProcessPropertyValues是在populateBean方法中执行,postProcessAfterInitialization在initializeBean中被调用到。

public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFactory
		implements AutowireCapableBeanFactory {

protected Object doCreateBean(final String beanName, final RootBeanDefinition mbd, final Object[] args)
			throws BeanCreationException {

		... ...

		// Initialize the bean instance.
		Object exposedObject = bean;
		try {
			populateBean(beanName, mbd, instanceWrapper);
			if (exposedObject != null) {
				exposedObject = initializeBean(beanName, exposedObject, mbd);
			}
		}
		catch (Throwable ex) {
			... ...
		}
       
        ... ...
    }
}

    就是说Spring容器在创建bean的过程先设置bean的依赖属性,然后对bean执行动态代理生成代理类对象并将代理类对象放到容器中。在本例中,我们来串一串DemoController这个对象bean的生成过程。

  1. 首先创建一个DemoContrller对象demoController(默认构造方法),此时DemoController的属性demoPrinter为空;
  2. 对demoController执行populateBean方法,在populateBean方法中执行postProcessPropertyValues,设置demoPrinter属性,此时demoContrller对象中demoPrinter不为空(在创建DemoPrinter对象的时候也是走了一遍bean的创建初始化过程);
  3. 对demoController执行initializeBean方法,在initializeBean方法中会调用AbstractAutoProxyCreator(BeanNameAutoProxyCreatord的父类)的postProcessAfterInitialization,这个方法对demoController生成代理类(DemoController$$EnhancerBySpringCGLIB$$5f7bd00.class)返回代理类对象demoControllerProxy(请注意代理对象demoControllerProxy是没有执行populateBean方法的,也就是说代理类对象里面的demoPrinter是空的);
  4. Spring容器拿到代理类对象demoControllerProxy后,将代理类对象demoControllerProxy放入容器,供以后单例获取bean使用

    那么mvc在获取requestmapping的handler对象实际是代理类对象demoControllerProxy。因为DemoController是类不是接口,所以动态代理采用的是cglib组件,我们知道cglib组件是不会对private方法生成代理方法的。也就是说代理类对DemoController#hello生成了代理方法,调用代理类对象的hello最终调用到被代理对象(demoController)的hello方法;而DemoController#helloPri则没有生成代理方法,调用代理类对象的helloPri就是调用代理类的helloPri。第3步明确了代理类对象没有执行populateBean方法,所以代理类对象的demoPrinter是null,所以就抛了NPE异常。

至此,NPE异常原因分析完了。

如何避免

  • 代码规范:private、public不要瞎用
  • 改掉ctrl-c ctrl-v的习惯,尤其大段大段的复制粘贴

    后记:本例给的aop是用BeanNameAutoProxyCreator方式配置的,其实用方式配置完整的aop也是一样会有问题,无论是BeanNameAutoProxyCreator还是都是通过BeanPostProcessor实现的。

    最后贴一下cglib组件对DemoController生成的代理类文件(DemoController子类且没有对helloPri生成代理方法):

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.focuse.aopdemo.controller;

import java.lang.reflect.Method;
import java.lang.reflect.UndeclaredThrowableException;
import org.aopalliance.aop.Advice;
import org.springframework.aop.Advisor;
import org.springframework.aop.SpringProxy;
import org.springframework.aop.TargetClassAware;
import org.springframework.aop.TargetSource;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.AopConfigException;
import org.springframework.cglib.core.ReflectUtils;
import org.springframework.cglib.core.Signature;
import org.springframework.cglib.proxy.Callback;
import org.springframework.cglib.proxy.Dispatcher;
import org.springframework.cglib.proxy.Factory;
import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;
import org.springframework.cglib.proxy.NoOp;

public class DemoController$$EnhancerBySpringCGLIB$$5f7bd00 extends DemoController implements SpringProxy, Advised, Factory {
    private boolean CGLIB$BOUND;
    public static Object CGLIB$FACTORY_DATA;
    private static final ThreadLocal CGLIB$THREAD_CALLBACKS;
    private static final Callback[] CGLIB$STATIC_CALLBACKS;
    private MethodInterceptor CGLIB$CALLBACK_0;
    private MethodInterceptor CGLIB$CALLBACK_1;
    private NoOp CGLIB$CALLBACK_2;
    private Dispatcher CGLIB$CALLBACK_3;
    private Dispatcher CGLIB$CALLBACK_4;
    private MethodInterceptor CGLIB$CALLBACK_5;
    private MethodInterceptor CGLIB$CALLBACK_6;
    private static Object CGLIB$CALLBACK_FILTER;
    private static final Method CGLIB$hello$0$Method;
    private static final MethodProxy CGLIB$hello$0$Proxy;
    private static final Object[] CGLIB$emptyArgs;
    private static final Method CGLIB$equals$1$Method;
    private static final MethodProxy CGLIB$equals$1$Proxy;
    private static final Method CGLIB$toString$2$Method;
    private static final MethodProxy CGLIB$toString$2$Proxy;
    private static final Method CGLIB$hashCode$3$Method;
    private static final MethodProxy CGLIB$hashCode$3$Proxy;
    private static final Method CGLIB$clone$4$Method;
    private static final MethodProxy CGLIB$clone$4$Proxy;

    public DemoController$$EnhancerBySpringCGLIB$$5f7bd00() {
        try {
            super();
            CGLIB$BIND_CALLBACKS(this);
        } catch (Error | RuntimeException var1) {
            throw var1;
        } catch (Throwable var2) {
            throw new UndeclaredThrowableException(var2);
        }
    }

    static {
        CGLIB$STATICHOOK2();
        CGLIB$STATICHOOK1();
    }

    public final boolean equals(Object var1) {
        try {
            MethodInterceptor var10000 = this.CGLIB$CALLBACK_5;
            if (this.CGLIB$CALLBACK_5 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_5;
            }

            if (var10000 != null) {
                Object var4 = var10000.intercept(this, CGLIB$equals$1$Method, new Object[]{var1}, CGLIB$equals$1$Proxy);
                return var4 == null ? false : (Boolean)var4;
            } else {
                return super.equals(var1);
            }
        } catch (Error | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    public final String toString() {
        try {
            MethodInterceptor var10000 = this.CGLIB$CALLBACK_0;
            if (this.CGLIB$CALLBACK_0 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_0;
            }

            return var10000 != null ? (String)var10000.intercept(this, CGLIB$toString$2$Method, CGLIB$emptyArgs, CGLIB$toString$2$Proxy) : super.toString();
        } catch (Error | RuntimeException var1) {
            throw var1;
        } catch (Throwable var2) {
            throw new UndeclaredThrowableException(var2);
        }
    }

    public final int hashCode() {
        try {
            MethodInterceptor var10000 = this.CGLIB$CALLBACK_6;
            if (this.CGLIB$CALLBACK_6 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_6;
            }

            if (var10000 != null) {
                Object var3 = var10000.intercept(this, CGLIB$hashCode$3$Method, CGLIB$emptyArgs, CGLIB$hashCode$3$Proxy);
                return var3 == null ? 0 : ((Number)var3).intValue();
            } else {
                return super.hashCode();
            }
        } catch (Error | RuntimeException var1) {
            throw var1;
        } catch (Throwable var2) {
            throw new UndeclaredThrowableException(var2);
        }
    }

    protected final Object clone() throws CloneNotSupportedException {
        try {
            MethodInterceptor var10000 = this.CGLIB$CALLBACK_0;
            if (this.CGLIB$CALLBACK_0 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_0;
            }

            return var10000 != null ? var10000.intercept(this, CGLIB$clone$4$Method, CGLIB$emptyArgs, CGLIB$clone$4$Proxy) : super.clone();
        } catch (Error | CloneNotSupportedException | RuntimeException var1) {
            throw var1;
        } catch (Throwable var2) {
            throw new UndeclaredThrowableException(var2);
        }
    }

    public final int indexOf(Advisor var1) {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            return ((Advised)var10000.loadObject()).indexOf(var1);
        } catch (Error | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    public final int indexOf(Advice var1) {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            return ((Advised)var10000.loadObject()).indexOf(var1);
        } catch (Error | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    public Object newInstance(Callback var1) {
        try {
            throw new IllegalStateException("More than one callback object required");
        } catch (Error | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    public Object newInstance(Callback[] var1) {
        try {
            CGLIB$SET_THREAD_CALLBACKS(var1);
            DemoController$$EnhancerBySpringCGLIB$$5f7bd00 var10000 = new DemoController$$EnhancerBySpringCGLIB$$5f7bd00();
            CGLIB$SET_THREAD_CALLBACKS((Callback[])null);
            return var10000;
        } catch (Error | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    public Object newInstance(Class[] var1, Object[] var2, Callback[] var3) {
        try {
            CGLIB$SET_THREAD_CALLBACKS(var3);
            DemoController$$EnhancerBySpringCGLIB$$5f7bd00 var10000 = new DemoController$$EnhancerBySpringCGLIB$$5f7bd00;
            switch(var1.length) {
            case 0:
                var10000.();
                CGLIB$SET_THREAD_CALLBACKS((Callback[])null);
                return var10000;
            default:
                throw new IllegalArgumentException("Constructor not found");
            }
        } catch (Error | RuntimeException var4) {
            throw var4;
        } catch (Throwable var5) {
            throw new UndeclaredThrowableException(var5);
        }
    }

    public final boolean isFrozen() {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            return ((Advised)var10000.loadObject()).isFrozen();
        } catch (Error | RuntimeException var1) {
            throw var1;
        } catch (Throwable var2) {
            throw new UndeclaredThrowableException(var2);
        }
    }

    public final void addAdvice(int var1, Advice var2) throws AopConfigException {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            ((Advised)var10000.loadObject()).addAdvice(var1, var2);
        } catch (Error | AopConfigException | RuntimeException var3) {
            throw var3;
        } catch (Throwable var4) {
            throw new UndeclaredThrowableException(var4);
        }
    }

    public final void addAdvice(Advice var1) throws AopConfigException {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            ((Advised)var10000.loadObject()).addAdvice(var1);
        } catch (Error | AopConfigException | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    static void CGLIB$STATICHOOK1() {
        CGLIB$THREAD_CALLBACKS = new ThreadLocal();
        CGLIB$emptyArgs = new Object[0];
        Class var0 = Class.forName("com.focuse.aopdemo.controller.DemoController$$EnhancerBySpringCGLIB$$5f7bd00");
        Class var1;
        Method[] var10000 = ReflectUtils.findMethods(new String[]{"equals", "(Ljava/lang/Object;)Z", "toString", "()Ljava/lang/String;", "hashCode", "()I", "clone", "()Ljava/lang/Object;"}, (var1 = Class.forName("java.lang.Object")).getDeclaredMethods());
        CGLIB$equals$1$Method = var10000[0];
        CGLIB$equals$1$Proxy = MethodProxy.create(var1, var0, "(Ljava/lang/Object;)Z", "equals", "CGLIB$equals$1");
        CGLIB$toString$2$Method = var10000[1];
        CGLIB$toString$2$Proxy = MethodProxy.create(var1, var0, "()Ljava/lang/String;", "toString", "CGLIB$toString$2");
        CGLIB$hashCode$3$Method = var10000[2];
        CGLIB$hashCode$3$Proxy = MethodProxy.create(var1, var0, "()I", "hashCode", "CGLIB$hashCode$3");
        CGLIB$clone$4$Method = var10000[3];
        CGLIB$clone$4$Proxy = MethodProxy.create(var1, var0, "()Ljava/lang/Object;", "clone", "CGLIB$clone$4");
        CGLIB$hello$0$Method = ReflectUtils.findMethods(new String[]{"hello", "(Ljava/lang/String;)Ljava/lang/String;"}, (var1 = Class.forName("com.focuse.aopdemo.controller.DemoController")).getDeclaredMethods())[0];
        CGLIB$hello$0$Proxy = MethodProxy.create(var1, var0, "(Ljava/lang/String;)Ljava/lang/String;", "hello", "CGLIB$hello$0");
    }

    final String CGLIB$hello$0(String var1) {
        return super.hello(var1);
    }

    private static final void CGLIB$BIND_CALLBACKS(Object var0) {
        DemoController$$EnhancerBySpringCGLIB$$5f7bd00 var1 = (DemoController$$EnhancerBySpringCGLIB$$5f7bd00)var0;
        if (!var1.CGLIB$BOUND) {
            var1.CGLIB$BOUND = true;
            Object var10000 = CGLIB$THREAD_CALLBACKS.get();
            if (var10000 == null) {
                var10000 = CGLIB$STATIC_CALLBACKS;
                if (CGLIB$STATIC_CALLBACKS == null) {
                    return;
                }
            }

            Callback[] var10001 = (Callback[])var10000;
            var1.CGLIB$CALLBACK_6 = (MethodInterceptor)((Callback[])var10000)[6];
            var1.CGLIB$CALLBACK_5 = (MethodInterceptor)var10001[5];
            var1.CGLIB$CALLBACK_4 = (Dispatcher)var10001[4];
            var1.CGLIB$CALLBACK_3 = (Dispatcher)var10001[3];
            var1.CGLIB$CALLBACK_2 = (NoOp)var10001[2];
            var1.CGLIB$CALLBACK_1 = (MethodInterceptor)var10001[1];
            var1.CGLIB$CALLBACK_0 = (MethodInterceptor)var10001[0];
        }

    }

    final boolean CGLIB$equals$1(Object var1) {
        return super.equals(var1);
    }

    final String CGLIB$toString$2() {
        return super.toString();
    }

    final int CGLIB$hashCode$3() {
        return super.hashCode();
    }

    final Object CGLIB$clone$4() throws CloneNotSupportedException {
        return super.clone();
    }

    static void CGLIB$STATICHOOK2() {
        try {
            ;
        } catch (Error | RuntimeException var0) {
            throw var0;
        } catch (Throwable var1) {
            throw new UndeclaredThrowableException(var1);
        }
    }

    public final void setExposeProxy(boolean var1) {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            ((Advised)var10000.loadObject()).setExposeProxy(var1);
        } catch (Error | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    public final boolean isExposeProxy() {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            return ((Advised)var10000.loadObject()).isExposeProxy();
        } catch (Error | RuntimeException var1) {
            throw var1;
        } catch (Throwable var2) {
            throw new UndeclaredThrowableException(var2);
        }
    }

    public final Class getTargetClass() {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            return ((TargetClassAware)var10000.loadObject()).getTargetClass();
        } catch (Error | RuntimeException var1) {
            throw var1;
        } catch (Throwable var2) {
            throw new UndeclaredThrowableException(var2);
        }
    }

    public static MethodProxy CGLIB$findMethodProxy(Signature var0) {
        String var10000 = var0.toString();
        switch(var10000.hashCode()) {
        case -508378822:
            if (var10000.equals("clone()Ljava/lang/Object;")) {
                return CGLIB$clone$4$Proxy;
            }
            break;
        case 848333779:
            if (var10000.equals("hello(Ljava/lang/String;)Ljava/lang/String;")) {
                return CGLIB$hello$0$Proxy;
            }
            break;
        case 1826985398:
            if (var10000.equals("equals(Ljava/lang/Object;)Z")) {
                return CGLIB$equals$1$Proxy;
            }
            break;
        case 1913648695:
            if (var10000.equals("toString()Ljava/lang/String;")) {
                return CGLIB$toString$2$Proxy;
            }
            break;
        case 1984935277:
            if (var10000.equals("hashCode()I")) {
                return CGLIB$hashCode$3$Proxy;
            }
        }

        return null;
    }

    public final void setTargetSource(TargetSource var1) {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            ((Advised)var10000.loadObject()).setTargetSource(var1);
        } catch (Error | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    public final boolean isPreFiltered() {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            return ((Advised)var10000.loadObject()).isPreFiltered();
        } catch (Error | RuntimeException var1) {
            throw var1;
        } catch (Throwable var2) {
            throw new UndeclaredThrowableException(var2);
        }
    }

    public final Class[] getProxiedInterfaces() {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            return ((Advised)var10000.loadObject()).getProxiedInterfaces();
        } catch (Error | RuntimeException var1) {
            throw var1;
        } catch (Throwable var2) {
            throw new UndeclaredThrowableException(var2);
        }
    }

    public final boolean isInterfaceProxied(Class var1) {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            return ((Advised)var10000.loadObject()).isInterfaceProxied(var1);
        } catch (Error | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    public final Advisor[] getAdvisors() {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            return ((Advised)var10000.loadObject()).getAdvisors();
        } catch (Error | RuntimeException var1) {
            throw var1;
        } catch (Throwable var2) {
            throw new UndeclaredThrowableException(var2);
        }
    }

    public final void addAdvisor(Advisor var1) throws AopConfigException {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            ((Advised)var10000.loadObject()).addAdvisor(var1);
        } catch (Error | AopConfigException | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    public final void addAdvisor(int var1, Advisor var2) throws AopConfigException {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            ((Advised)var10000.loadObject()).addAdvisor(var1, var2);
        } catch (Error | AopConfigException | RuntimeException var3) {
            throw var3;
        } catch (Throwable var4) {
            throw new UndeclaredThrowableException(var4);
        }
    }

    public final boolean removeAdvisor(Advisor var1) {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            return ((Advised)var10000.loadObject()).removeAdvisor(var1);
        } catch (Error | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    public final void removeAdvisor(int var1) throws AopConfigException {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            ((Advised)var10000.loadObject()).removeAdvisor(var1);
        } catch (Error | AopConfigException | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    public final boolean replaceAdvisor(Advisor var1, Advisor var2) throws AopConfigException {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            return ((Advised)var10000.loadObject()).replaceAdvisor(var1, var2);
        } catch (Error | AopConfigException | RuntimeException var3) {
            throw var3;
        } catch (Throwable var4) {
            throw new UndeclaredThrowableException(var4);
        }
    }

    public final boolean removeAdvice(Advice var1) {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            return ((Advised)var10000.loadObject()).removeAdvice(var1);
        } catch (Error | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    public final String toProxyConfigString() {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            return ((Advised)var10000.loadObject()).toProxyConfigString();
        } catch (Error | RuntimeException var1) {
            throw var1;
        } catch (Throwable var2) {
            throw new UndeclaredThrowableException(var2);
        }
    }

    public void setCallbacks(Callback[] var1) {
        try {
            this.CGLIB$CALLBACK_0 = (MethodInterceptor)var1[0];
            this.CGLIB$CALLBACK_1 = (MethodInterceptor)var1[1];
            this.CGLIB$CALLBACK_2 = (NoOp)var1[2];
            this.CGLIB$CALLBACK_3 = (Dispatcher)var1[3];
            this.CGLIB$CALLBACK_4 = (Dispatcher)var1[4];
            this.CGLIB$CALLBACK_5 = (MethodInterceptor)var1[5];
            this.CGLIB$CALLBACK_6 = (MethodInterceptor)var1[6];
        } catch (Error | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    public Callback[] getCallbacks() {
        try {
            CGLIB$BIND_CALLBACKS(this);
            return new Callback[]{this.CGLIB$CALLBACK_0, this.CGLIB$CALLBACK_1, this.CGLIB$CALLBACK_2, this.CGLIB$CALLBACK_3, this.CGLIB$CALLBACK_4, this.CGLIB$CALLBACK_5, this.CGLIB$CALLBACK_6};
        } catch (Error | RuntimeException var1) {
            throw var1;
        } catch (Throwable var2) {
            throw new UndeclaredThrowableException(var2);
        }
    }

    public static void CGLIB$SET_THREAD_CALLBACKS(Callback[] var0) {
        CGLIB$THREAD_CALLBACKS.set(var0);
    }

    public static void CGLIB$SET_STATIC_CALLBACKS(Callback[] var0) {
        CGLIB$STATIC_CALLBACKS = var0;
    }

    public void setCallback(int var1, Callback var2) {
        try {
            switch(var1) {
            case 0:
                this.CGLIB$CALLBACK_0 = (MethodInterceptor)var2;
                break;
            case 1:
                this.CGLIB$CALLBACK_1 = (MethodInterceptor)var2;
                break;
            case 2:
                this.CGLIB$CALLBACK_2 = (NoOp)var2;
                break;
            case 3:
                this.CGLIB$CALLBACK_3 = (Dispatcher)var2;
                break;
            case 4:
                this.CGLIB$CALLBACK_4 = (Dispatcher)var2;
                break;
            case 5:
                this.CGLIB$CALLBACK_5 = (MethodInterceptor)var2;
                break;
            case 6:
                this.CGLIB$CALLBACK_6 = (MethodInterceptor)var2;
            }

        } catch (Error | RuntimeException var3) {
            throw var3;
        } catch (Throwable var4) {
            throw new UndeclaredThrowableException(var4);
        }
    }

    public Callback getCallback(int var1) {
        try {
            CGLIB$BIND_CALLBACKS(this);
            Object var10000;
            switch(var1) {
            case 0:
                var10000 = this.CGLIB$CALLBACK_0;
                break;
            case 1:
                var10000 = this.CGLIB$CALLBACK_1;
                break;
            case 2:
                var10000 = this.CGLIB$CALLBACK_2;
                break;
            case 3:
                var10000 = this.CGLIB$CALLBACK_3;
                break;
            case 4:
                var10000 = this.CGLIB$CALLBACK_4;
                break;
            case 5:
                var10000 = this.CGLIB$CALLBACK_5;
                break;
            case 6:
                var10000 = this.CGLIB$CALLBACK_6;
                break;
            default:
                var10000 = null;
            }

            return (Callback)var10000;
        } catch (Error | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    public final String hello(String var1) {
        try {
            MethodInterceptor var10000 = this.CGLIB$CALLBACK_0;
            if (this.CGLIB$CALLBACK_0 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_0;
            }

            return var10000 != null ? (String)var10000.intercept(this, CGLIB$hello$0$Method, new Object[]{var1}, CGLIB$hello$0$Proxy) : super.hello(var1);
        } catch (Error | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }

    public final TargetSource getTargetSource() {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            return ((Advised)var10000.loadObject()).getTargetSource();
        } catch (Error | RuntimeException var1) {
            throw var1;
        } catch (Throwable var2) {
            throw new UndeclaredThrowableException(var2);
        }
    }

    public final boolean isProxyTargetClass() {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            return ((Advised)var10000.loadObject()).isProxyTargetClass();
        } catch (Error | RuntimeException var1) {
            throw var1;
        } catch (Throwable var2) {
            throw new UndeclaredThrowableException(var2);
        }
    }

    public final void setPreFiltered(boolean var1) {
        try {
            Dispatcher var10000 = this.CGLIB$CALLBACK_4;
            if (this.CGLIB$CALLBACK_4 == null) {
                CGLIB$BIND_CALLBACKS(this);
                var10000 = this.CGLIB$CALLBACK_4;
            }

            ((Advised)var10000.loadObject()).setPreFiltered(var1);
        } catch (Error | RuntimeException var2) {
            throw var2;
        } catch (Throwable var3) {
            throw new UndeclaredThrowableException(var3);
        }
    }
}

 

你可能感兴趣的:(问题经验)