You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2021/10/06 16:06:53 UTC

[groovy] 01/01: Add more logging to debug

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch danielsun/GROOVY-10281
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 99e6e7ecfc40091e570b01dc8fe186cdc3c054e3
Author: Daniel Sun <su...@apache.org>
AuthorDate: Wed Oct 6 23:45:56 2021 +0800

    Add more logging to debug
---
 .../java/org/codehaus/groovy/vmplugin/VMPluginFactory.java     | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/vmplugin/VMPluginFactory.java b/src/main/java/org/codehaus/groovy/vmplugin/VMPluginFactory.java
index 5f534c3..7a0bc66 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/VMPluginFactory.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/VMPluginFactory.java
@@ -19,6 +19,7 @@
 package org.codehaus.groovy.vmplugin;
 
 import org.apache.groovy.util.Maps;
+import org.codehaus.groovy.GroovyBugError;
 import org.codehaus.groovy.runtime.DefaultGroovyMethods;
 
 import java.math.BigDecimal;
@@ -52,6 +53,9 @@ public class VMPluginFactory {
     }
 
     public static VMPlugin getPlugin() {
+        if (null == PLUGIN) {
+            throw new GroovyBugError("VM plugin is null");
+        }
         return PLUGIN;
     }
 
@@ -59,7 +63,9 @@ public class VMPluginFactory {
         return AccessController.doPrivileged(new PrivilegedAction<VMPlugin>() {
             @Override
             public VMPlugin run() {
+//                System.out.println("Trying to create plugin...");
                 final BigDecimal specVer = new BigDecimal(System.getProperty("java.specification.version"));
+//                System.out.println("specVer: " + specVer + ", PLUGIN_MAP: " + PLUGIN_MAP);
                 ClassLoader loader = VMPluginFactory.class.getClassLoader();
                 for (Map.Entry<BigDecimal, String> entry : PLUGIN_MAP.entrySet()) {
                     if (isAtLeast(specVer, entry.getKey())) {
@@ -71,12 +77,12 @@ public class VMPluginFactory {
                                 LOGGER.fine("Trying to create VM plugin `" + pluginName + "`, but failed:\n" + DefaultGroovyMethods.asString(t)
                                 );
                             }
-
+//                            System.out.println("Failed to load plugin: " + pluginName + ", msg: " + t.getMessage());
                             return null;
                         }
                     }
                 }
-
+//                System.out.println("Failed to find plugin");
                 return null;
             }
         });