Browse Source

fix the method with bindingParameter invoke error

pull/1/head
yichen 2 years ago
parent
commit
bf1c3c27ce
  1. 1
      service/src/main/java/com/fanruan/proxy/interceptor/Interceptor.java
  2. 13
      service/src/main/java/com/fanruan/proxy/interceptor/InterceptorUtils.java
  3. 1
      test/src/test/java/com/fanruan/InterceptorIT.java
  4. 1
      test/src/test/java/com/fanruan/SavePointTest.java

1
service/src/main/java/com/fanruan/proxy/interceptor/Interceptor.java

@ -53,6 +53,7 @@ public class Interceptor implements MethodInterceptor {
InterceptorUtils.replaceBindingParameter(method, objects);
}
/**
* Parameters injection of class MyDriver's construction method will be delayed util the first "connect" method was intercepted
* Because Driver Instance is registered on the DriverManager in the static code block,

13
service/src/main/java/com/fanruan/proxy/interceptor/InterceptorUtils.java

@ -97,10 +97,6 @@ public class InterceptorUtils {
}
public static RpcRequest generateRequest(Class<?> clazz, Object o, Method method, Object[] objects){
if(isWithBindingParameter(method)){
replaceBindingParameter(method, objects);
}
RpcRequest rpcRequest = new RpcRequest();
rpcRequest
.setID(Commons.getID())
@ -127,15 +123,6 @@ public class InterceptorUtils {
return rpcRequest;
}
public static Class<?>[] getArgTypes(Object[] objects){
int n = objects.length;
Class<?>[] argTypes = new Class<?>[n];
for(int i=0; i<n; i++){
argTypes[i] = objects[i].getClass();
}
return argTypes;
}
public static boolean isNotImplemented(Method method) {
return method.isAnnotationPresent(NotImplemented.class);
}

1
test/src/test/java/com/fanruan/InterceptorIT.java

@ -30,7 +30,6 @@ public class InterceptorIT implements MethodInterceptor {
return methodProxy.invokeSuper(o, objects);
}
Class<?>[] actualArgTypes = InterceptorUtils.getArgTypes(objects);
RpcRequest request = InterceptorUtils.generateRequest(clazz, o, method, objects);
map.put(null, request);

1
test/src/test/java/com/fanruan/SavePointTest.java

@ -86,6 +86,7 @@ public class SavePointTest extends BaseJDBCTest{
}
@Test
@Disabled
void testUpdatableStream() throws SQLException{
Statement statement = connection.createStatement();

Loading…
Cancel
Save