Skip to content

Commit

Permalink
Fix #369
Browse files Browse the repository at this point in the history
  • Loading branch information
skybber committed Oct 6, 2020
1 parent 1d9c921 commit 2e224f6
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.hotswap.agent.plugin.mybatis.proxy;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
Expand All @@ -27,13 +26,10 @@
import org.apache.ibatis.builder.xml.XMLConfigBuilder;
import org.apache.ibatis.session.Configuration;
import org.hotswap.agent.javassist.util.proxy.MethodHandler;
import org.hotswap.agent.javassist.util.proxy.Proxy;
import org.hotswap.agent.javassist.util.proxy.ProxyFactory;
import org.hotswap.agent.plugin.mybatis.transformers.MyBatisTransformers;
import org.hotswap.agent.util.ReflectionHelper;

import sun.reflect.ReflectionFactory;

/**
* The Class ConfigurationProxy.
*
Expand Down Expand Up @@ -86,9 +82,7 @@ public Object invoke(Object self, Method overridden, Method forwarder,
};

try {
Constructor constructor = ReflectionFactory.getReflectionFactory().newConstructorForSerialization(factory.createClass(), Object.class.getDeclaredConstructor(new Class[0]));
proxyInstance = (Configuration) constructor.newInstance();
((Proxy) proxyInstance).setHandler(handler);
proxyInstance = (Configuration) factory.create(new Class[0], null, handler);
} catch (Exception e) {
throw new Error("Unable instantiate Configuration proxy", e);
}
Expand Down

0 comments on commit 2e224f6

Please sign in to comment.