[jira] [Commented] (OFBIZ-12183) Groovy script Product.groovy: java.util.NoSuchElementException

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

[jira] [Commented] (OFBIZ-12183) Groovy script Product.groovy: java.util.NoSuchElementException

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-12183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17349045#comment-17349045 ]

Nicolas Malin commented on OFBIZ-12183:
---------------------------------------

HI [~Giulio_MpStyle] ,

Thanks for your detailled analyze !

After check, I'm really suprised to see that your version use javolution that has been remove since many years.

On the lastest stable branche (realease17) I didn't have it.

However, can you try to apply this patch ? I think that it would be solve your problem.
{code:java}
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java
index b9b51f85b3..15b403d575 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java
@@ -96,7 +96,9 @@ public class GroovyUtil {
             }
             // read back the context info
             Binding binding = shell.getContext();
-            context.putAll(binding.getVariables());
+            if (! binding.getVariables().isEmpty()) {
+                context.putAll(binding.getVariables());
+            }
         } catch (CompilationFailedException e) {
             Debug.logError(e, "Groovy Evaluation error.", module);
             throw e;
 {code}
From my part I failed all try to reproduce since issue.

Cheers

> Groovy script Product.groovy: java.util.NoSuchElementException
> ---------------------------------------------------------------
>
>                 Key: OFBIZ-12183
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-12183
>             Project: OFBiz
>          Issue Type: Bug
>          Components: ecommerce, order
>    Affects Versions: Release Branch 18.12, Trunk, 17.12.05
>         Environment: Linux/Ubuntu 16.04, Linux/Ubuntu 18.04, OFBiz v13.07.03
>            Reporter: Giulio Speri
>            Assignee: Nicolas Malin
>            Priority: Critical
>         Attachments: NoSuchElementException_Productgroovy.jpeg
>
>
> Strange issue happens randomly (it seems) while loading ecommerce product detail page and the groovy script Product.groovy (order/webapp/ordermgr/WEB-INF/actions/entry/catalog/) is run.
> The groovy script is loaded in the screen "product".
> The error showed is kind of java.util.NoSuchElementException and I think that could be something related to session/request attributes, since this could be avoided with an incognito navigation session.
> I saw this error a couple of times during local development also and I could pass over it by manually deleting browser session cookies.
> Unfortunately I was not able to reproduce it yet, so I cannot add more details except hypothesis.
> I also post here a screenshot of the error.
>  
> !NoSuchElementException_Productgroovy.jpeg!  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)