Right, I also removed a superfluous eli null check, already checked at the 
beginning of the block

Jacques

From: "Scott Gray" <[email protected]>
On 12/05/2012, at 10:34 PM, [email protected] wrote:

Author: jleroux
Date: Sat May 12 10:34:00 2012
New Revision: 1337502

URL: http://svn.apache.org/viewvc?rev=1337502&view=rev
Log:
Noted this in trunk demo log

2012-05-04 23:43:12,687 (Finalizer) [       SQLProcessor.java:836:ERROR]
---- runtime exception report --------------------------------------------------
Error closing the result, connection, etc in finalize SQLProcessor
Exception: java.lang.NullPointerException
Message: null
---- stack trace ---------------------------------------------------------------
java.lang.NullPointerException
org.apache.commons.dbcp.managed.ManagedConnection.close(ManagedConnection.java:147)
org.ofbiz.entity.jdbc.SQLProcessor.close(SQLProcessor.java:225)
org.ofbiz.entity.jdbc.SQLProcessor.finalize(SQLProcessor.java:834)
java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
java.lang.ref.Finalizer.access$100(Finalizer.java:14)
java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)
--------------------------------------------------------------------------------

2012-05-04 23:43:12,687 (Finalizer) [ EntityListIterator.java:543:ERROR]
====================================================================
EntityListIterator Not Closed for Entity [WorkEffortAndPartyAssign], caught in 
Finalize
====================================================================

This commit will fix it

I have "organize import" set when saving. So you might notice no commented 
changes here and then

Modified:
   
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java

Modified: 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=1337502&r1=1337501&r2=1337502&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
 (original)
+++ 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
 Sat May 12 10:34:00 2012
@@ -20,7 +20,6 @@
package org.ofbiz.workeffort.workeffort;

import java.sql.Timestamp;
-import com.ibm.icu.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.List;
@@ -62,6 +61,8 @@ import org.ofbiz.service.ServiceUtil;
import org.ofbiz.service.calendar.TemporalExpression;
import org.ofbiz.service.calendar.TemporalExpressionWorker;

+import com.ibm.icu.util.Calendar;
+
/**
 * WorkEffortServices - WorkEffort related Services
 */
@@ -1146,6 +1147,14 @@ public class WorkEffortServices {
                eli.close();

This above line shouldn't be there if you also have it in the finally block

            } catch (Exception e) {
                Debug.logError(e, "Error while closing EntityListIterator: ", 
module);
+            } finally {
+                if (eli != null) {
+                    try {
+                        eli.close();
+                    } catch (GenericEntityException e) {
+                        Debug.logWarning(e, module);
+                    }
+                }
            }
        } else {
            List<GenericValue> workEfforts = 
UtilGenerics.checkList(context.get("workEfforts"));




Reply via email to