{"id":"aefe55cef64d1fbf","repo":"junit-team/junit5","slug":"failed-to-close-custom-class-loader","errorCode":null,"errorMessage":"Failed to close custom class loader","messagePattern":"Failed to close custom class loader","errorType":"exception","errorClass":"JUnitException","httpStatus":null,"severity":"error","filePath":"junit-platform-console/src/main/java/org/junit/platform/console/command/CustomClassLoaderCloseStrategy.java","lineNumber":38,"sourceCode":" * discovery and execution.\n */\n@API(status = INTERNAL, since = \"1.13\")\npublic enum CustomClassLoaderCloseStrategy {\n\n\t/**\n\t * Close the custom class loader after calling the\n\t * {@link org.junit.platform.launcher.Launcher} for test discovery or\n\t * execution.\n\t */\n\tCLOSE_AFTER_CALLING_LAUNCHER {\n\n\t\t@Override\n\t\tvoid handle(CustomClassLoader customClassLoader) {\n\t\t\ttry {\n\t\t\t\tcustomClassLoader.close();\n\t\t\t}\n\t\t\tcatch (Exception ex) {\n\t\t\t\tthrow new JUnitException(\"Failed to close custom class loader\", ex);\n\t\t\t}\n\t\t}\n\t},\n\n\t/**\n\t * Rely on the JVM to release resources held by the custom class loader when\n\t * it terminates.\n\t *\n\t * <p>This mode is only safe to use when calling {@link System#exit(int)}\n\t * afterward.\n\t */\n\tKEEP_OPEN {\n\n\t\t@Override\n\t\tvoid handle(CustomClassLoader customClassLoader) {\n\t\t\t// do nothing\n\t\t}\n\t};","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/junit-team/junit5/blob/956246301e03d757539f7b76dd5a91f298637563/junit-platform-console/src/main/java/org/junit/platform/console/command/CustomClassLoaderCloseStrategy.java#L20-L56","documentation":"Error \"Failed to close custom class loader\" thrown in junit-team/junit5.","triggerScenarios":"Thrown at junit-platform-console/src/main/java/org/junit/platform/console/command/CustomClassLoaderCloseStrategy.java:38 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"956246301e03d757539f7b76dd5a91f298637563","analyzedAt":"2026-08-04T19:25:17.049Z","schemaVersion":2}