You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2022/12/05 11:35:31 UTC

[ofbiz-framework] branch release22.01 updated (37f3e39b05 -> 35840f9702)

This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a change to branch release22.01
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


    from 37f3e39b05 Fixed: Update version of GitHub Action setup-java (OFBIZ-12714) (#567)
     new fa7c970412 Fixed: EntityListIterator closed but not in case of exception (OFBIZ-9385)
     new 35840f9702 Fixed: EntityListIterator closed but not in case of exception (OFBIZ-9385)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java | 1 -
 .../src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java   | 7 ++-----
 2 files changed, 2 insertions(+), 6 deletions(-)


[ofbiz-framework] 01/02: Fixed: EntityListIterator closed but not in case of exception (OFBIZ-9385)

Posted by jl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release22.01
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit fa7c9704121e6198af9faf80de28540066a03651
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Mon Dec 5 11:17:04 2022 +0100

    Fixed: EntityListIterator closed but not in case of exception (OFBIZ-9385)
    
    Following discussion
    https://lists.apache.org/thread/37vo721s7d5no0k73ym4959m8wtgtl95
    reverts "This fixes a bug introduced with r1797097"
    commit d9a24d5a347e28f241e73af9c4d9ea4bb55aeb16.
    Conflicts handled by hand in ListFinder.java
    
    Also as suggested by Deepak Dixit removes explicit eli.close call from
    handleOutput(), else we will get unnecessary console warning from
    EntityListIterator.close() method:
      Debug.logWarning("This EntityListIterator for Entity [" +
      modelEntityName + "] has already been closed, not closing again.",
      module);
    
    Thanks: Deepak Dixit for spotting the issue and discussion
---
 .../main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java  | 1 -
 .../src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java    | 6 +-----
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java
index 121ad09e1a..79f7727b96 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java
@@ -394,7 +394,6 @@ public final class EntityFinderUtil {
             int size = getSize(context);
             try {
                 listAcsr.put(context, eli.getPartialList(start, size));
-                eli.close();
             } catch (GenericEntityException e) {
                 String errMsg = "Error getting partial list in limit-range with start=" + start + " and size=" + size + ": " + e.toString();
                 Debug.logError(e, errMsg, MODULE);
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java
index f869aae029..cdac10b318 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java
@@ -215,15 +215,11 @@ public abstract class ListFinder extends Finder {
                     options.setMaxRows(size * (index + 1));
                 }
                 boolean beganTransaction = false;
-                try {
+                try (EntityListIterator eli = delegator.find(entityName, whereEntityCondition, havingEntityCondition, fieldsToSelect, orderByFields, options)) {
                     if (useTransaction) {
                         beganTransaction = TransactionUtil.begin();
                     }
-                    EntityListIterator eli = delegator.find(entityName, whereEntityCondition, havingEntityCondition, fieldsToSelect, orderByFields,
-                            options);
                     this.outputHandler.handleOutput(eli, context, listAcsr);
-                    // NOTE: the eli EntityListIterator is not closed here. It SHOULD be closed later after the returned list will be used (eg see
-                    // EntityAnd.getChildren() in ModelTree.java)
                 } catch (GenericEntityException e) {
                     String errMsg = "Failure in by " + label + " find operation, rolling back transaction";
                     Debug.logError(e, errMsg, MODULE);


[ofbiz-framework] 02/02: Fixed: EntityListIterator closed but not in case of exception (OFBIZ-9385)

Posted by jl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release22.01
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 35840f97026739e2167a09de7b1e64916f4bcadf
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Mon Dec 5 11:17:04 2022 +0100

    Fixed: EntityListIterator closed but not in case of exception (OFBIZ-9385)
    
    Following discussion
    https://lists.apache.org/thread/37vo721s7d5no0k73ym4959m8wtgtl95
    reverts "This fixes a bug introduced with r1797097"
    commit d9a24d5a347e28f241e73af9c4d9ea4bb55aeb16.
    Conflicts handled by hand in ListFinder.java
    
    Also as suggested by Deepak Dixit removes explicit eli.close call from
    handleOutput(), else we will get unnecessary console warning from
    EntityListIterator.close() method:
      Debug.logWarning("This EntityListIterator for Entity [" +
      modelEntityName + "] has already been closed, not closing again.",
      module);
    
    Thanks: Deepak Dixit for spotting the issue and discussion
---
 .../src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java
index cdac10b318..c9ea06705d 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/ListFinder.java
@@ -215,7 +215,8 @@ public abstract class ListFinder extends Finder {
                     options.setMaxRows(size * (index + 1));
                 }
                 boolean beganTransaction = false;
-                try (EntityListIterator eli = delegator.find(entityName, whereEntityCondition, havingEntityCondition, fieldsToSelect, orderByFields, options)) {
+                try (EntityListIterator eli = delegator.find(entityName, whereEntityCondition, havingEntityCondition, fieldsToSelect, orderByFields,
+                        options)) {
                     if (useTransaction) {
                         beganTransaction = TransactionUtil.begin();
                     }