svn commit: r1862227 - /ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java

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

svn commit: r1862227 - /ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java

mthl
Author: mthl
Date: Thu Jun 27 14:35:11 2019
New Revision: 1862227

URL: http://svn.apache.org/viewvc?rev=1862227&view=rev
Log:
Explain how the previous item is handled when rendering form

Additionally avoid useless ‘Map#putAll’ invokation.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java

Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java?rev=1862227&r1=1862226&r2=1862227&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/FormRenderer.java Thu Jun 27 14:35:11 2019
@@ -734,6 +734,7 @@ public class FormRenderer {
             int itemIndex = -1;
             Object item = null;
             context.put("wholeFormContext", context);
+            // Initialize previousItem with a sentry value since the first Item has no previous Item.
             Map<String, Object> previousItem = new HashMap<>();
             while ((item = safeNext(iter)) != null) {
                 itemIndex++;
@@ -763,8 +764,7 @@ public class FormRenderer {
 
                 localContext.push();
                 localContext.put("previousItem", previousItem);
-                previousItem = new HashMap<>();
-                previousItem.putAll(itemMap);
+                previousItem = new HashMap<>(itemMap);
 
                 AbstractModelAction.runSubActions(modelForm.getRowActions(), localContext);