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 2016/06/12 10:43:59 UTC
svn commit: r1747976 - in /ofbiz/trunk:
applications/accounting/src/org/ofbiz/accounting/payment/
applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/
applications/order/src/org/ofbiz/order/shoppingcart/
applications/party/src/o...
Author: jleroux
Date: Sun Jun 12 10:43:58 2016
New Revision: 1747976
URL: http://svn.apache.org/viewvc?rev=1747976&view=rev
Log:
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)
Modified:
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/splash/SplashScreen.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java
ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java
ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java
ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java
ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java
Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java?rev=1747976&r1=1747975&r2=1747976&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java Sun Jun 12 10:43:58 2016
@@ -93,7 +93,7 @@ public class PaymentWorker {
if (request.getAttribute("_ERROR_MESSAGE_") != null) tryEntity = false;
String donePage = request.getParameter("DONE_PAGE");
- if (donePage == null || donePage.length() <= 0)
+ if (UtilValidate.isEmpty(donePage))
donePage = "viewprofile";
results.put("donePage", donePage);
Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java?rev=1747976&r1=1747975&r2=1747976&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java Sun Jun 12 10:43:58 2016
@@ -395,7 +395,7 @@ public class AIMPaymentServices {
Debug.logInfo("The password property in " + configStr + " is not configured.", module);
}
if ("3.1".equals(ver)) {
- if (tranKey == null || tranKey.length() <= 0) {
+ if (UtilValidate.isEmpty(tranKey)) {
Debug.logInfo("Trankey property required for version 3.1 reverting to 3.0",module);
ver = "3.0";
}
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java?rev=1747976&r1=1747975&r2=1747976&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java Sun Jun 12 10:43:58 2016
@@ -282,7 +282,7 @@ public class ShoppingCartHelper {
Map<String, Object> result;
String errMsg = null;
- if (orderId == null || orderId.length() <= 0) {
+ if (UtilValidate.isEmpty(orderId)) {
errMsg = UtilProperties.getMessage(resource_error,"cart.order_not_specified_to_add_from", this.cart.getLocale());
result = ServiceUtil.returnError(errMsg);
return result;
@@ -583,7 +583,7 @@ public class ShoppingCartHelper {
Map<String, Object> result = null;
String errMsg = null;
- if (categoryId == null || categoryId.length() <= 0) {
+ if (UtilValidate.isEmpty(categoryId)) {
errMsg = UtilProperties.getMessage(resource_error,"cart.category_not_specified_to_add_from", this.cart.getLocale());
result = ServiceUtil.returnError(errMsg);
return result;
Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java?rev=1747976&r1=1747975&r2=1747976&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java Sun Jun 12 10:43:58 2016
@@ -319,7 +319,7 @@ public class ContactMechWorker {
String donePage = request.getParameter("DONE_PAGE");
if (donePage == null) donePage = (String) request.getAttribute("DONE_PAGE");
- if (donePage == null || donePage.length() <= 0) donePage = "viewprofile";
+ if (UtilValidate.isEmpty(donePage)) donePage = "viewprofile";
target.put("donePage", donePage);
String contactMechTypeId = request.getParameter("preContactMechTypeId");
@@ -544,7 +544,7 @@ public class ContactMechWorker {
String donePage = request.getParameter("DONE_PAGE");
if (donePage == null) donePage = (String) request.getAttribute("DONE_PAGE");
- if (donePage == null || donePage.length() <= 0) donePage = "viewprofile";
+ if (UtilValidate.isEmpty(donePage)) donePage = "viewprofile";
target.put("donePage", donePage);
String contactMechTypeId = request.getParameter("preContactMechTypeId");
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java?rev=1747976&r1=1747975&r2=1747976&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java Sun Jun 12 10:43:58 2016
@@ -212,7 +212,7 @@ public class CatalogWorker {
}
public static String getCatalogName(ServletRequest request, String prodCatalogId) {
- if (prodCatalogId == null || prodCatalogId.length() <= 0) return null;
+ if (UtilValidate.isEmpty(prodCatalogId)) return null;
Delegator delegator = (Delegator) request.getAttribute("delegator");
try {
@@ -251,7 +251,7 @@ public class CatalogWorker {
}
public static GenericValue getProdCatalog(ServletRequest request, String prodCatalogId) {
- if (prodCatalogId == null || prodCatalogId.length() <= 0) return null;
+ if (UtilValidate.isEmpty(prodCatalogId)) return null;
Delegator delegator = (Delegator) request.getAttribute("delegator");
try {
@@ -267,7 +267,7 @@ public class CatalogWorker {
}
public static String getCatalogTopCategoryId(ServletRequest request, String prodCatalogId) {
- if (prodCatalogId == null || prodCatalogId.length() <= 0) return null;
+ if (UtilValidate.isEmpty(prodCatalogId)) return null;
List<GenericValue> prodCatalogCategories = getProdCatalogCategories(request, prodCatalogId, "PCCT_BROWSE_ROOT");
@@ -288,7 +288,7 @@ public class CatalogWorker {
return getCatalogSearchCategoryId((Delegator) request.getAttribute("delegator"), prodCatalogId);
}
public static String getCatalogSearchCategoryId(Delegator delegator, String prodCatalogId) {
- if (prodCatalogId == null || prodCatalogId.length() <= 0) return null;
+ if (UtilValidate.isEmpty(prodCatalogId)) return null;
List<GenericValue> prodCatalogCategories = getProdCatalogCategories(delegator, prodCatalogId, "PCCT_SEARCH");
if (UtilValidate.isNotEmpty(prodCatalogCategories)) {
@@ -300,7 +300,7 @@ public class CatalogWorker {
}
public static String getCatalogViewAllowCategoryId(Delegator delegator, String prodCatalogId) {
- if (prodCatalogId == null || prodCatalogId.length() <= 0) return null;
+ if (UtilValidate.isEmpty(prodCatalogId)) return null;
List<GenericValue> prodCatalogCategories = getProdCatalogCategories(delegator, prodCatalogId, "PCCT_VIEW_ALLW");
if (UtilValidate.isNotEmpty(prodCatalogCategories)) {
@@ -312,7 +312,7 @@ public class CatalogWorker {
}
public static String getCatalogPurchaseAllowCategoryId(Delegator delegator, String prodCatalogId) {
- if (prodCatalogId == null || prodCatalogId.length() <= 0) return null;
+ if (UtilValidate.isEmpty(prodCatalogId)) return null;
List<GenericValue> prodCatalogCategories = getProdCatalogCategories(delegator, prodCatalogId, "PCCT_PURCH_ALLW");
if (UtilValidate.isNotEmpty(prodCatalogCategories)) {
@@ -328,7 +328,7 @@ public class CatalogWorker {
}
public static String getCatalogPromotionsCategoryId(ServletRequest request, String prodCatalogId) {
- if (prodCatalogId == null || prodCatalogId.length() <= 0) return null;
+ if (UtilValidate.isEmpty(prodCatalogId)) return null;
List<GenericValue> prodCatalogCategories = getProdCatalogCategories(request, prodCatalogId, "PCCT_PROMOTIONS");
@@ -346,7 +346,7 @@ public class CatalogWorker {
}
public static boolean getCatalogQuickaddUse(ServletRequest request, String prodCatalogId) {
- if (prodCatalogId == null || prodCatalogId.length() <= 0) return false;
+ if (UtilValidate.isEmpty(prodCatalogId)) return false;
Delegator delegator = (Delegator) request.getAttribute("delegator");
try {
@@ -366,7 +366,7 @@ public class CatalogWorker {
}
public static String getCatalogQuickaddCategoryPrimary(ServletRequest request, String prodCatalogId) {
- if (prodCatalogId == null || prodCatalogId.length() <= 0) return null;
+ if (UtilValidate.isEmpty(prodCatalogId)) return null;
List<GenericValue> prodCatalogCategories = getProdCatalogCategories(request, prodCatalogId, "PCCT_QUICK_ADD");
@@ -384,7 +384,7 @@ public class CatalogWorker {
}
public static Collection<String> getCatalogQuickaddCategories(ServletRequest request, String prodCatalogId) {
- if (prodCatalogId == null || prodCatalogId.length() <= 0) return null;
+ if (UtilValidate.isEmpty(prodCatalogId)) return null;
Collection<String> categoryIds = new LinkedList<String>();
@@ -400,7 +400,7 @@ public class CatalogWorker {
}
public static String getCatalogTopEbayCategoryId(ServletRequest request, String prodCatalogId) {
- if (prodCatalogId == null || prodCatalogId.length() <= 0) return null;
+ if (UtilValidate.isEmpty(prodCatalogId)) return null;
List<GenericValue> prodCatalogCategories = getProdCatalogCategories(request, prodCatalogId, "PCCT_EBAY_ROOT");
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=1747976&r1=1747975&r2=1747976&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java Sun Jun 12 10:43:58 2016
@@ -209,7 +209,7 @@ public class ProductEvents {
String updateMode = request.getParameter("UPDATE_MODE");
- if (updateMode == null || updateMode.length() <= 0) {
+ if (UtilValidate.isEmpty(updateMode)) {
errMsg = UtilProperties.getMessage(resource,"productevents.updatemode_not_specified", UtilHttp.getLocale(request));
request.setAttribute("_ERROR_MESSAGE_", errMsg);
Debug.logWarning("[ProductEvents.updateProductAssoc] Update Mode was not specified, but is required", module);
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/splash/SplashScreen.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/splash/SplashScreen.java?rev=1747976&r1=1747975&r2=1747976&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/splash/SplashScreen.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/splash/SplashScreen.java Sun Jun 12 10:43:58 2016
@@ -27,6 +27,8 @@ import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
+import org.ofbiz.base.util.UtilValidate;
+
@SuppressWarnings("serial")
public final class SplashScreen extends Frame {
@@ -36,7 +38,7 @@ public final class SplashScreen extends
private Image fImage;
public SplashScreen(String aImageId) {
- if (aImageId == null || aImageId.trim().length() == 0) {
+ if (UtilValidate.isEmpty(aImageId)) {
throw new IllegalArgumentException("Image Id does not have content.");
}
fImageId = aImageId;
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java?rev=1747976&r1=1747975&r2=1747976&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java Sun Jun 12 10:43:58 2016
@@ -263,8 +263,8 @@ public class UtilProperties implements S
* @return The value of the property in the properties file
*/
public static String getPropertyValue(String resource, String name) {
- if (resource == null || resource.length() <= 0) return "";
- if (name == null || name.length() <= 0) return "";
+ if (UtilValidate.isEmpty(resource)) return "";
+ if (UtilValidate.isEmpty(name)) return "";
Properties properties = getProperties(resource);
if (properties == null) {
@@ -322,7 +322,7 @@ public class UtilProperties implements S
* @return The properties file
*/
public static Properties getProperties(String resource) {
- if (resource == null || resource.length() <= 0) {
+ if (UtilValidate.isEmpty(resource)) {
return null;
}
URL url = resolvePropertiesUrl(resource, null);
@@ -393,7 +393,7 @@ public class UtilProperties implements S
public static String getPropertyValue(URL url, String name, String defaultValue) {
String value = getPropertyValue(url, name);
- if (value == null || value.length() <= 0)
+ if (UtilValidate.isEmpty(value))
return defaultValue;
else
return value;
@@ -423,7 +423,7 @@ public class UtilProperties implements S
*/
public static String getPropertyValue(URL url, String name) {
if (url == null) return "";
- if (name == null || name.length() <= 0) return "";
+ if (UtilValidate.isEmpty(name)) return "";
Properties properties = getProperties(url);
if (properties == null) {
@@ -450,7 +450,7 @@ public class UtilProperties implements S
*/
public static String getSplitPropertyValue(URL url, String name) {
if (url == null) return "";
- if (name == null || name.length() <= 0) return "";
+ if (UtilValidate.isEmpty(name)) return "";
Properties properties = getProperties(url);
@@ -482,8 +482,8 @@ public class UtilProperties implements S
* @param name The name of the property in the properties file
* @param value The value of the property in the properties file */
public static void setPropertyValue(String resource, String name, String value) {
- if (resource == null || resource.length() <= 0) return;
- if (name == null || name.length() <= 0) return;
+ if (UtilValidate.isEmpty(resource)) return;
+ if (UtilValidate.isEmpty(name)) return;
Properties properties = getProperties(resource);
if (properties == null) {
@@ -559,8 +559,8 @@ public class UtilProperties implements S
* @param name The name of the property in the resource
* @param value The value of the property to set in memory */
public static void setPropertyValueInMemory(String resource, String name, String value) {
- if (resource == null || resource.length() <= 0) return;
- if (name == null || name.length() <= 0) return;
+ if (UtilValidate.isEmpty(resource)) return;
+ if (UtilValidate.isEmpty(name)) return;
Properties properties = getProperties(resource);
if (properties == null) {
@@ -579,8 +579,8 @@ public class UtilProperties implements S
* @return The value of the property in the properties file
*/
public static String getMessage(String resource, String name, Locale locale) {
- if (resource == null || resource.length() <= 0) return "";
- if (name == null || name.length() <= 0) return "";
+ if (UtilValidate.isEmpty(resource)) return "";
+ if (UtilValidate.isEmpty(name)) return "";
ResourceBundle bundle = getResourceBundle(resource, locale);
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java?rev=1747976&r1=1747975&r2=1747976&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java Sun Jun 12 10:43:58 2016
@@ -108,9 +108,9 @@ public class LoginServices {
String visitId = (String) context.get("visitId");
String errMsg = "";
- if (username == null || username.length() <= 0) {
+ if (UtilValidate.isEmpty(username)) {
errMsg = UtilProperties.getMessage(resource,"loginservices.username_missing", locale);
- } else if (password == null || password.length() <= 0) {
+ } else if (UtilValidate.isEmpty(password)) {
errMsg = UtilProperties.getMessage(resource,"loginservices.password_missing", locale);
} else {
Modified: ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile.java?rev=1747976&r1=1747975&r2=1747976&view=diff
==============================================================================
--- ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile.java (original)
+++ ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile.java Sun Jun 12 10:43:58 2016
@@ -133,7 +133,7 @@ public class DataFile {
* @throws DataFileException Exception thown for various errors, generally has a nested exception
*/
public void readDataFile(String content) throws DataFileException {
- if (content == null || content.length() <= 0)
+ if (UtilValidate.isEmpty(content))
throw new IllegalStateException("Content is empty, can't read file");
ByteArrayInputStream bis = new ByteArrayInputStream(content.getBytes());
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=1747976&r1=1747975&r2=1747976&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Sun Jun 12 10:43:58 2016
@@ -568,7 +568,7 @@ public class GenericDelegator implements
@Override
public ModelFieldTypeReader getModelFieldTypeReader(ModelEntity entity) {
String helperName = getEntityHelperName(entity);
- if (helperName == null || helperName.length() <= 0) {
+ if (UtilValidate.isEmpty(helperName)) {
return null;
}
ModelFieldTypeReader modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperName);
@@ -585,7 +585,7 @@ public class GenericDelegator implements
public Collection<String> getEntityFieldTypeNames(ModelEntity entity) throws GenericEntityException {
String helperName = getEntityHelperName(entity);
- if (helperName == null || helperName.length() <= 0) {
+ if (UtilValidate.isEmpty(helperName)) {
return null;
}
ModelFieldTypeReader modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperName);
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java?rev=1747976&r1=1747975&r2=1747976&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java Sun Jun 12 10:43:58 2016
@@ -220,7 +220,7 @@ public class ModelGroupReader implements
Map<String, String> gc = getGroupCache(delegatorBaseName);
Set<String> enames = new HashSet<String>();
- if (groupName == null || groupName.length() <= 0) return enames;
+ if (UtilValidate.isEmpty(groupName)) return enames;
if (UtilValidate.isEmpty(gc)) return enames;
for (Map.Entry<String, String> entry: gc.entrySet()) {
if (groupName.equals(entry.getValue())) enames.add(entry.getKey());
Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java?rev=1747976&r1=1747975&r2=1747976&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java Sun Jun 12 10:43:58 2016
@@ -395,7 +395,7 @@ public class ContextFilter implements Fi
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);
Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java?rev=1747976&r1=1747975&r2=1747976&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java Sun Jun 12 10:43:58 2016
@@ -62,7 +62,7 @@ public class GenericWebEvent {
String entityName = request.getParameter("entityName");
Locale locale = UtilHttp.getLocale(request);
- if (entityName == null || entityName.length() <= 0) {
+ if (UtilValidate.isEmpty(entityName)) {
String errMsg = UtilProperties.getMessage(GenericWebEvent.err_resource, "genericWebEvent.entity_name_not_specified", locale) + ".";
request.setAttribute("_ERROR_MESSAGE_", errMsg);
Debug.logWarning("[GenericWebEvent.updateGeneric] The entityName was not specified, but is required.", module);
@@ -96,7 +96,7 @@ public class GenericWebEvent {
String updateMode = request.getParameter("UPDATE_MODE");
- if (updateMode == null || updateMode.length() <= 0) {
+ if (UtilValidate.isEmpty(updateMode)) {
String errMsg = UtilProperties.getMessage(GenericWebEvent.err_resource, "genericWebEvent.update_mode_not_specified", locale) + ".";
request.setAttribute("_ERROR_MESSAGE_", errMsg);
Debug.logWarning("[updateGeneric] Update Mode was not specified, but is required; entityName: " + entityName, module);
Modified: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java?rev=1747976&r1=1747975&r2=1747976&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java (original)
+++ ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java Sun Jun 12 10:43:58 2016
@@ -586,7 +586,7 @@ public class OFBizSolrContextFilter exte
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);