[OFBiz] SVN: r6471 - trunk/framework/service/src/org/ofbiz/service

jonesde@svn.ofbiz.org jonesde at svn.ofbiz.org
Fri Jan 6 03:12:09 CST 2006


Author: jonesde
Date: 2006-01-06 03:12:06 -0600 (Fri, 06 Jan 2006)
New Revision: 6471

Modified:
   trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java
Log:
Small change to the purgeOldJobs service method to also remove related RuntimeData; done in separate try/catch for the rare case where the RuntimeData record is referred to by other entities

Modified: trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java
===================================================================
--- trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java	2006-01-05 13:36:35 UTC (rev 6470)
+++ trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java	2006-01-06 09:12:06 UTC (rev 6471)
@@ -361,12 +361,18 @@
         if (foundJobs != null && foundJobs.size() > 0) {
             Iterator i = foundJobs.iterator();
             while (i.hasNext()) {
-                GenericValue job = (GenericValue) i.next();
+                GenericValue jobSandbox = (GenericValue) i.next();
                 try {
-                    job.remove();
+                    jobSandbox.remove();
                 } catch (GenericEntityException e) {
-                    Debug.logError(e, "Unable to remove job : " + job, module);
+                    Debug.logError(e, "Unable to remove job : " + jobSandbox + "; " + e.toString(), module);
                 }
+                try {
+                    // in a separate try/catch because other entities like ApplicationSandbox and WorkEffort can point to the same record, though it pretty much doesn't happen
+                    jobSandbox.removeRelated("RuntimeData");
+                } catch (GenericEntityException e) {
+                    Debug.logWarning(e, "When remove job unable to remove related RuntimeData for JobSandbox: " + jobSandbox + "; " + e.toString(), module);
+                }
             }
         }
 



More information about the Svn mailing list