@@ -27,6 +27,8 @@ import org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner
2727import org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl
2828
2929import java.util.jar.JarFile
30+ import java.util.logging.Level
31+ import java.util.logging.Logger
3032import java.util.zip.ZipEntry
3133import java.util.zip.ZipException
3234import java.util.zip.ZipFile
@@ -42,6 +44,7 @@ class GrapeUtil {
4244 private static final String METAINF_PREFIX = ' META-INF/services/'
4345 private static final String RUNNER_PROVIDER_CONFIG = GroovyRunner . name
4446 private static final boolean DEBUG_GRAPE = Boolean . getBoolean(' groovy.grape.debug' )
47+ private static final Logger LOGGER = Logger . getLogger(GrapeUtil . name)
4548
4649 /**
4750 * Adds a URI to a classloader's classpath via reflection.
@@ -90,7 +93,11 @@ class GrapeUtil {
9093 }
9194 }
9295 } catch (ZipException e) {
93- throw new RuntimeException (" Grape could not load jar '$file '" , e)
96+ // Corrupt JAR (e.g. truncated download from a CDN 429/partial response): skip
97+ // extension-method scanning rather than aborting the whole @Grab. If the JAR is
98+ // actually used, the corruption will surface where the bytes are needed; meanwhile
99+ // other JARs in this grab continue to register their extensions normally.
100+ LOGGER . log(Level . WARNING , " Grape could not process jar '${ file} ' for extension methods" , e)
94101 }
95102 }
96103 }
0 commit comments