This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git
commit df2807701995a592763065d0e84fdfd507bd5c77 Author: Daniel Sun <[email protected]> AuthorDate: Sun Nov 3 22:22:23 2019 +0800 Fix "java.lang.RuntimeException: No suitable ClassLoader found for grab" caused by refactoring --- src/main/java/groovy/grape/Grape.java | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/java/groovy/grape/Grape.java b/src/main/java/groovy/grape/Grape.java index dfe7a37..7ab4328 100644 --- a/src/main/java/groovy/grape/Grape.java +++ b/src/main/java/groovy/grape/Grape.java @@ -157,21 +157,24 @@ public class Grape { public static void grab(final Map<String, Object> args, final Map... dependencies) { if (enableGrapes) { - AccessController.doPrivileged((PrivilegedAction<Void>) () -> { - GrapeEngine instance = getInstance(); - if (instance != null) { - if (!args.containsKey(AUTO_DOWNLOAD_SETTING)) { - args.put(AUTO_DOWNLOAD_SETTING, enableAutoDownload); + AccessController.doPrivileged(new PrivilegedAction<Void>() { + @Override + public Void run() { + GrapeEngine instance = getInstance(); + if (instance != null) { + if (!args.containsKey(AUTO_DOWNLOAD_SETTING)) { + args.put(AUTO_DOWNLOAD_SETTING, enableAutoDownload); + } + if (!args.containsKey(DISABLE_CHECKSUMS_SETTING)) { + args.put(DISABLE_CHECKSUMS_SETTING, disableChecksums); + } + if (!args.containsKey(GrapeEngine.CALLEE_DEPTH)) { + args.put(GrapeEngine.CALLEE_DEPTH, GrapeEngine.DEFAULT_CALLEE_DEPTH + 2); + } + instance.grab(args, dependencies); } - if (!args.containsKey(DISABLE_CHECKSUMS_SETTING)) { - args.put(DISABLE_CHECKSUMS_SETTING, disableChecksums); - } - if (!args.containsKey(GrapeEngine.CALLEE_DEPTH)) { - args.put(GrapeEngine.CALLEE_DEPTH, GrapeEngine.DEFAULT_CALLEE_DEPTH + 2); - } - instance.grab(args, dependencies); + return null; } - return null; }); } }
