I hope that groovy does collects memory after each iteration.
otherwise there would be a lot of wasted memory.

[EMAIL PROTECTED] sent the following on 8/1/2008 4:19 PM:
> Author: lektran
> Date: Fri Aug  1 16:19:29 2008
> New Revision: 681898
> 
> URL: http://svn.apache.org/viewvc?rev=681898&view=rev
> Log:
> Some sort of problem with variable scope when using methods written in groovy 
> scripts, I don't really understand it but the problem is fixed at least
> 
> Modified:
>     
> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy
> 
> Modified: 
> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy?rev=681898&r1=681897&r2=681898&view=diff
> ==============================================================================
> --- 
> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy
>  (original)
> +++ 
> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy
>  Fri Aug  1 16:19:29 2008
> @@ -40,13 +40,13 @@
>  import org.ofbiz.order.shoppingcart.ShoppingCartEvents;
>  
>  String buildNext(Map map, List order, String current, String prefix, Map 
> featureTypes) {
> -    ct = 0;
> -    buf = new StringBuffer();
> +    def ct = 0;
> +    def buf = new StringBuffer();
>      buf.append("function listFT" + current + prefix + "() { ");
>      buf.append("document.forms[\"addform\"].elements[\"FT" + current + 
> "\"].options.length = 1;");
>      buf.append("document.forms[\"addform\"].elements[\"FT" + current + 
> "\"].options[0] = new Option(\"" + featureTypes[current] + 
> "\",\"\",true,true);");
>      map.each { key, value ->
> -        optValue = null;
> +        def optValue = null;
>  
>          if (order.indexOf(current) == (order.size()-1)) {
>              optValue = value.iterator().next();
> @@ -61,8 +61,8 @@
>      if (order.indexOf(current) < (order.size()-1)) {
>          ct = 0;
>          map.each { key, value ->
> -            nextOrder = order.get(order.indexOf(current)+1);
> -            newPrefix = prefix + "_" + ct;
> +            def nextOrder = order.get(order.indexOf(current)+1);
> +            def newPrefix = prefix + "_" + ct;
>              buf.append(buildNext(value, order, nextOrder, newPrefix, 
> featureTypes));
>              ct++;
>          }
> 
> 
> 
> 
> 

Reply via email to