From 821580db867a0e08c4660c61db585a5d38caaff4 Mon Sep 17 00:00:00 2001 From: Eric Giffon Date: Wed, 19 Jun 2024 14:11:00 +0200 Subject: [PATCH] SONAR-22152 Remove JGit workaround No longer needed as the update to JGit 6.10 fixes the issue. --- .../java/org/sonar/batch/bootstrapper/Batch.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/Batch.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/Batch.java index 2a105bc466a0..19b90c180fae 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/Batch.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/Batch.java @@ -25,8 +25,6 @@ import java.util.List; import java.util.Map; import javax.annotation.Nullable; -import org.eclipse.jgit.internal.util.ShutdownHook; -import org.slf4j.LoggerFactory; import org.sonar.api.utils.MessageException; import org.sonar.scanner.bootstrap.EnvironmentConfig; import org.sonar.scanner.bootstrap.SpringGlobalContainer; @@ -75,16 +73,6 @@ public synchronized Batch doExecute(Map scannerProperties, List< SpringGlobalContainer.create(scannerProperties, components).execute(); } catch (RuntimeException e) { throw handleException(e); - } finally { - // Workaround for SONAR-22152 - // Call the cleanup method ourselves to avoid ClassNotFound errors when the Shutdown hook is called after the classloader is closed - try { - var cleanupMethod = ShutdownHook.class.getDeclaredMethod("cleanup"); - cleanupMethod.setAccessible(true); - cleanupMethod.invoke(ShutdownHook.INSTANCE); - } catch (Exception e) { - LoggerFactory.getLogger(Batch.class).debug("Failed to call JGit cleanup method", e); - } } return this; }