Author: jleroux
Date: Mon Nov 23 21:42:18 2009 New Revision: 883507 URL: http://svn.apache.org/viewvc?rev=883507&view=rev Log: Use UtilValidate.isEmpty methods instead of (obj == null) || (obj.length == 0) Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java ofbiz/trunk/framework/base/src/org/ofbiz/base/container/BeanShellContainer.java ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/DateTimeConverters.java ofbiz/trunk/framework/base/src/org/ofbiz/base/location/FlexibleLocation.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleServletAccessor.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ContextAccessor.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/AddError.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallService.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMethod.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CheckErrors.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/Return.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/WebappPropertyToField.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckId.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPermission.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/BaseCompare.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Convert.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Copy.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/PropertyOper.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapOperation.java ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsListenerFactory.java ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/InputValue.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/FormatTag.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/DataVisionViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/HttpViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsJXlsViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPdfViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPoiXlsViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsXmlViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JspViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/RegionViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/VelocityViewHandler.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ViewFactory.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/WfsViewHandler.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/container/SharkContainer.java ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/ServiceCondition.java ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfActivityImpl.java ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/impl/WfExecutionObjectImpl.java Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Mon Nov 23 21:42:18 2009 @@ -355,7 +355,7 @@ GenericValue paymentSettings = getPaymentSettings(orh.getOrderHeader(), paymentPref, AUTH_SERVICE_TYPE, false); if (paymentSettings != null) { paymentConfig = paymentSettings.getString("paymentPropertiesPath"); - if (paymentConfig == null || paymentConfig.length() == 0) { + if (UtilValidate.isEmpty(paymentConfig)) { paymentConfig = "payment.properties"; } } @@ -908,7 +908,7 @@ Debug.logWarning(errMsg, module); return ServiceUtil.returnError(errMsg); } - if (paymentConfig == null || paymentConfig.length() == 0) { + if (UtilValidate.isEmpty(paymentConfig)) { paymentConfig = "payment.properties"; } GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(paymentPref); @@ -1611,7 +1611,7 @@ return null; } - if (paymentConfig == null || paymentConfig.length() == 0) { + if (UtilValidate.isEmpty(paymentConfig)) { paymentConfig = "payment.properties"; } 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=883507&r1=883506&r2=883507&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 Mon Nov 23 21:42:18 2009 @@ -296,7 +296,7 @@ private static Map<String, Object> processCard(Map<String, Object> request, Properties props) { Map<String, Object> result = FastMap.newInstance(); String url = props.getProperty("url"); - if (url == null || url.length() == 0) { + if (UtilValidate.isEmpty(url)) { return ServiceUtil.returnFailure("No payment.authorizedotnet.url found."); } if (isTestMode()) { @@ -354,13 +354,13 @@ String login = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "userId", configStr, "payment.authorizedotnet.login"); String password = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "pwd", configStr, "payment.authorizedotnet.password"); String transDescription = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "transDescription", configStr, "payment.authorizedotnet.transdescription"); - if (ver == null || ver.length() == 0) { + if (UtilValidate.isEmpty(ver)) { ver = "3.0"; } - if (login == null || login.length() == 0) { + if (UtilValidate.isEmpty(login)) { Debug.logInfo("the login property in " + configStr + " is not configured.", module); } - if ((password == null || password.length() == 0) && !("3.1".equals(ver))) { + if (UtilValidate.isEmpty((password)) && !("3.1".equals(ver))) { Debug.logInfo("The password property in " + configStr + " is not configured.", module); } if ("3.1".equals(ver)) { Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java Mon Nov 23 21:42:18 2009 @@ -140,7 +140,7 @@ // see if we passed in the DES hex string String desHexString = (String) context.get("desHexString"); - if (desHexString == null || desHexString.length() == 0) { + if (UtilValidate.isEmpty(desHexString)) { mwk = vl.generateMwk(); } else { mwk = vl.generateMwk(StringUtil.fromHexString(desHexString)); @@ -1062,7 +1062,7 @@ // get the VL promo code String promoCode = typeFeature.getString("idCode"); - if (promoCode == null || promoCode.length() == 0) { + if (UtilValidate.isEmpty(promoCode)) { return ServiceUtil.returnError("Invalid promo code set on idCode field of feature type TYPE"); } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Mon Nov 23 21:42:18 2009 @@ -1534,7 +1534,7 @@ } String userLoginId = request.getParameter("userLoginId"); if (partyId != null || userLoginId != null) { - if ((partyId == null || partyId.length() == 0) && userLoginId != null && userLoginId.length() > 0) { + if (UtilValidate.isEmpty((partyId)) && userLoginId != null && userLoginId.length() > 0) { GenericValue thisUserLogin = null; try { thisUserLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", userLoginId)); Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java (original) +++ ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java Mon Nov 23 21:42:18 2009 @@ -117,7 +117,7 @@ } // partyId might be empty, so check it and get next seq party id if empty - if (partyId == null || partyId.length() == 0) { + if (UtilValidate.isEmpty(partyId)) { try { partyId = delegator.getNextSeqId("Party"); } catch (IllegalArgumentException e) { @@ -339,7 +339,7 @@ String errMsg = null; // partyId might be empty, so check it and get next seq party id if empty - if (partyId == null || partyId.length() == 0) { + if (UtilValidate.isEmpty(partyId)) { try { partyId = delegator.getNextSeqId("Party"); } catch (IllegalArgumentException e) { @@ -517,7 +517,7 @@ } // partyId might be empty, so check it and get next seq party id if empty - if (partyId == null || partyId.length() == 0) { + if (UtilValidate.isEmpty(partyId)) { try { partyId = delegator.getNextSeqId("Party"); } catch (IllegalArgumentException e) { @@ -665,7 +665,7 @@ noteId = (String) noteRes.get("noteId"); - if (noteId == null || noteId.length() == 0) { + if (UtilValidate.isEmpty(noteId)) { errMsg = UtilProperties.getMessage(resource,"partyservices.problem_creating_note_no_noteId_returned", locale); return ServiceUtil.returnError(errMsg); } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/container/BeanShellContainer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/container/BeanShellContainer.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/container/BeanShellContainer.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/container/BeanShellContainer.java Mon Nov 23 21:42:18 2009 @@ -22,6 +22,7 @@ import bsh.EvalError; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; /** * BeanShellContainer - Container implementation for BeanShell @@ -52,7 +53,7 @@ // get the app-name ContainerConfig.Container.Property appName = cfg.getProperty("app-name"); - if (appName == null || appName.value == null || appName.value.length() == 0) { + if (appName == null || UtilValidate.isEmpty(appName.value)) { throw new ContainerException("Invalid app-name defined in container configuration"); } else { this.name = appName.value; @@ -60,7 +61,7 @@ // get the telnet-port ContainerConfig.Container.Property telnetPort = cfg.getProperty("telnet-port"); - if (telnetPort == null || telnetPort.value == null || telnetPort.value.length() == 0) { + if (telnetPort == null || UtilValidate.isEmpty(telnetPort.value)) { throw new ContainerException("Invalid telnet-port defined in container configuration"); } else { try { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/DateTimeConverters.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/DateTimeConverters.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/DateTimeConverters.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/DateTimeConverters.java Mon Nov 23 21:42:18 2009 @@ -25,6 +25,7 @@ import org.ofbiz.base.util.TimeDuration; import org.ofbiz.base.util.UtilDateTime; +import org.ofbiz.base.util.UtilValidate; import com.ibm.icu.util.Calendar; @@ -80,7 +81,7 @@ public String convert(java.util.Date obj, Locale locale, TimeZone timeZone, String formatString) throws ConversionException { DateFormat df = null; - if (formatString == null || formatString.length() == 0) { + if (UtilValidate.isEmpty(formatString)) { df = UtilDateTime.toDateTimeFormat(UtilDateTime.DATE_TIME_FORMAT, timeZone, locale); } else { df = UtilDateTime.toDateTimeFormat(formatString, timeZone, locale); @@ -228,7 +229,7 @@ public String convert(java.sql.Date obj, Locale locale, TimeZone timeZone, String formatString) throws ConversionException { DateFormat df = null; - if (formatString == null || formatString.length() == 0) { + if (UtilValidate.isEmpty(formatString)) { df = UtilDateTime.toDateFormat(UtilDateTime.DATE_FORMAT, timeZone, locale); } else { df = UtilDateTime.toDateFormat(formatString, timeZone, locale); @@ -254,7 +255,7 @@ public String convert(java.sql.Time obj, Locale locale, TimeZone timeZone, String formatString) throws ConversionException { DateFormat df = null; - if (formatString == null || formatString.length() == 0) { + if (UtilValidate.isEmpty(formatString)) { df = UtilDateTime.toTimeFormat(UtilDateTime.TIME_FORMAT, timeZone, locale); } else { df = UtilDateTime.toTimeFormat(formatString, timeZone, locale); @@ -282,7 +283,7 @@ return null; } DateFormat df = null; - if (formatString == null || formatString.length() == 0) { + if (UtilValidate.isEmpty(formatString)) { df = UtilDateTime.toDateTimeFormat(UtilDateTime.DATE_TIME_FORMAT, timeZone, locale); } else { df = UtilDateTime.toDateTimeFormat(formatString, timeZone, locale); @@ -307,7 +308,7 @@ return null; } DateFormat df = null; - if (formatString == null || formatString.length() == 0) { + if (UtilValidate.isEmpty(formatString)) { df = UtilDateTime.toDateTimeFormat(UtilDateTime.DATE_TIME_FORMAT, timeZone, locale); } else { df = UtilDateTime.toDateTimeFormat(formatString, timeZone, locale); @@ -341,7 +342,7 @@ return null; } DateFormat df = null; - if (formatString == null || formatString.length() == 0) { + if (UtilValidate.isEmpty(formatString)) { df = UtilDateTime.toDateFormat(UtilDateTime.DATE_FORMAT, timeZone, locale); } else { df = UtilDateTime.toDateFormat(formatString, timeZone, locale); @@ -365,7 +366,7 @@ return null; } DateFormat df = null; - if (formatString == null || formatString.length() == 0) { + if (UtilValidate.isEmpty(formatString)) { df = UtilDateTime.toTimeFormat(UtilDateTime.TIME_FORMAT, timeZone, locale); } else { df = UtilDateTime.toTimeFormat(formatString, timeZone, locale); @@ -389,7 +390,7 @@ return null; } DateFormat df = null; - if (formatString == null || formatString.length() == 0) { + if (UtilValidate.isEmpty(formatString)) { // These hacks are a bad idea, but they are included // for backward compatibility. if (str.length() > 0 && !str.contains(":")) { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/location/FlexibleLocation.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/location/FlexibleLocation.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/location/FlexibleLocation.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/location/FlexibleLocation.java Mon Nov 23 21:42:18 2009 @@ -25,6 +25,7 @@ import javolution.util.FastMap; import org.ofbiz.base.util.UtilProperties; +import org.ofbiz.base.util.UtilValidate; /** * A special location resolver that uses Strings like URLs, but with more options @@ -73,7 +74,7 @@ } public static URL resolveLocation(String location, ClassLoader loader) throws MalformedURLException { - if (location == null || location.length() == 0) { + if (UtilValidate.isEmpty(location)) { return null; } String locationType = getLocationType(location); @@ -84,12 +85,12 @@ resolver = locationResolvers.get(locationType); if (resolver == null) { String locationResolverName = UtilProperties.getPropertyValue("locationresolvers", locationType); - if (locationResolverName == null || locationResolverName.length() == 0) { + if (UtilValidate.isEmpty(locationResolverName)) { // try one of the defaults locationResolverName = defaultResolvers.get(locationType); } - if (locationResolverName == null || locationResolverName.length() == 0) { + if (UtilValidate.isEmpty(locationResolverName)) { // still nothing, give up throw new MalformedURLException("Could not find a LocationResolver class name for the location type: " + locationType); } @@ -141,7 +142,7 @@ * If no type descriptor is found, defaults to "classpath". */ public static String getLocationType(String location) { - if (location == null || location.length() == 0) { + if (UtilValidate.isEmpty(location)) { return null; } @@ -154,7 +155,7 @@ } public static String stripLocationType(String location) { - if (location == null || location.length() == 0) { + if (UtilValidate.isEmpty(location)) { return ""; } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java Mon Nov 23 21:42:18 2009 @@ -134,7 +134,7 @@ if (mainString == null) { return null; } - if (oldString == null || oldString.length() == 0) { + if (UtilValidate.isEmpty(oldString)) { return mainString; } if (newString == null) { @@ -387,7 +387,7 @@ /** Make sure the string starts with a forward slash but does not end with one; converts back-slashes to forward-slashes; if in String is null or empty, returns zero length string. */ public static String cleanUpPathPrefix(String prefix) { - if (prefix == null || prefix.length() == 0) return ""; + if (UtilValidate.isEmpty(prefix)) return ""; StringBuilder cppBuff = new StringBuilder(prefix.replace('\\', '/')); Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilHttp.java Mon Nov 23 21:42:18 2009 @@ -790,7 +790,7 @@ } public static String getRequestUriFromTarget(String target) { - if (target == null || target.length() == 0) return null; + if (UtilValidate.isEmpty(target)) return null; int endOfRequestUri = target.length(); if (target.indexOf('?') > 0) { endOfRequestUri = target.indexOf('?'); @@ -811,7 +811,7 @@ * @return The query string */ public static String getQueryStringFromTarget(String target) { - if (target == null || target.length() == 0) return ""; + if (UtilValidate.isEmpty(target)) return ""; int queryStart = target.indexOf('?'); if (queryStart != -1) { return target.substring(queryStart); @@ -825,7 +825,7 @@ * @return The request target string */ public static String removeQueryStringFromTarget(String target) { - if (target == null || target.length() == 0) return null; + if (UtilValidate.isEmpty(target)) return null; int queryStart = target.indexOf('?'); if (queryStart < 0) { return target; @@ -835,7 +835,7 @@ public static String getWebappMountPointFromTarget(String target) { int firstChar = 0; - if (target == null || target.length() == 0) return null; + if (UtilValidate.isEmpty(target)) return null; if (target.charAt(0) == '/') firstChar = 1; int pathSep = target.indexOf('/', 1); String webappMountPoint = null; @@ -1175,7 +1175,7 @@ */ public static Object makeParamValueFromComposite(HttpServletRequest request, String prefix, Locale locale) { String compositeType = request.getParameter(makeCompositeParam(prefix, "compositeType")); - if (compositeType == null || compositeType.length() == 0) return null; + if (UtilValidate.isEmpty(compositeType)) return null; // collect the composite fields into a map Map<String, String> data = FastMap.newInstance(); @@ -1201,9 +1201,9 @@ String minutes = data.get("minutes"); String ampm = data.get("ampm"); if (date == null || date.length() < 10) return null; - if (hour == null || hour.length() == 0) return null; - if (minutes == null || minutes.length() == 0) return null; - boolean isTwelveHour = ((ampm == null || ampm.length() == 0) ? false : true); + if (UtilValidate.isEmpty(hour)) return null; + if (UtilValidate.isEmpty(minutes)) return null; + boolean isTwelveHour = (UtilValidate.isEmpty((ampm)) ? false : true); // create the timestamp from the data try { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilMisc.java Mon Nov 23 21:42:18 2009 @@ -690,7 +690,7 @@ * @return Locale The new Locale object or null if no valid locale can be interpreted */ public static Locale parseLocale(String localeString) { - if (localeString == null || localeString.length() == 0) { + if (UtilValidate.isEmpty(localeString)) { return null; } 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=883507&r1=883506&r2=883507&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 Mon Nov 23 21:42:18 2009 @@ -114,7 +114,7 @@ public static String getPropertyValue(String resource, String name, String defaultValue) { String value = getPropertyValue(resource, name); - if (value == null || value.length() == 0) + if (UtilValidate.isEmpty(value)) return defaultValue; else return value; @@ -453,7 +453,7 @@ public static String getMessage(String resource, String name, Object[] arguments, Locale locale) { String value = getMessage(resource, name, locale); - if (value == null || value.length() == 0) { + if (UtilValidate.isEmpty(value)) { return ""; } else { if (arguments != null && arguments.length > 0) { @@ -474,7 +474,7 @@ public static <E> String getMessage(String resource, String name, List<E> arguments, Locale locale) { String value = getMessage(resource, name, locale); - if (value == null || value.length() == 0) { + if (UtilValidate.isEmpty(value)) { return ""; } else { if (UtilValidate.isNotEmpty(arguments)) { @@ -499,7 +499,7 @@ public static String getMessage(String resource, String name, Map<String, ? extends Object> context, Locale locale) { String value = getMessage(resource, name, locale); - if (value == null || value.length() == 0) { + if (UtilValidate.isEmpty(value)) { return ""; } else { if (UtilValidate.isNotEmpty(context)) { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java Mon Nov 23 21:42:18 2009 @@ -821,7 +821,7 @@ Element childElement = firstChildElement(element, childElementName); String elementValue = elementValue(childElement); - if (elementValue == null || elementValue.length() == 0) + if (UtilValidate.isEmpty(elementValue)) return defaultValue; else return elementValue; Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleServletAccessor.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleServletAccessor.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleServletAccessor.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleServletAccessor.java Mon Nov 23 21:42:18 2009 @@ -26,6 +26,7 @@ import javax.servlet.http.HttpSession; import org.ofbiz.base.util.UtilGenerics; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.string.FlexibleStringExpander; /** @@ -48,7 +49,7 @@ } public FlexibleServletAccessor(String name, String defaultName) { - if (name == null || name.length() == 0) { + if (UtilValidate.isEmpty(name)) { init(defaultName); } else { init(name); @@ -57,7 +58,7 @@ protected void init(String name) { this.name = name; - if (name == null || name.length() == 0) { + if (UtilValidate.isEmpty(name)) { empty = true; needsExpand = false; fma = FlexibleMapAccessor.getInstance(name); Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/FlexibleStringExpander.java Mon Nov 23 21:42:18 2009 @@ -143,7 +143,7 @@ * @return A FlexibleStringExpander instance */ public static FlexibleStringExpander getInstance(String original) { - if (original == null || original.length() == 0) { + if (UtilValidate.isEmpty(original)) { return nullExpr; } // Remove the next three lines to cache all expressions @@ -205,7 +205,7 @@ * @return a list of parsed string elements */ protected static List<StrElem> getStrElems(String original) { - if (original == null || original.length() == 0) { + if (UtilValidate.isEmpty(original)) { return null; } int origLen = original.length(); Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java Mon Nov 23 21:42:18 2009 @@ -114,7 +114,7 @@ * Returns a list of regional geo associations. */ public static List<GenericValue> getAssociatedStateList(Delegator delegator, String country) { - if (country == null || country.length() == 0) { + if (UtilValidate.isEmpty(country)) { // Load the system default country country = UtilProperties.getPropertyValue("general.properties", "country.geo.id.default"); } 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=883507&r1=883506&r2=883507&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 Mon Nov 23 21:42:18 2009 @@ -588,7 +588,7 @@ String userLoginId = (String) context.get("userLoginId"); String errMsg = null; - if (userLoginId == null || userLoginId.length() == 0) { + if (UtilValidate.isEmpty(userLoginId)) { userLoginId = loggedInUserLogin.getString("userLoginId"); } @@ -824,7 +824,7 @@ String userLoginId = (String) context.get("userLoginId"); String errMsg = null; - if (userLoginId == null || userLoginId.length() == 0) { + if (UtilValidate.isEmpty(userLoginId)) { userLoginId = loggedInUserLogin.getString("userLoginId"); } @@ -998,7 +998,7 @@ public static String getHashType() { String hashType = UtilProperties.getPropertyValue("security.properties", "password.encrypt.hash.type"); - if (hashType == null || hashType.length() == 0) { + if (UtilValidate.isEmpty(hashType)) { Debug.logWarning("Password encrypt hash type is not specified in security.properties, use SHA", module); hashType = "SHA"; } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/config/DatasourceInfo.java Mon Nov 23 21:42:18 2009 @@ -21,6 +21,7 @@ import java.util.List; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.w3c.dom.Element; @@ -159,8 +160,8 @@ this.characterSet = datasourceElement.getAttribute("character-set"); this.collate = datasourceElement.getAttribute("collate"); } - if (this.fkStyle == null || this.fkStyle.length() == 0) this.fkStyle = "name_constraint"; - if (this.joinStyle == null || this.joinStyle.length() == 0) this.joinStyle = "ansi"; + if (UtilValidate.isEmpty(this.fkStyle)) this.fkStyle = "name_constraint"; + if (UtilValidate.isEmpty(this.joinStyle)) this.joinStyle = "ansi"; this.jndiJdbcElement = UtilXml.firstChildElement(datasourceElement, "jndi-jdbc"); this.tyrexDataSourceElement = UtilXml.firstChildElement(datasourceElement, "tyrex-dataSource"); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java Mon Nov 23 21:42:18 2009 @@ -2231,7 +2231,7 @@ public String makeFkConstraintName(ModelRelation modelRelation, int constraintNameClipLength) { String relConstraintName = modelRelation.getFkName(); - if (relConstraintName == null || relConstraintName.length() == 0) { + if (UtilValidate.isEmpty(relConstraintName)) { relConstraintName = modelRelation.getTitle() + modelRelation.getRelEntityName(); relConstraintName = relConstraintName.toUpperCase(); } @@ -2886,7 +2886,7 @@ StringBuilder indexSqlBuf = new StringBuilder("DROP INDEX "); String tableName = entity.getTableName(datasourceInfo); - String schemaName = (tableName == null || tableName.length() == 0 || tableName.indexOf('.') == -1) ? "" : + String schemaName = (UtilValidate.isEmpty(tableName) || tableName.indexOf('.') == -1) ? "" : tableName.substring(0, tableName.indexOf('.')); indexSqlBuf.append(schemaName); @@ -3105,7 +3105,7 @@ String relConstraintName = makeFkConstraintName(modelRelation, constraintNameClipLength); String tableName = entity.getTableName(datasourceInfo); - String schemaName = (tableName == null || tableName.length() == 0 || tableName.indexOf('.') == -1) ? "" : + String schemaName = (UtilValidate.isEmpty(tableName) || tableName.indexOf('.') == -1) ? "" : tableName.substring(0, tableName.indexOf('.')); if (UtilValidate.isNotEmpty(schemaName)) { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelField.java Mon Nov 23 21:42:18 2009 @@ -122,7 +122,7 @@ public void setColName(String colName) { this.colName = colName; - if (this.colName == null || this.colName.length() == 0) { + if (UtilValidate.isEmpty(this.colName)) { this.colName = ModelUtil.javaNameToDbName(UtilXml.checkEmpty(this.name)); } } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java Mon Nov 23 21:42:18 2009 @@ -40,6 +40,7 @@ import org.ofbiz.base.location.FlexibleLocation; import org.ofbiz.base.util.Base64; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; @@ -498,7 +499,7 @@ CharSequence name = attributes.getLocalName(i); CharSequence value = attributes.getValue(i); - if (name == null || name.length() == 0) { + if (UtilValidate.isEmpty(name)) { name = attributes.getQName(i); } newElement.setAttribute(name.toString(), value.toString()); @@ -547,7 +548,7 @@ CharSequence name = attributes.getLocalName(i); CharSequence value = attributes.getValue(i); - if (name == null || name.length() == 0) { + if (UtilValidate.isEmpty(name)) { name = attributes.getQName(i); } try { Modified: ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java (original) +++ ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java Mon Nov 23 21:42:18 2009 @@ -200,13 +200,13 @@ String delegatorName = null; String entityGroupName = null; - if (delegatorNameProp == null || delegatorNameProp.value == null || delegatorNameProp.value.length() == 0) { + if (delegatorNameProp == null || UtilValidate.isEmpty(delegatorNameProp.value)) { throw new ContainerException("Invalid delegator-name defined in container configuration"); } else { delegatorName = delegatorNameProp.value; } - if (entityGroupNameProp == null || entityGroupNameProp.value == null || entityGroupNameProp.value.length() == 0) { + if (entityGroupNameProp == null || UtilValidate.isEmpty(entityGroupNameProp.value)) { throw new ContainerException("Invalid entity-group-name defined in container configuration"); } else { entityGroupName = entityGroupNameProp.value; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java Mon Nov 23 21:42:18 2009 @@ -741,7 +741,7 @@ } response = (String) methodContext.getEnv(eventResponseCodeName); - if (response == null || response.length() == 0) { + if (UtilValidate.isEmpty(response)) { if (forceError) { //override response code, always use error code Debug.logInfo("No response code string found, but error messages found so assuming error; returning code [" + defaultErrorCode + "]", module); @@ -795,7 +795,7 @@ } response = (String) methodContext.getEnv(serviceResponseMessageName); - if (response == null || response.length() == 0) { + if (UtilValidate.isEmpty(response)) { if (forceError) { //override response code, always use error code Debug.logVerbose("No response code string found, but error messages found so assuming error; returning code [" + defaultErrorCode + "]", module); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ContextAccessor.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ContextAccessor.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ContextAccessor.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ContextAccessor.java Mon Nov 23 21:42:18 2009 @@ -21,6 +21,7 @@ import java.util.Map; import org.ofbiz.base.util.UtilGenerics; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.collections.FlexibleMapAccessor; /** @@ -38,7 +39,7 @@ } public ContextAccessor(String name, String defaultName) { - if (name == null || name.length() == 0) { + if (UtilValidate.isEmpty(name)) { init(defaultName); } else { init(name); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/AddError.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/AddError.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/AddError.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/AddError.java Mon Nov 23 21:42:18 2009 @@ -87,7 +87,7 @@ //String propMsg = UtilProperties.getPropertyValue(UtilURL.fromResource(propertyResource, loader), message); String propMsg = UtilProperties.getMessage(propertyResource, message, methodContext.getEnvMap(), methodContext.getLocale()); - if (propMsg == null || propMsg.length() == 0) { + if (UtilValidate.isEmpty(propMsg)) { messages.add("Simple Method error occurred, but no message was found, sorry."); } else { messages.add(methodContext.expandString(propMsg)); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallService.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallService.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallService.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallService.java Mon Nov 23 21:42:18 2009 @@ -98,7 +98,7 @@ includeUserLoginStr = element.getAttribute("include-user-login"); breakOnErrorStr = element.getAttribute("break-on-error"); errorCode = element.getAttribute("error-code"); - if (errorCode == null || errorCode.length() == 0) errorCode = "error"; + if (UtilValidate.isEmpty(errorCode)) errorCode = "error"; this.requireNewTransactionStr = element.getAttribute("require-new-transaction"); String timeoutStr = UtilXml.checkEmpty(element.getAttribute("transaction-timeout"), element.getAttribute("transaction-timout")); @@ -114,7 +114,7 @@ this.transactionTimeout = timeout; successCode = element.getAttribute("success-code"); - if (successCode == null || successCode.length() == 0) successCode = "success"; + if (UtilValidate.isEmpty(successCode)) successCode = "success"; errorPrefix = new FlexibleMessage(UtilXml.firstChildElement(element, "error-prefix"), "service.error.prefix"); errorSuffix = new FlexibleMessage(UtilXml.firstChildElement(element, "error-suffix"), "service.error.suffix"); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMethod.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMethod.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMethod.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMethod.java Mon Nov 23 21:42:18 2009 @@ -21,6 +21,7 @@ import java.util.Map; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.minilang.MiniLangException; import org.ofbiz.minilang.SimpleMethod; import org.ofbiz.minilang.method.MethodContext; @@ -121,7 +122,7 @@ public SimpleMethod getSimpleMethodToCall(ClassLoader loader) throws MiniLangException { SimpleMethod simpleMethodToCall = null; - if (xmlResource == null || xmlResource.length() == 0) { + if (UtilValidate.isEmpty(xmlResource)) { simpleMethodToCall = this.simpleMethod.getSimpleMethodInSameFile(methodName); } else { Map<String, SimpleMethod> simpleMethods = SimpleMethod.getSimpleMethods(xmlResource, loader); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CheckErrors.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CheckErrors.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CheckErrors.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CheckErrors.java Mon Nov 23 21:42:18 2009 @@ -53,7 +53,7 @@ public CheckErrors(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); errorCode = element.getAttribute("error-code"); - if (errorCode == null || errorCode.length() == 0) errorCode = "error"; + if (UtilValidate.isEmpty(errorCode)) errorCode = "error"; errorListAcsr = new ContextAccessor<List<Object>>(element.getAttribute("error-list-name"), "error_list"); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/Return.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/Return.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/Return.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/Return.java Mon Nov 23 21:42:18 2009 @@ -20,6 +20,7 @@ import org.w3c.dom.*; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.minilang.*; import org.ofbiz.minilang.method.*; @@ -42,7 +43,7 @@ public Return(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); responseCode = element.getAttribute("response-code"); - if (responseCode == null || responseCode.length() == 0) + if (UtilValidate.isEmpty(responseCode)) responseCode = "success"; } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java Mon Nov 23 21:42:18 2009 @@ -100,7 +100,7 @@ StringBuilder newValue = new StringBuilder(); if (value != null && value.length() > 0) { - if (oldValue == null || oldValue.length() == 0) { + if (UtilValidate.isEmpty(oldValue)) { newValue.append(value); } else { newValue.append(oldValue); @@ -109,7 +109,7 @@ if (suffixValue != null) newValue.append(suffixValue); } } else { - if (oldValue == null || oldValue.length() == 0) { + if (UtilValidate.isEmpty(oldValue)) { newValue.append(oldValue); } } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/WebappPropertyToField.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/WebappPropertyToField.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/WebappPropertyToField.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/WebappPropertyToField.java Mon Nov 23 21:42:18 2009 @@ -84,7 +84,7 @@ Debug.logWarning("Webapp resource (properties file) not found with name " + resource, module); } else { fieldVal = UtilProperties.getPropertyValue(propsUrl, property); - if (fieldVal == null || fieldVal.length() == 0) { + if (UtilValidate.isEmpty(fieldVal)) { Debug.logWarning("Webapp resource property value not found with name " + property + " in resource " + resource, module); } } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckId.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckId.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckId.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckId.java Mon Nov 23 21:42:18 2009 @@ -120,7 +120,7 @@ //String propMsg = UtilProperties.getPropertyValue(UtilURL.fromResource(propertyResource, loader), message); String propMsg = UtilProperties.getMessage(propertyResource, message, methodContext.getEnvMap(), methodContext.getLocale()); - if (propMsg == null || propMsg.length() == 0) { + if (UtilValidate.isEmpty(propMsg)) { messages.add(defaultMessage + errorDetails); } else { messages.add(methodContext.expandString(propMsg) + errorDetails); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPermission.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPermission.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPermission.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPermission.java Mon Nov 23 21:42:18 2009 @@ -153,7 +153,7 @@ } else if (isProperty && propertyResource != null && message != null) { //String propMsg = UtilProperties.getPropertyValue(UtilURL.fromResource(propertyResource, loader), message); String propMsg = UtilProperties.getMessage(propertyResource, message, methodContext.getEnvMap(), methodContext.getLocale()); - if (propMsg == null || propMsg.length() == 0) { + if (UtilValidate.isEmpty(propMsg)) { messages.add("Simple Method Permission error occurred, but no message was found, sorry."); } else { messages.add(methodContext.expandString(propMsg)); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java Mon Nov 23 21:42:18 2009 @@ -75,7 +75,7 @@ } else { value = UtilProperties.getMessage(resource, property, methodContext.getLocale()); } - if (value == null || value.length() == 0) { + if (UtilValidate.isEmpty(value)) { value = defaultVal; } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/BaseCompare.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/BaseCompare.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/BaseCompare.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/BaseCompare.java Mon Nov 23 21:42:18 2009 @@ -38,7 +38,7 @@ this.format = element.getAttribute("format"); /* -- Let ObjectType handle the default -- - if (this.format == null || this.format.length() == 0) { + if (UtilValidate.isEmpty(this.format)) { if ("Date".equals(type)) { this.format = "yyyy-MM-dd"; } else if ("Time".equals(type)) { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Convert.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Convert.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Convert.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Convert.java Mon Nov 23 21:42:18 2009 @@ -25,6 +25,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.ObjectType; +import org.ofbiz.base.util.UtilValidate; import org.w3c.dom.Element; /** @@ -42,7 +43,7 @@ public Convert(Element element, SimpleMapProcess simpleMapProcess) { super(element, simpleMapProcess); this.toField = element.getAttribute("to-field"); - if (this.toField == null || this.toField.length() == 0) { + if (UtilValidate.isEmpty(this.toField)) { this.toField = this.fieldName; } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Copy.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Copy.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Copy.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Copy.java Mon Nov 23 21:42:18 2009 @@ -19,6 +19,8 @@ package org.ofbiz.minilang.operation; import java.util.*; + +import org.ofbiz.base.util.UtilValidate; import org.w3c.dom.*; /** @@ -33,7 +35,7 @@ public Copy(Element element, SimpleMapProcess simpleMapProcess) { super(element, simpleMapProcess); toField = element.getAttribute("to-field"); - if (this.toField == null || this.toField.length() == 0) { + if (UtilValidate.isEmpty(this.toField)) { this.toField = this.fieldName; } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/PropertyOper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/PropertyOper.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/PropertyOper.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/PropertyOper.java Mon Nov 23 21:42:18 2009 @@ -43,7 +43,7 @@ public String exec(Map<String, Object> inMap, List<Object> messages, Locale locale, ClassLoader loader) { String propStr = UtilProperties.getPropertyValue(UtilURL.fromResource(resource, loader), property); - if (propStr == null || propStr.length() == 0) { + if (UtilValidate.isEmpty(propStr)) { Debug.logWarning("[SimpleMapProcessor.PropertyOper.exec] Property " + property + " in resource " + resource + " not found, not appending anything", module); return null; } else { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapOperation.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapOperation.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapOperation.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapOperation.java Mon Nov 23 21:42:18 2009 @@ -60,7 +60,7 @@ } else if (isProperty && propertyResource != null && message != null) { // this one doesn't do the proper i18n: String propMsg = UtilProperties.getPropertyValue(UtilURL.fromResource(propertyResource, loader), message); String propMsg = UtilProperties.getMessage(propertyResource, message, locale); - if (propMsg == null || propMsg.length() == 0) { + if (UtilValidate.isEmpty(propMsg)) { messages.add(new MessageString("Simple Map Processing error occurred, but no message was found, sorry.", fieldName, propertyResource, message, locale, true)); } else { messages.add(new MessageString(propMsg, fieldName, propertyResource, message, locale, true)); Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java Mon Nov 23 21:42:18 2009 @@ -26,6 +26,7 @@ import javolution.util.FastMap; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; /** @@ -127,7 +128,7 @@ } protected void init(String name, Delegator delegator, DispatchContext ctx) { - if (name == null || name.length() == 0) + if (UtilValidate.isEmpty(name)) throw new IllegalArgumentException("The name of a LocalDispatcher cannot be a null or empty String"); this.name = name; Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java Mon Nov 23 21:42:18 2009 @@ -479,9 +479,9 @@ protected void createAutoAttrDef(Element autoElement, ModelService service) { // get the entity name; first from the auto-attributes then from the service def String entityName = UtilXml.checkEmpty(autoElement.getAttribute("entity-name")); - if (entityName == null || entityName.length() == 0) { + if (UtilValidate.isEmpty(entityName)) { entityName = service.defaultEntityName; - if (entityName == null || entityName.length() == 0) { + if (UtilValidate.isEmpty(entityName)) { Debug.logWarning("Auto-Attribute does not specify an entity-name; not default-entity on service definition", module); } } Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java Mon Nov 23 21:42:18 2009 @@ -185,12 +185,12 @@ public static String getPartyIdCheckSecurity(GenericValue userLogin, Security security, Map<String, ? extends Object> context, Map<String, Object> result, String secEntity, String secOperation) { String partyId = (String) context.get("partyId"); Locale locale = getLocale(context); - if (partyId == null || partyId.length() == 0) { + if (UtilValidate.isEmpty(partyId)) { partyId = userLogin.getString("partyId"); } // partyId might be null, so check it - if (partyId == null || partyId.length() == 0) { + if (UtilValidate.isEmpty(partyId)) { result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); String errMsg = UtilProperties.getMessage(ServiceUtil.resource, "serviceUtil.party_id_missing", locale) + "."; result.put(ModelService.ERROR_MESSAGE, errMsg); Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java Mon Nov 23 21:42:18 2009 @@ -25,6 +25,7 @@ import java.util.Set; import java.util.TreeSet; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; /** A collection of TemporalExpression classes. * <p>For the most part, these classes are immutable - with the exception @@ -480,10 +481,10 @@ * @param count The interval count - must be greater than zero */ public TimeOfDayRange(String start, String end, int interval, int count) { - if (start == null || start.length() == 0) { + if (UtilValidate.isEmpty(start)) { throw new IllegalArgumentException("start argument cannot be null or empty"); } - if (end == null || end.length() == 0) { + if (UtilValidate.isEmpty(end)) { throw new IllegalArgumentException("end argument cannot be null or empty"); } if (interval != Calendar.SECOND && interval != Calendar.MINUTE && interval != Calendar.HOUR_OF_DAY) { Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsListenerFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsListenerFactory.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsListenerFactory.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsListenerFactory.java Mon Nov 23 21:42:18 2009 @@ -26,6 +26,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.ServiceDispatcher; @@ -125,7 +126,7 @@ String password = server.getAttribute("password"); String className = server.getAttribute("listener-class"); - if (className == null || className.length() == 0) { + if (UtilValidate.isEmpty(className)) { if (type.equals("topic")) className = JmsListenerFactory.TOPIC_LISTENER_CLASS; else if (type.equals("queue")) Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java Mon Nov 23 21:42:18 2009 @@ -29,6 +29,7 @@ import org.ofbiz.base.container.Container; import org.ofbiz.base.container.ContainerConfig; import org.ofbiz.base.container.ContainerException; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.DelegatorFactory; import org.ofbiz.service.GenericDispatcher; @@ -66,14 +67,14 @@ ContainerConfig.Container.Property serverProp = cfg.getProperty("server-factory"); // check the required lookup-name property - if (lookupNameProp == null || lookupNameProp.value == null || lookupNameProp.value.length() == 0) { + if (lookupNameProp == null || UtilValidate.isEmpty(lookupNameProp.value)) { throw new ContainerException("Invalid lookup-name defined in container configuration"); } else { this.name = lookupNameProp.value; } // check the required delegator-name property - if (delegatorProp == null || delegatorProp.value == null || delegatorProp.value.length() == 0) { + if (delegatorProp == null || UtilValidate.isEmpty(delegatorProp.value)) { throw new ContainerException("Invalid delegator-name defined in container configuration"); } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java Mon Nov 23 21:42:18 2009 @@ -94,8 +94,8 @@ // setup DEFAULT chararcter encoding and content type, this will be overridden in the RequestHandler for view rendering String charset = getServletContext().getInitParameter("charset"); - if (charset == null || charset.length() == 0) charset = request.getCharacterEncoding(); - if (charset == null || charset.length() == 0) charset = "UTF-8"; + if (UtilValidate.isEmpty(charset)) charset = request.getCharacterEncoding(); + if (UtilValidate.isEmpty(charset)) charset = "UTF-8"; if (Debug.verboseOn()) Debug.logVerbose("The character encoding of the request is: [" + request.getCharacterEncoding() + "]. The character encoding we will use for the request and response is: [" + charset + "]", module); if (!"none".equals(charset)) { Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java Mon Nov 23 21:42:18 2009 @@ -33,6 +33,7 @@ import org.apache.bsf.util.IOUtils; import org.ofbiz.base.location.FlexibleLocation; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.cache.UtilCache; import org.ofbiz.webapp.control.ConfigXMLReader; @@ -79,7 +80,7 @@ InputStream scriptStream = null; String scriptString = null; String cacheName = null; - if (event.path == null || event.path.length() == 0) { + if (UtilValidate.isEmpty(event.path)) { // we are a resource to be loaded off the classpath cacheName = event.invoke; scriptString = eventCache.get(cacheName); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java Mon Nov 23 21:42:18 2009 @@ -28,6 +28,7 @@ import javax.servlet.http.HttpSession; import org.ofbiz.base.util.UtilHttp; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.collections.MapStack; import org.ofbiz.base.util.template.FreeMarkerWorker; import org.ofbiz.webapp.view.AbstractViewHandler; @@ -61,7 +62,7 @@ public void render(String name, String page, String info, String contentType, String encoding, HttpServletRequest request, HttpServletResponse response) throws ViewHandlerException { - if (page == null || page.length() == 0) + if (UtilValidate.isEmpty(page)) throw new ViewHandlerException("Invalid template source"); // make the root context (data model) for freemarker Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/InputValue.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/InputValue.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/InputValue.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/pseudotag/InputValue.java Mon Nov 23 21:42:18 2009 @@ -24,6 +24,7 @@ import org.ofbiz.base.util.UtilFormatOut; import org.ofbiz.base.util.UtilGenerics; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericValue; /** @@ -93,7 +94,7 @@ String paramName = param; - if (paramName == null || paramName.length() == 0) + if (UtilValidate.isEmpty(paramName)) paramName = field; Boolean tempBool = null; @@ -133,7 +134,7 @@ inputValue = pageContext.getRequest().getParameter(paramName); } - if (inputValue == null || inputValue.length() == 0) + if (UtilValidate.isEmpty(inputValue)) inputValue = defaultStr; if (fullattrs) { Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java Mon Nov 23 21:42:18 2009 @@ -33,6 +33,7 @@ import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilProperties; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.DelegatorFactory; import org.ofbiz.entity.GenericEntityException; @@ -608,7 +609,7 @@ String visitId = VisitHandler.getVisitId(request.getSession()); - if (visitId == null || visitId.length() == 0) { + if (UtilValidate.isEmpty(visitId)) { // no visit info stored, so don't store the ServerHit Debug.logWarning("Could not find a visitId, so not storing ServerHit. This is probably a configuration error. If you turn of persistance of visits you should also turn off persistence of hits.", module); return; Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/FormatTag.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/FormatTag.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/FormatTag.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/taglib/FormatTag.java Mon Nov 23 21:42:18 2009 @@ -26,6 +26,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilJ2eeCompat; +import org.ofbiz.base.util.UtilValidate; /** * FormatTag - JSP Tag to format numbers and dates. @@ -61,7 +62,7 @@ String value = body.getString(); body.clearBody(); - if (value == null || value.length() == 0) + if (UtilValidate.isEmpty(value)) return SKIP_BODY; if (type.charAt(0) == 'C' || type.charAt(0) == 'c') Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/DataVisionViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/DataVisionViewHandler.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/DataVisionViewHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/DataVisionViewHandler.java Mon Nov 23 21:42:18 2009 @@ -29,6 +29,7 @@ import jimm.datavision.UserCancellationException; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.webapp.control.ContextFilter; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.jdbc.ConnectionFactory; @@ -53,10 +54,10 @@ if (request == null) { throw new ViewHandlerException("The HttpServletRequest object was null, how did that happen?"); } - if (page == null || page.length() == 0) { + if (UtilValidate.isEmpty(page)) { throw new ViewHandlerException("View page was null or empty, but must be specified"); } - if (info == null || info.length() == 0) { + if (UtilValidate.isEmpty(info)) { throw new ViewHandlerException("View fnfo string was null or empty, but must be used to specify an Entity that is mapped to the Entity Engine datasource that the report will use."); } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/HttpViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/HttpViewHandler.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/HttpViewHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/HttpViewHandler.java Mon Nov 23 21:42:18 2009 @@ -26,6 +26,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.HttpClient; import org.ofbiz.base.util.HttpClientException; +import org.ofbiz.base.util.UtilValidate; /** * ViewHandlerException - View Handler Exception @@ -46,7 +47,7 @@ if (request == null) throw new ViewHandlerException("Null HttpServletRequest object"); - if (page == null || page.length() == 0) + if (UtilValidate.isEmpty(page)) throw new ViewHandlerException("Null or empty source"); if (Debug.infoOn()) Debug.logInfo("Retreiving HTTP resource at: " + page, module); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsJXlsViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsJXlsViewHandler.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsJXlsViewHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsJXlsViewHandler.java Mon Nov 23 21:42:18 2009 @@ -65,10 +65,10 @@ if (request == null) { throw new ViewHandlerException("The HttpServletRequest object was null, how did that happen?"); } - if (page == null || page.length() == 0) { + if (UtilValidate.isEmpty(page)) { throw new ViewHandlerException("View page was null or empty, but must be specified"); } - if (info == null || info.length() == 0) { + if (UtilValidate.isEmpty(info)) { Debug.logInfo("View info string was null or empty, (optionally used to specify an Entity that is mapped to the Entity Engine datasource that the report will use).", module); } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPdfViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPdfViewHandler.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPdfViewHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPdfViewHandler.java Mon Nov 23 21:42:18 2009 @@ -63,10 +63,10 @@ if (request == null) { throw new ViewHandlerException("The HttpServletRequest object was null, how did that happen?"); } - if (page == null || page.length() == 0) { + if (UtilValidate.isEmpty(page)) { throw new ViewHandlerException("View page was null or empty, but must be specified"); } - if (info == null || info.length() == 0) { + if (UtilValidate.isEmpty(info)) { Debug.logInfo("View info string was null or empty, (optionally used to specify an Entity that is mapped to the Entity Engine datasource that the report will use).", module); } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPoiXlsViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPoiXlsViewHandler.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPoiXlsViewHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsPoiXlsViewHandler.java Mon Nov 23 21:42:18 2009 @@ -65,10 +65,10 @@ if (request == null) { throw new ViewHandlerException("The HttpServletRequest object was null, how did that happen?"); } - if (page == null || page.length() == 0) { + if (UtilValidate.isEmpty(page)) { throw new ViewHandlerException("View page was null or empty, but must be specified"); } - if (info == null || info.length() == 0) { + if (UtilValidate.isEmpty(info)) { Debug.logInfo("View info string was null or empty, (optionally used to specify an Entity that is mapped to the Entity Engine datasource that the report will use).", module); } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsXmlViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsXmlViewHandler.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsXmlViewHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JasperReportsXmlViewHandler.java Mon Nov 23 21:42:18 2009 @@ -61,10 +61,10 @@ if (request == null) { throw new ViewHandlerException("The HttpServletRequest object was null, how did that happen?"); } - if (page == null || page.length() == 0) { + if (UtilValidate.isEmpty(page)) { throw new ViewHandlerException("View page was null or empty, but must be specified"); } - if (info == null || info.length() == 0) { + if (UtilValidate.isEmpty(info)) { Debug.logWarning("View info string was null or empty, but must be used to specify an Entity that is mapped to the Entity Engine datasource that the report will use.", module); } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JspViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JspViewHandler.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JspViewHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/JspViewHandler.java Mon Nov 23 21:42:18 2009 @@ -27,6 +27,7 @@ import javax.servlet.jsp.JspException; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.webapp.control.ContextFilter; /** @@ -49,7 +50,7 @@ if (request == null) { throw new ViewHandlerException("Null HttpServletRequest object"); } - if (page == null || page.length() == 0) { + if (UtilValidate.isEmpty(page)) { throw new ViewHandlerException("Null or empty source"); } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/RegionViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/RegionViewHandler.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/RegionViewHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/RegionViewHandler.java Mon Nov 23 21:42:18 2009 @@ -27,6 +27,7 @@ import javax.servlet.jsp.JspException; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.webapp.control.ContextFilter; import org.ofbiz.webapp.region.Region; import org.ofbiz.webapp.region.RegionManager; @@ -67,7 +68,7 @@ if (request == null) { throw new ViewHandlerException("The HttpServletRequest object was null, how did that happen?"); } - if (page == null || page.length() == 0) { + if (UtilValidate.isEmpty(page)) { throw new ViewHandlerException("Page name was null or empty, but must be specified"); } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/VelocityViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/VelocityViewHandler.java?rev=883507&r1=883506&r2=883507&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/VelocityViewHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/VelocityViewHandler.java Mon Nov 23 21:42:18 2009 @@ -38,6 +38,7 @@ import org.apache.velocity.util.SimplePool; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilProperties; +import org.ofbiz.base.util.UtilValidate; /** * VelocityViewHandler - Velocity Template Engine View Handler @@ -94,7 +95,7 @@ throw new ViewHandlerException("Velocity Template Engine has not been initialized"); } - if (page == null || page.length() == 0) { + if (UtilValidate.isEmpty(page)) { throw new ViewHandlerException("Invalid template source"); } |
Free forum by Nabble | Edit this page |