Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Moving from bshInterpreter to GroovyShell

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/branches/20120209RemoveBsh@1243012 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 0b1929919594b0edb750cc6708e4a4f59e3ab02b 1 parent 6a2a2c3
authored February 11, 2012
34  framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java
@@ -266,10 +266,7 @@ private static FlexibleStringExpander parse(char[] chars, int offset, int length
266 266
                 // append everything from the current index to the start of the expression
267 267
                 strElems.add(new ConstOffsetElem(chars, currentInd, (escapedExpression ? start -1 : start) - currentInd));
268 268
             }
269  
-            if (expression.indexOf("bsh:", start + 2) == start + 2 && !escapedExpression) {
270  
-                // checks to see if this starts with a "bsh:", if so treat the rest of the expression as a bsh scriptlet
271  
-                strElems.add(new BshElem(chars, start, Math.min(end + 1, start + length) - start, start + 6, end - start - 6));
272  
-            } else if (expression.indexOf("groovy:", start + 2) == start + 2 && !escapedExpression) {
  269
+            if (expression.indexOf("groovy:", start + 2) == start + 2 && !escapedExpression) {
273 270
                 // checks to see if this starts with a "groovy:", if so treat the rest of the expression as a groovy scriptlet
274 271
                 strElems.add(new GroovyElem(chars, start, Math.min(end + 1, start + length) - start, start + 9, end - start - 9));
275 272
             } else {
@@ -488,35 +485,6 @@ public String getOriginal() {
488 485
         }
489 486
     }
490 487
 
491  
-    /** An object that represents a <code>${bsh:}</code> expression. */
492  
-    protected static class BshElem extends ArrayOffsetString {
493  
-        private final int parseStart;
494  
-        private final int parseLength;
495  
-
496  
-        protected BshElem(char[] chars, int offset, int length, int parseStart, int parseLength) {
497  
-            super(chars, offset, length);
498  
-            this.parseStart = parseStart;
499  
-            this.parseLength = parseLength;
500  
-        }
501  
-
502  
-        @Override
503  
-        protected Object get(Map<String, ? extends Object> context, TimeZone timeZone, Locale locale) {
504  
-            try {
505  
-                Object obj = BshUtil.eval(new String(this.chars, this.parseStart, this.parseLength), UtilMisc.makeMapWritable(context));
506  
-                if (obj != null) {
507  
-                    return obj;
508  
-                } else {
509  
-                    if (Debug.verboseOn()) {
510  
-                        Debug.logVerbose("BSH scriptlet evaluated to null [" + this + "], got no return so inserting nothing.", module);
511  
-                    }
512  
-                }
513  
-            } catch (EvalError e) {
514  
-                Debug.logWarning(e, "Error evaluating BSH scriptlet [" + this + "], inserting nothing; error was: " + e, module);
515  
-            }
516  
-            return null;
517  
-        }
518  
-    }
519  
-
520 488
     /** An object that represents a <code>String</code> constant portion of an expression. */
521 489
     protected static class ConstSimpleElem extends FlexibleStringExpander {
522 490
         protected ConstSimpleElem(char[] chars) {
8  framework/minilang/src/org/ofbiz/minilang/method/callops/CallScript.java
@@ -73,13 +73,7 @@ public boolean exec(MethodContext methodContext) {
73 73
         }
74 74
 
75 75
         Map<String, Object> context = methodContext.getEnvMap();        
76  
-        if (location.endsWith(".bsh")) {
77  
-            try {
78  
-                BshUtil.runBshAtLocation(location, context);
79  
-            } catch (GeneralException e) {
80  
-                messages.add("Error running BSH script at location [" + location + "]: " + e.getMessage());
81  
-            }
82  
-        } else if (location.endsWith(".groovy")) {
  76
+        if (location.endsWith(".groovy")) {
83 77
             try {
84 78
                 groovy.lang.Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(location), GroovyUtil.getBinding(context));
85 79
                 if (UtilValidate.isEmpty(method)) {
8  framework/widget/src/org/ofbiz/widget/ModelWidgetAction.java
@@ -403,13 +403,7 @@ public Script(ModelWidget modelWidget, Element scriptElement) {
403 403
 
404 404
         @Override
405 405
         public void runAction(Map<String, Object> context) throws GeneralException {
406  
-            if (location.endsWith(".bsh")) {
407  
-                try {
408  
-                    BshUtil.runBshAtLocation(location, context);
409  
-                } catch (GeneralException e) {
410  
-                    throw new GeneralException("Error running BSH script at location [" + location + "]", e);
411  
-                }
412  
-            } else if (location.endsWith(".groovy")) {
  406
+            if (location.endsWith(".groovy")) {
413 407
                 try {
414 408
                     groovy.lang.Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(location), GroovyUtil.getBinding(context));
415 409
                     if (UtilValidate.isEmpty(method)) {
47  framework/widget/src/org/ofbiz/widget/form/ModelForm.java
@@ -30,19 +30,13 @@
30 30
 import java.util.TreeMap;
31 31
 import java.util.TreeSet;
32 32
 
  33
+import groovy.lang.GroovyShell;
33 34
 import javolution.util.FastList;
34 35
 import javolution.util.FastMap;
35 36
 import javolution.util.FastSet;
36 37
 
37  
-import org.ofbiz.base.util.BshUtil;
38  
-import org.ofbiz.base.util.Debug;
39  
-import org.ofbiz.base.util.GeneralException;
40  
-import org.ofbiz.base.util.StringUtil;
41  
-import org.ofbiz.base.util.UtilGenerics;
42  
-import org.ofbiz.base.util.UtilMisc;
43  
-import org.ofbiz.base.util.UtilProperties;
44  
-import org.ofbiz.base.util.UtilValidate;
45  
-import org.ofbiz.base.util.UtilXml;
  38
+import org.codehaus.groovy.control.CompilationFailedException;
  39
+import org.ofbiz.base.util.*;
46 40
 import org.ofbiz.base.util.collections.FlexibleMapAccessor;
47 41
 import org.ofbiz.base.util.collections.MapStack;
48 42
 import org.ofbiz.base.util.string.FlexibleStringExpander;
@@ -60,9 +54,6 @@
60 54
 import org.ofbiz.widget.WidgetWorker;
61 55
 import org.w3c.dom.Element;
62 56
 
63  
-import bsh.EvalError;
64  
-import bsh.Interpreter;
65  
-
66 57
 /**
67 58
  * Widget Library - Form model class
68 59
  */
@@ -1490,7 +1481,7 @@ public void renderItemRows(Appendable writer, Map<String, Object> context, FormS
1490 1481
                 }
1491 1482
 
1492 1483
                 // reset/remove the BshInterpreter now as well as later because chances are there is an interpreter at this level of the stack too
1493  
-                this.resetBshInterpreter(localContext);
  1484
+                this.resetGroovyShell(localContext);
1494 1485
                 localContext.push();
1495 1486
                 localContext.put("previousItem", previousItem);
1496 1487
                 previousItem = FastMap.newInstance();
@@ -1503,7 +1494,7 @@ public void renderItemRows(Appendable writer, Map<String, Object> context, FormS
1503 1494
                     localContext.put("formUniqueId", "_"+context.get("renderFormSeqNumber"));
1504 1495
                 }
1505 1496
 
1506  
-                this.resetBshInterpreter(localContext);
  1497
+                this.resetGroovyShell(localContext);
1507 1498
 
1508 1499
                 if (Debug.verboseOn()) Debug.logVerbose("In form got another row, context is: " + localContext, module);
1509 1500
 
@@ -2025,9 +2016,9 @@ public String getTarget(Map<String, Object> context, String targetType) {
2025 2016
 
2026 2017
         try {
2027 2018
             // use the same Interpreter (ie with the same context setup) for all evals
2028  
-            Interpreter bsh = this.getBshInterpreter(context);
  2019
+            GroovyShell shell = this.getGroovyShell(context);
2029 2020
             for (AltTarget altTarget: this.altTargets) {
2030  
-                Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(altTarget.useWhen));
  2021
+                Object retVal = shell.evaluate(StringUtil.convertOperatorSubstitutions(altTarget.useWhen));
2031 2022
                 boolean condTrue = false;
2032 2023
                 // retVal should be a Boolean, if not something weird is up...
2033 2024
                 if (retVal instanceof Boolean) {
@@ -2042,7 +2033,7 @@ public String getTarget(Map<String, Object> context, String targetType) {
2042 2033
                     return altTarget.targetExdr.expandString(expanderContext);
2043 2034
                 }
2044 2035
             }
2045  
-        } catch (EvalError e) {
  2036
+        } catch (CompilationFailedException e) {
2046 2037
             String errmsg = "Error evaluating BeanShell target conditions on form " + this.name;
2047 2038
             Debug.logError(e, errmsg, module);
2048 2039
             throw new IllegalArgumentException(errmsg);
@@ -2098,17 +2089,17 @@ public String getBoundaryCommentName() {
2098 2089
         return formLocation + "#" + name;
2099 2090
     }
2100 2091
 
2101  
-    public void resetBshInterpreter(Map<String, Object> context) {
2102  
-        context.remove("bshInterpreter");
  2092
+    public void resetGroovyShell(Map<String, Object> context) {
  2093
+        context.remove("groovyShell");
2103 2094
     }
2104 2095
 
2105  
-    public Interpreter getBshInterpreter(Map<String, Object> context) throws EvalError {
2106  
-        Interpreter bsh = (Interpreter) context.get("bshInterpreter");
2107  
-        if (bsh == null) {
2108  
-            bsh = BshUtil.makeInterpreter(context);
2109  
-            context.put("bshInterpreter", bsh);
  2096
+    public GroovyShell getGroovyShell(Map<String, Object> context) throws CompilationFailedException {
  2097
+        GroovyShell shell = (GroovyShell) context.get("groovyShell");
  2098
+        if (shell == null) {
  2099
+            shell = new GroovyShell(GroovyUtil.getBinding(context));
  2100
+            context.put("groovyShell", shell);
2110 2101
         }
2111  
-        return bsh;
  2102
+        return shell;
2112 2103
     }
2113 2104
 
2114 2105
     /**
@@ -2754,9 +2745,9 @@ public String getStyleAltRowStyle(Map<String, Object> context) {
2754 2745
         String styles = "";
2755 2746
         try {
2756 2747
             // use the same Interpreter (ie with the same context setup) for all evals
2757  
-            Interpreter bsh = this.getBshInterpreter(context);
  2748
+            GroovyShell shell = this.getGroovyShell(context);
2758 2749
             for (AltRowStyle altRowStyle : this.altRowStyles) {
2759  
-                Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(altRowStyle.useWhen));
  2750
+                Object retVal = shell.evaluate(StringUtil.convertOperatorSubstitutions(altRowStyle.useWhen));
2760 2751
                 // retVal should be a Boolean, if not something weird is up...
2761 2752
                 if (retVal instanceof Boolean) {
2762 2753
                     Boolean boolVal = (Boolean) retVal;
@@ -2768,7 +2759,7 @@ public String getStyleAltRowStyle(Map<String, Object> context) {
2768 2759
                         "Return value from style condition eval was not a Boolean: " + retVal.getClass().getName() + " [" + retVal + "] of form " + this.name);
2769 2760
                 }
2770 2761
             }
2771  
-        } catch (EvalError e) {
  2762
+        } catch (CompilationFailedException e) {
2772 2763
             String errmsg = "Error evaluating BeanShell style conditions on form " + this.name;
2773 2764
             Debug.logError(e, errmsg, module);
2774 2765
             throw new IllegalArgumentException(errmsg);
11  framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java
@@ -32,7 +32,6 @@
32 32
 import javolution.util.FastMap;
33 33
 
34 34
 import org.codehaus.groovy.runtime.InvokerHelper;
35  
-import org.ofbiz.base.util.BshUtil;
36 35
 import org.ofbiz.base.util.Debug;
37 36
 import org.ofbiz.base.util.GeneralException;
38 37
 import org.ofbiz.base.util.GroovyUtil;
@@ -285,15 +284,7 @@ public Script(ModelForm modelForm, Element scriptElement) {
285 284
 
286 285
         @Override
287 286
         public void runAction(Map<String, Object> context) {
288  
-            if (location.endsWith(".bsh")) {
289  
-                try {
290  
-                    BshUtil.runBshAtLocation(location, context);
291  
-                } catch (GeneralException e) {
292  
-                    String errMsg = "Error running BSH script at location [" + location + "]: " + e.toString();
293  
-                    Debug.logError(e, errMsg, module);
294  
-                    throw new IllegalArgumentException(errMsg);
295  
-                }
296  
-            } else if (location.endsWith(".groovy")) {
  287
+            if (location.endsWith(".groovy")) {
297 288
                 try {
298 289
                     groovy.lang.Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(location), GroovyUtil.getBinding(context));
299 290
                     if (UtilValidate.isEmpty(method)) {
36  framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
@@ -32,24 +32,15 @@
32 32
 import java.util.StringTokenizer;
33 33
 import java.util.TimeZone;
34 34
 
  35
+import groovy.lang.GroovyShell;
35 36
 import javolution.util.FastList;
36 37
 import javolution.util.FastMap;
37 38
 
  39
+import org.codehaus.groovy.control.CompilationFailedException;
38 40
 import org.ofbiz.base.conversion.ConversionException;
39 41
 import org.ofbiz.base.conversion.DateTimeConverters;
40 42
 import org.ofbiz.base.conversion.DateTimeConverters.StringToTimestamp;
41  
-import org.ofbiz.base.util.BshUtil;
42  
-import org.ofbiz.base.util.Debug;
43  
-import org.ofbiz.base.util.GeneralException;
44  
-import org.ofbiz.base.util.ObjectType;
45  
-import org.ofbiz.base.util.StringUtil;
46  
-import org.ofbiz.base.util.UtilDateTime;
47  
-import org.ofbiz.base.util.UtilFormatOut;
48  
-import org.ofbiz.base.util.UtilGenerics;
49  
-import org.ofbiz.base.util.UtilMisc;
50  
-import org.ofbiz.base.util.UtilProperties;
51  
-import org.ofbiz.base.util.UtilValidate;
52  
-import org.ofbiz.base.util.UtilXml;
  43
+import org.ofbiz.base.util.*;
53 44
 import org.ofbiz.base.util.collections.FlexibleMapAccessor;
54 45
 import org.ofbiz.base.util.collections.MapStack;
55 46
 import org.ofbiz.base.util.string.FlexibleStringExpander;
@@ -71,9 +62,6 @@
71 62
 import org.ofbiz.widget.form.ModelForm.UpdateArea;
72 63
 import org.w3c.dom.Element;
73 64
 
74  
-import bsh.EvalError;
75  
-import bsh.Interpreter;
76  
-
77 65
 /**
78 66
  * Widget Library - Form model class
79 67
  */
@@ -1014,8 +1002,8 @@ public boolean shouldUse(Map<String, Object> context) {
1014 1002
         if (UtilValidate.isEmpty(useWhenStr)) return true;
1015 1003
         
1016 1004
         try {
1017  
-            Interpreter bsh = this.modelForm.getBshInterpreter(context);
1018  
-            Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(useWhenStr));
  1005
+            GroovyShell shell = this.modelForm.getGroovyShell(context);
  1006
+            Object retVal = shell.evaluate(StringUtil.convertOperatorSubstitutions(useWhenStr));
1019 1007
             boolean condTrue = false;
1020 1008
             // retVal should be a Boolean, if not something weird is up...
1021 1009
             if (retVal instanceof Boolean) {
@@ -1027,7 +1015,7 @@ public boolean shouldUse(Map<String, Object> context) {
1027 1015
             }
1028 1016
 
1029 1017
             return condTrue;
1030  
-        } catch (EvalError e) {
  1018
+        } catch (CompilationFailedException e) {
1031 1019
             String errMsg = "Error evaluating BeanShell use-when condition [" + useWhenStr + "] on the field "
1032 1020
                     + this.name + " of form " + this.modelForm.getName() + ": " + e.toString();
1033 1021
             Debug.logError(e, errMsg, module);
@@ -2508,13 +2496,13 @@ public boolean shouldUse(Map<String, Object> context) {
2508 2496
             String useWhen = this.getUseWhen(context);
2509 2497
             if (UtilValidate.isNotEmpty(useWhen)) {
2510 2498
                 try {
2511  
-                    Interpreter bsh = (Interpreter) context.get("bshInterpreter");
2512  
-                    if (bsh == null) {
2513  
-                        bsh = BshUtil.makeInterpreter(context);
2514  
-                        context.put("bshInterpreter", bsh);
  2499
+                    GroovyShell shell = (GroovyShell) context.get("groovyShell");
  2500
+                    if (shell == null) {
  2501
+                        shell = new GroovyShell(GroovyUtil.getBinding(context));
  2502
+                        context.put("groovyShell", shell);
2515 2503
                     }
2516 2504
 
2517  
-                    Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(useWhen));
  2505
+                    Object retVal = shell.evaluate(StringUtil.convertOperatorSubstitutions(useWhen));
2518 2506
 
2519 2507
                     // retVal should be a Boolean, if not something weird is up...
2520 2508
                     if (retVal instanceof Boolean) {
@@ -2524,7 +2512,7 @@ public boolean shouldUse(Map<String, Object> context) {
2524 2512
                         throw new IllegalArgumentException(
2525 2513
                             "Return value from target condition eval was not a Boolean: " + retVal.getClass().getName() + " [" + retVal + "]");
2526 2514
                     }
2527  
-                } catch (EvalError e) {
  2515
+                } catch (CompilationFailedException e) {
2528 2516
                     String errmsg = "Error evaluating BeanShell target conditions";
2529 2517
                     Debug.logError(e, errmsg, module);
2530 2518
                     throw new IllegalArgumentException(errmsg);
22  framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java
@@ -24,10 +24,9 @@
24 24
 import java.util.List;
25 25
 import java.util.Map;
26 26
 
27  
-import org.ofbiz.base.util.BshUtil;
28  
-import org.ofbiz.base.util.Debug;
29  
-import org.ofbiz.base.util.UtilValidate;
30  
-import org.ofbiz.base.util.UtilXml;
  27
+import groovy.lang.GroovyShell;
  28
+import org.codehaus.groovy.control.CompilationFailedException;
  29
+import org.ofbiz.base.util.*;
31 30
 import org.ofbiz.base.util.collections.FlexibleMapAccessor;
32 31
 import org.ofbiz.base.util.string.FlexibleStringExpander;
33 32
 import org.ofbiz.entity.Delegator;
@@ -35,9 +34,6 @@
35 34
 import org.ofbiz.widget.ModelWidget;
36 35
 import org.w3c.dom.Element;
37 36
 
38  
-import bsh.EvalError;
39  
-import bsh.Interpreter;
40  
-
41 37
 /**
42 38
  * Widget Library - Menu model class
43 39
  */
@@ -446,13 +442,13 @@ public String getBoundaryCommentName() {
446 442
         return menuLocation + "#" + name;
447 443
     }
448 444
 
449  
-    public Interpreter getBshInterpreter(Map<String, Object> context) throws EvalError {
450  
-        Interpreter bsh = (Interpreter) context.get("bshInterpreter");
451  
-        if (bsh == null) {
452  
-            bsh = BshUtil.makeInterpreter(context);
453  
-            context.put("bshInterpreter", bsh);
  445
+    public GroovyShell getGroovyShell(Map<String, Object> context) throws CompilationFailedException {
  446
+        GroovyShell shell = (GroovyShell) context.get("groovyShell");
  447
+        if (shell == null) {
  448
+            shell = new GroovyShell(GroovyUtil.getBinding(context));
  449
+            context.put("groovyShell", shell);
454 450
         }
455  
-        return bsh;
  451
+        return shell;
456 452
     }
457 453
 
458 454
     /**
10  framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java
@@ -364,15 +364,7 @@ public Script(ModelMenu modelMenu, Element scriptElement) {
364 364
 
365 365
         @Override
366 366
         public void runAction(Map<String, Object> context) {
367  
-            if (location.endsWith(".bsh")) {
368  
-                try {
369  
-                    BshUtil.runBshAtLocation(location, context);
370  
-                } catch (GeneralException e) {
371  
-                    String errMsg = "Error running BSH script at location [" + location + "]: " + e.toString();
372  
-                    Debug.logError(e, errMsg, module);
373  
-                    throw new IllegalArgumentException(errMsg);
374  
-                }
375  
-            } else if (location.endsWith(".groovy")) {
  367
+            if (location.endsWith(".groovy")) {
376 368
                 try {
377 369
                     groovy.lang.Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(location), GroovyUtil.getBinding(context));
378 370
                     if (UtilValidate.isEmpty(method)) {
32  framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java
@@ -28,14 +28,8 @@
28 28
 import javolution.util.FastList;
29 29
 import javolution.util.FastMap;
30 30
 
31  
-import org.ofbiz.base.util.BshUtil;
32  
-import org.ofbiz.base.util.Debug;
33  
-import org.ofbiz.base.util.GeneralException;
34  
-import org.ofbiz.base.util.ObjectType;
35  
-import org.ofbiz.base.util.UtilFormatOut;
36  
-import org.ofbiz.base.util.UtilGenerics;
37  
-import org.ofbiz.base.util.UtilValidate;
38  
-import org.ofbiz.base.util.UtilXml;
  31
+import org.codehaus.groovy.runtime.InvokerHelper;
  32
+import org.ofbiz.base.util.*;
39 33
 import org.ofbiz.base.util.collections.FlexibleMapAccessor;
40 34
 import org.ofbiz.base.util.string.FlexibleStringExpander;
41 35
 import org.ofbiz.entity.finder.ByAndFinder;
@@ -45,6 +39,7 @@
45 39
 import org.ofbiz.entity.util.EntityListIterator;
46 40
 import org.ofbiz.service.GenericServiceException;
47 41
 import org.ofbiz.service.ModelService;
  42
+import org.ofbiz.widget.WidgetWorker;
48 43
 import org.w3c.dom.Document;
49 44
 import org.w3c.dom.Element;
50 45
 
@@ -173,24 +168,35 @@ public void runAction(Map<String, Object> context) {
173 168
     }
174 169
 
175 170
     public static class Script extends ModelTreeAction {
  171
+        protected static final Object[] EMPTY_ARGS = {};
176 172
         protected String location;
  173
+        protected String method;
177 174
 
178 175
         public Script(ModelTree.ModelNode modelNode, Element scriptElement) {
179 176
             super (modelNode, scriptElement);
180  
-            this.location = scriptElement.getAttribute("location");
  177
+            String scriptLocation = scriptElement.getAttribute("location");
  178
+            this.location = WidgetWorker.getScriptLocation(scriptLocation);
  179
+            this.method = WidgetWorker.getScriptMethodName(scriptLocation);
181 180
         }
182 181
 
183 182
         public Script(ModelTree.ModelNode.ModelSubNode modelSubNode, Element scriptElement) {
184 183
             super (modelSubNode, scriptElement);
185  
-            this.location = scriptElement.getAttribute("location");
  184
+            String scriptLocation = scriptElement.getAttribute("location");
  185
+            this.location = WidgetWorker.getScriptLocation(scriptLocation);
  186
+            this.method = WidgetWorker.getScriptMethodName(scriptLocation);
186 187
         }
187 188
 
188 189
         @Override
189 190
         public void runAction(Map<String, Object> context) {
190  
-            if (location.endsWith(".bsh")) {
  191
+            if (location.endsWith(".groovy")) {
191 192
                 try {
192 193
                     context.put("_LIST_ITERATOR_", null);
193  
-                    BshUtil.runBshAtLocation(location, context);
  194
+                    groovy.lang.Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(location), GroovyUtil.getBinding(context));
  195
+                    if (UtilValidate.isEmpty(method)) {
  196
+                        script.run();
  197
+                    } else {
  198
+                        script.invokeMethod(method, EMPTY_ARGS);
  199
+                    }
194 200
                     Object obj = context.get("_LIST_ITERATOR_");
195 201
                     if (this.modelSubNode != null) {
196 202
                         if (obj != null && (obj instanceof EntityListIterator || obj instanceof ListIterator<?>)) {
@@ -204,7 +210,7 @@ public void runAction(Map<String, Object> context) {
204 210
                         }
205 211
                     }
206 212
                 } catch (GeneralException e) {
207  
-                    String errMsg = "Error running BSH script at location [" + location + "]: " + e.toString();
  213
+                    String errMsg = "Error running Groovy script at location [" + location + "]: " + e.toString();
208 214
                     Debug.logError(e, errMsg, module);
209 215
                     throw new IllegalArgumentException(errMsg);
210 216
                 }

0 notes on commit 0b19299

Please sign in to comment.
Something went wrong with that request. Please try again.