svn commit: r1854652 - in /ofbiz/ofbiz-framework/trunk/framework/base: groovyScripts/GroovyInit.groovy src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1854652 - in /ofbiz/ofbiz-framework/trunk/framework/base: groovyScripts/GroovyInit.groovy src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java

mthl
Author: mthl
Date: Sat Mar  2 17:02:32 2019
New Revision: 1854652

URL: http://svn.apache.org/viewvc?rev=1854652&view=rev
Log:
Improved: Remove Groovy Base script redundancy (OFBIZ-10806)

According to Groovy documentation [1] the following construction:

    CompilerConfiguration cfg = new CompilerConfiguration();
    cfg.setScriptBaseClass(scriptBaseClass);
    groovyClassLoader =
        new GroovyClassLoader(GroovyUtil.class.getClassLoader(), cfg);

is equivalent to running the a script containing the ‘@BaseScript’
annotation.  Previously in ‘org.apache.ofbiz.base.util.GroovyUtil’
instead of choosing one solution, we were doing both.  Now we only
rely on the construction described above.

[1] http://docs.groovy-lang.org/latest/html/documentation/#_script_base_classes

Removed:
    ofbiz/ofbiz-framework/trunk/framework/base/groovyScripts/GroovyInit.groovy
Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java?rev=1854652&r1=1854651&r2=1854652&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java Sat Mar  2 17:02:32 2019
@@ -57,16 +57,6 @@ public class GroovyUtil {
             groovyClassLoader = new GroovyClassLoader(GroovyUtil.class.getClassLoader(), conf);
         }
         groovyScriptClassLoader = groovyClassLoader;
-        /*
-         *  With the implementation of @BaseScript annotations (introduced with Groovy 2.3.0) something was broken
-         *  in the CompilerConfiguration.setScriptBaseClass method and an error is thrown when our scripts are executed;
-         *  the workaround is to execute at startup a script containing the @BaseScript annotation.
-         */
-        try {
-            GroovyUtil.runScriptAtLocation("ofbizhome://framework/base/groovyScripts/GroovyInit.groovy", null, null);
-        } catch (Exception e) {
-            Debug.logWarning("The following error occurred during the initialization of Groovy: " + e.getMessage(), module);
-        }
     }
 
     /**