UtilValidate.isEmpty(Object) calls ObjectType.isEmpty(Object) - which performs a series of instanceof checks. Calling UtilValidate.isEmpty(String) avoids the expensive instanceof checks.

-Adrian

On 8/5/2012 12:58 PM, Jacques Le Roux wrote:
Hi Adrian,

Your comment does not seem to fit with your change

Jacques

From: <adri...@apache.org>
Author: adrianc
Date: Sat Aug  4 22:07:18 2012
New Revision: 1369486

URL: http://svn.apache.org/viewvc?rev=1369486&view=rev
Log:
Fixed a costly call to UtilValidate.

Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java?rev=1369486&r1=1369485&r2=1369486&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java Sat Aug 4 22:07:18 2012
@@ -284,7 +284,7 @@ public class PersistedServiceJob extends
            }

            // check the runAsUser
-            if (!UtilValidate.isEmpty(jobObj.get("runAsUser"))) {
+            if (!UtilValidate.isEmpty(jobObj.getString("runAsUser"))) {
context.put("userLogin", ServiceUtil.getUserLogin(dctx, context, jobObj.getString("runAsUser")));
            }
        } catch (GenericEntityException e) {



Reply via email to