From cda0fa5c3d96ec13c0bb46ebb7cd77d6469faf27 Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Sun, 12 Jun 2016 10:43:58 +0000 Subject: [PATCH] No functional changes. While reviewing Wai's patch for OFBIZ-7112 I noticed that he (re)used this pattern introduced earlier: (resource == null || resource.length() <= 0) From Java spec. a String, Collection, Map or CharSequence can't have a negative length, so the pattern above can be reduced to (resource == null || resource.length() == 0) which can be replaced using UtilValidate.isEmpty() I checked, there are several other occurrences of this pattern (some very old, I guess most were routinely copied from an initial occurrence). I decided to replace all of them, here they are. I did that already long ago for the (resource == null || resource.length() == 0) pattern. It remains 4 of them. Three are justified (because of the dependency on base component or because using isEmpty() on Object is disputable for performance reasons). I took care of the remaining one right aways (in SplashScreen.java) git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk/specialpurpose@1747976 13f79535-47bb-0310-9956-ffa450edef68 --- solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java b/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java index d509bc736..c238dbe5e 100644 --- a/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java +++ b/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java @@ -586,7 +586,7 @@ public class OFBizSolrContextFilter extends SolrDispatchFilter { if (delegator == null) { String delegatorName = servletContext.getInitParameter("entityDelegatorName"); - if (delegatorName == null || delegatorName.length() <= 0) { + if (UtilValidate.isEmpty(delegatorName)) { delegatorName = "default"; } if (Debug.verboseOn()) Debug.logVerbose("Setup Entity Engine Delegator with name " + delegatorName, module);