Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java Mon Nov 23 23:41:34 2009 @@ -671,7 +671,7 @@ while ((productFeatureAndAppl = (GenericValue) productFeatureAndApplEli.next()) != null) { String productFeatureId = productFeatureAndAppl.getString("productFeatureId"); String productFeatureTypeId = productFeatureAndAppl.getString("productFeatureTypeId"); - if (productFeatureTypeIdsToInclude != null && productFeatureTypeIdsToInclude.size() > 0 && !productFeatureTypeIdsToInclude.contains(productFeatureTypeId)) { + if (UtilValidate.isNotEmpty(productFeatureTypeIdsToInclude) && !productFeatureTypeIdsToInclude.contains(productFeatureTypeId)) { continue; } if (productFeatureTypeIdsToExclude != null && productFeatureTypeIdsToExclude.contains(productFeatureTypeId)) { Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java Mon Nov 23 23:41:34 2009 @@ -322,13 +322,13 @@ obsolescenceProducts = EntityUtil.filterByDate(obsolescenceProducts); obsoleteByProducts = EntityUtil.filterByDate(obsoleteByProducts); - if (upgradeProducts != null && upgradeProducts.size() > 0) + if (UtilValidate.isNotEmpty(upgradeProducts)) pageContext.setAttribute(assocPrefix + "upgrade", upgradeProducts); - if (complementProducts != null && complementProducts.size() > 0) + if (UtilValidate.isNotEmpty(complementProducts)) pageContext.setAttribute(assocPrefix + "complement", complementProducts); - if (obsolescenceProducts != null && obsolescenceProducts.size() > 0) + if (UtilValidate.isNotEmpty(obsolescenceProducts)) pageContext.setAttribute(assocPrefix + "obsolescence", obsolescenceProducts); - if (obsoleteByProducts != null && obsoleteByProducts.size() > 0) + if (UtilValidate.isNotEmpty(obsoleteByProducts)) pageContext.setAttribute(assocPrefix + "obsoleteby", obsoleteByProducts); } catch (GenericEntityException e) { Debug.logWarning(e, module); Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductServices.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductServices.java Mon Nov 23 23:41:34 2009 @@ -35,6 +35,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; @@ -65,7 +66,7 @@ String path = System.getProperty("user.dir") + "/spreadsheet"; List<File> fileItems = FastList.newInstance(); - if (path != null && path.length() > 0) { + if (UtilValidate.isNotEmpty(path)) { File importDir = new File(path); if (importDir.isDirectory() && importDir.canRead()) { File[] files = importDir.listFiles(); Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java Mon Nov 23 23:41:34 2009 @@ -343,14 +343,14 @@ // check the geos String includeGeoId = method.getString("includeGeoId"); String excludeGeoId = method.getString("excludeGeoId"); - if ((includeGeoId != null && includeGeoId.length() > 0) || (excludeGeoId != null && excludeGeoId.length() > 0)) { + if (UtilValidate.isNotEmpty(includeGeoId) || UtilValidate.isNotEmpty(excludeGeoId)) { if (shippingAddress == null) { returnShippingMethods.remove(method); //Debug.logInfo("Removed shipping method due to empty shipping adresss (may not have been selected yet)", module); continue; } } - if (includeGeoId != null && includeGeoId.length() > 0) { + if (UtilValidate.isNotEmpty(includeGeoId)) { List<GenericValue> includeGeoGroup = GeoWorker.expandGeoGroup(includeGeoId, delegator); if (!GeoWorker.containsGeo(includeGeoGroup, shippingAddress.getString("countryGeoId"), delegator) && !GeoWorker.containsGeo(includeGeoGroup, shippingAddress.getString("stateProvinceGeoId"), delegator) && @@ -361,7 +361,7 @@ continue; } } - if (excludeGeoId != null && excludeGeoId.length() > 0) { + if (UtilValidate.isNotEmpty(excludeGeoId)) { List<GenericValue> excludeGeoGroup = GeoWorker.expandGeoGroup(excludeGeoId, delegator); if (GeoWorker.containsGeo(excludeGeoGroup, shippingAddress.getString("countryGeoId"), delegator) || GeoWorker.containsGeo(excludeGeoGroup, shippingAddress.getString("stateProvinceGeoId"), delegator) || @@ -376,7 +376,7 @@ // check the features String includeFeatures = method.getString("includeFeatureGroup"); String excludeFeatures = method.getString("excludeFeatureGroup"); - if (includeFeatures != null && includeFeatures.length() > 0) { + if (UtilValidate.isNotEmpty(includeFeatures)) { List<GenericValue> includedFeatures = null; try { includedFeatures = delegator.findByAndCache("ProductFeatureGroupAppl", UtilMisc.toMap("productFeatureGroupId", includeFeatures)); @@ -398,7 +398,7 @@ } } } - if (excludeFeatures != null && excludeFeatures.length() > 0) { + if (UtilValidate.isNotEmpty(excludeFeatures)) { List<GenericValue> excludedFeatures = null; try { excludedFeatures = delegator.findByAndCache("ProductFeatureGroupAppl", UtilMisc.toMap("productFeatureGroupId", excludeFeatures)); Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java Mon Nov 23 23:41:34 2009 @@ -527,7 +527,7 @@ featurePrice = BigDecimal.ZERO; } - if (featureGroupId != null && featureGroupId.length() > 0 && shippableFeatureMap != null) { + if (UtilValidate.isNotEmpty(featureGroupId) && shippableFeatureMap != null) { for (Map.Entry<String, BigDecimal> entry: shippableFeatureMap.entrySet()) { String featureId = entry.getKey(); BigDecimal quantity = entry.getValue(); Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java (original) +++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java Mon Nov 23 23:41:34 2009 @@ -692,7 +692,7 @@ } boolean hasCreatePermission = hasPermission(workEffortId, "CREATE", context); List<GenericValue> workEfforts = getRelatedWorkEfforts(publishProperties, context); - if (workEfforts != null && workEfforts.size() > 0) { + if (UtilValidate.isNotEmpty(workEfforts)) { // Security issue: make sure only related work efforts get updated Set validWorkEfforts = FastSet.newInstance(); for (GenericValue workEffort : workEfforts) { Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java (original) +++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java Mon Nov 23 23:41:34 2009 @@ -308,7 +308,7 @@ String statusId = (String) context.get("currentStatusId"); - if (statusId != null && statusId.length() > 0) { + if (UtilValidate.isNotEmpty(statusId)) { try { currentStatus = delegator.findByPrimaryKeyCache("StatusItem", UtilMisc.toMap("statusId", statusId)); } catch (GenericEntityException e) { @@ -324,7 +324,7 @@ Debug.logWarning(e, module); } } - canView = (workEffortPartyAssignments != null && workEffortPartyAssignments.size() > 0) ? Boolean.TRUE : Boolean.FALSE; + canView = (UtilValidate.isNotEmpty(workEffortPartyAssignments)) ? Boolean.TRUE : Boolean.FALSE; if (!canView.booleanValue() && security.hasEntityPermission("WORKEFFORTMGR", "_VIEW", userLogin)) { canView = Boolean.TRUE; } Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortWorker.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortWorker.java (original) +++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortWorker.java Mon Nov 23 23:41:34 2009 @@ -82,7 +82,7 @@ String statusId = pageContext.getRequest().getParameter("currentStatusId"); - if (statusId != null && statusId.length() > 0) { + if (UtilValidate.isNotEmpty(statusId)) { try { currentStatus = delegator.findByPrimaryKeyCache("StatusItem", UtilMisc.toMap("statusId", statusId)); } catch (GenericEntityException e) { @@ -99,7 +99,7 @@ Debug.logWarning(e, module); } } - canView = (workEffortPartyAssignments != null && workEffortPartyAssignments.size() > 0) ? Boolean.TRUE : Boolean.FALSE; + canView = (UtilValidate.isNotEmpty(workEffortPartyAssignments)) ? Boolean.TRUE : Boolean.FALSE; if (!canView.booleanValue() && security.hasEntityPermission("WORKEFFORTMGR", "_VIEW", pageContext.getSession())) { canView = Boolean.TRUE; } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/component/ComponentConfig.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/component/ComponentConfig.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/component/ComponentConfig.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/component/ComponentConfig.java Mon Nov 23 23:41:34 2009 @@ -492,7 +492,7 @@ buf.append(rootLocation); } - if (resourceLoaderInfo.prependEnv != null && resourceLoaderInfo.prependEnv.length() > 0) { + if (UtilValidate.isNotEmpty(resourceLoaderInfo.prependEnv)) { String propValue = System.getProperty(resourceLoaderInfo.prependEnv); if (propValue == null) { String errMsg = "The Java environment (-Dxxx=yyy) variable with name " + resourceLoaderInfo.prependEnv + " is not set, cannot load resource."; @@ -501,7 +501,7 @@ } buf.append(propValue); } - if (resourceLoaderInfo.prefix != null && resourceLoaderInfo.prefix.length() > 0) { + if (UtilValidate.isNotEmpty(resourceLoaderInfo.prefix)) { buf.append(resourceLoaderInfo.prefix); } buf.append(location); Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/config/ResourceLoader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/config/ResourceLoader.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/config/ResourceLoader.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/config/ResourceLoader.java Mon Nov 23 23:41:34 2009 @@ -23,6 +23,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilURL; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.cache.UtilCache; import org.w3c.dom.Document; @@ -136,7 +137,7 @@ try { Class<?> lClass = null; - if (className != null && className.length() > 0) { + if (UtilValidate.isNotEmpty(className)) { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); lClass = classLoader.loadClass(className); @@ -179,7 +180,7 @@ public String fullLocation(String location) { StringBuilder buf = new StringBuilder(); - if (envName != null && envName.length() > 0) { + if (UtilValidate.isNotEmpty(envName)) { String propValue = System.getProperty(envName); if (propValue == null) { String errMsg = "The Java environment (-Dxxx=yyy) variable with name " + envName + " is not set, cannot load resource."; @@ -188,7 +189,7 @@ } buf.append(propValue); } - if (prefix != null && prefix.length() > 0) { + if (UtilValidate.isNotEmpty(prefix)) { buf.append(prefix); } buf.append(location); Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Debug.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Debug.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Debug.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Debug.java Mon Nov 23 23:41:34 2009 @@ -122,7 +122,7 @@ } public static Logger getLogger(String module) { - if (module != null && module.length() > 0) { + if (UtilValidate.isNotEmpty(module)) { return Logger.getLogger(module); } else { return root; Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java Mon Nov 23 23:41:34 2009 @@ -62,12 +62,12 @@ h.put(Context.INITIAL_CONTEXT_FACTORY, jndiServerInfo.initialContextFactory); h.put(Context.PROVIDER_URL, jndiServerInfo.contextProviderUrl); - if (jndiServerInfo.urlPkgPrefixes != null && jndiServerInfo.urlPkgPrefixes.length() > 0) + if (UtilValidate.isNotEmpty(jndiServerInfo.urlPkgPrefixes)) h.put(Context.URL_PKG_PREFIXES, jndiServerInfo.urlPkgPrefixes); - if (jndiServerInfo.securityPrincipal != null && jndiServerInfo.securityPrincipal.length() > 0) + if (UtilValidate.isNotEmpty(jndiServerInfo.securityPrincipal)) h.put(Context.SECURITY_PRINCIPAL, jndiServerInfo.securityPrincipal); - if (jndiServerInfo.securityCredentials != null && jndiServerInfo.securityCredentials.length() > 0) + if (UtilValidate.isNotEmpty(jndiServerInfo.securityCredentials)) h.put(Context.SECURITY_CREDENTIALS, jndiServerInfo.securityCredentials); ic = new InitialContext(h); Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MessageString.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MessageString.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MessageString.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MessageString.java Mon Nov 23 23:41:34 2009 @@ -54,10 +54,10 @@ } public static List<Object> getMessagesForField(String fieldName1, String fieldName2, String fieldName3, String fieldName4, boolean convertToStrings, List<Object> messageStringList) { Set<String> fieldSet = new TreeSet<String>(); - if (fieldName1 != null && fieldName1.length() > 0) fieldSet.add(fieldName1); - if (fieldName2 != null && fieldName2.length() > 0) fieldSet.add(fieldName2); - if (fieldName3 != null && fieldName3.length() > 0) fieldSet.add(fieldName3); - if (fieldName4 != null && fieldName4.length() > 0) fieldSet.add(fieldName4); + if (UtilValidate.isNotEmpty(fieldName1)) fieldSet.add(fieldName1); + if (UtilValidate.isNotEmpty(fieldName2)) fieldSet.add(fieldName2); + if (UtilValidate.isNotEmpty(fieldName3)) fieldSet.add(fieldName3); + if (UtilValidate.isNotEmpty(fieldName4)) fieldSet.add(fieldName4); return getMessagesForField(fieldSet, convertToStrings, messageStringList); } public static List<Object> getMessagesForField(Set<String> fieldNameSet, boolean convertToStrings, List<Object> messageStringList) { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java Mon Nov 23 23:41:34 2009 @@ -174,7 +174,7 @@ Interpreter.ParsedScript script = null; - if (source != null && source.length() > 0) { + if (UtilValidate.isNotEmpty(source)) { script = parsedScripts.get(source); if (script == null) { synchronized (OfbizBshBsfEngine.class) { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java Mon Nov 23 23:41:34 2009 @@ -1055,7 +1055,7 @@ availableTimeZoneList = new LinkedList<TimeZone>(); List<String> idList = null; String tzString = UtilProperties.getPropertyValue("general", "timeZones.available"); - if (tzString != null && tzString.length() > 0) { + if (UtilValidate.isNotEmpty(tzString)) { idList = StringUtil.split(tzString, ","); } else { idList = Arrays.asList(TimeZone.getAvailableIDs()); Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java Mon Nov 23 23:41:34 2009 @@ -383,7 +383,7 @@ * @return <code>pre + base + post</code> if base String is not null or empty, otherwise an empty but non-null String. */ public static String ifNotEmpty(String base, String pre, String post) { - if (base != null && base.length() > 0) + if (UtilValidate.isNotEmpty(base)) return pre + base + post; else return ""; @@ -395,9 +395,9 @@ * @return The first passed String if not empty, otherwise the second if not empty, otherwise an empty but non-null String */ public static String checkEmpty(String string1, String string2) { - if (string1 != null && string1.length() > 0) + if (UtilValidate.isNotEmpty(string1)) return string1; - else if (string2 != null && string2.length() > 0) + else if (UtilValidate.isNotEmpty(string2)) return string2; else return ""; @@ -410,11 +410,11 @@ * @return The first passed String if not empty, otherwise the second if not empty, otherwise the third if not empty, otherwise an empty but non-null String */ public static String checkEmpty(String string1, String string2, String string3) { - if (string1 != null && string1.length() > 0) + if (UtilValidate.isNotEmpty(string1)) return string1; - else if (string2 != null && string2.length() > 0) + else if (UtilValidate.isNotEmpty(string2)) return string2; - else if (string3 != null && string3.length() > 0) + else if (UtilValidate.isNotEmpty(string3)) return string3; else return ""; 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -183,7 +183,7 @@ // note that if a parameter with a given name already exists it will be put into a list with all values String pathInfoStr = request.getPathInfo(); - if (pathInfoStr != null && pathInfoStr.length() > 0) { + if (UtilValidate.isNotEmpty(pathInfoStr)) { // make sure string ends with a trailing '/' so we get all values if (!pathInfoStr.endsWith("/")) pathInfoStr += "/"; @@ -393,7 +393,7 @@ for (Map.Entry<String, ? extends Object> entry: context.entrySet()) { String parameterName = entry.getKey(); if (parameterName.startsWith(prefix)) { - if (suffix != null && suffix.length() > 0) { + if (UtilValidate.isNotEmpty(suffix)) { if (parameterName.endsWith(suffix)) { String key = parameterName.substring(prefix.length(), parameterName.length() - (suffix.length())); if (entry.getValue() instanceof ByteBuffer) { @@ -420,7 +420,7 @@ for (Map.Entry<String, ? extends Object> entry: additionalFields.entrySet()) { String fieldName = entry.getKey(); if (fieldName.startsWith(prefix)) { - if (suffix != null && suffix.length() > 0) { + if (UtilValidate.isNotEmpty(suffix)) { if (fieldName.endsWith(suffix)) { String key = fieldName.substring(prefix.length(), fieldName.length() - (suffix.length() - 1)); Object value = entry.getValue(); @@ -489,7 +489,7 @@ while (parameterNames.hasMoreElements()) { String parameterName = parameterNames.nextElement(); if (parameterName.endsWith(suffix)) { - if (prefix != null && prefix.length() > 0) { + if (UtilValidate.isNotEmpty(prefix)) { if (parameterName.startsWith(prefix)) { String value = request.getParameter(parameterName); paramList.add(value); @@ -504,7 +504,7 @@ for (Map.Entry<String, ? extends Object> entry: additionalFields.entrySet()) { String fieldName = entry.getKey(); if (fieldName.endsWith(suffix)) { - if (prefix != null && prefix.length() > 0) { + if (UtilValidate.isNotEmpty(prefix)) { if (fieldName.startsWith(prefix)) { paramList.add(entry.getValue()); } @@ -753,7 +753,7 @@ valueStr = value.toString(); } - if (valueStr != null && valueStr.length() > 0) { + if (UtilValidate.isNotEmpty(valueStr)) { if (buf.length() > 0) { if (useExpandedEntites) { buf.append("&"); 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -737,7 +737,7 @@ if (availableLocaleList == null) { TreeMap<String, Locale> localeMap = new TreeMap<String, Locale>(); String localesString = UtilProperties.getPropertyValue("general", "locales.available"); - if (localesString != null && localesString.length() > 0) { // check if available locales need to be limited according general.properties file + if (UtilValidate.isNotEmpty(localesString)) { // check if available locales need to be limited according general.properties file int end = -1; int start = 0; for (int i=0; start < localesString.length(); i++) { 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -865,27 +865,27 @@ } public static String checkEmpty(String string) { - if (string != null && string.length() > 0) + if (UtilValidate.isNotEmpty(string)) return string; else return ""; } public static String checkEmpty(String string1, String string2) { - if (string1 != null && string1.length() > 0) + if (UtilValidate.isNotEmpty(string1)) return string1; - else if (string2 != null && string2.length() > 0) + else if (UtilValidate.isNotEmpty(string2)) return string2; else return ""; } public static String checkEmpty(String string1, String string2, String string3) { - if (string1 != null && string1.length() > 0) + if (UtilValidate.isNotEmpty(string1)) return string1; - else if (string2 != null && string2.length() > 0) + else if (UtilValidate.isNotEmpty(string2)) return string2; - else if (string3 != null && string3.length() > 0) + else if (UtilValidate.isNotEmpty(string3)) return string3; else return ""; Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java Mon Nov 23 23:41:34 2009 @@ -51,7 +51,7 @@ this.original = name; FlexibleStringExpander fse = null; String bracketedOriginal = null; - if (name != null && name.length() > 0) { + if (UtilValidate.isNotEmpty(name)) { if (name.charAt(0) == '-') { this.isAscending = false; name = name.substring(1); 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -46,7 +46,7 @@ List<GenericValue> geoList = FastList.newInstance(); String defaultCountry = UtilProperties.getPropertyValue("general.properties", "country.geo.id.default"); GenericValue defaultGeo = null; - if (defaultCountry != null && defaultCountry.length() > 0) { + if (UtilValidate.isNotEmpty(defaultCountry)) { try { defaultGeo = delegator.findOne("Geo", UtilMisc.toMap("geoId", defaultCountry), true); } catch (GenericEntityException e) { Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java Mon Nov 23 23:41:34 2009 @@ -699,7 +699,7 @@ try { EntityListIterator it = (EntityListIterator) result.get("listIt"); list = it.getPartialList(1, 1); // list starts at '1' - if (list != null && list.size() > 0) { + if (UtilValidate.isNotEmpty(list)) { item = list.get(0); } it.close(); 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -497,7 +497,7 @@ // security: don't create a user login if the specified partyId (if not empty) already exists // unless the logged in user has permission to do so (same partyId or PARTYMGR_CREATE) - if (partyId != null && partyId.length() > 0) { + if (UtilValidate.isNotEmpty(partyId)) { GenericValue party = null; try { @@ -724,7 +724,7 @@ // security: don't create a user login if the specified partyId (if not empty) already exists // unless the logged in user has permission to do so (same partyId or PARTYMGR_CREATE) - if (partyId != null && partyId.length() > 0) { + if (UtilValidate.isNotEmpty(partyId)) { //GenericValue party = null; //try { // party = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", partyId)); Modified: ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile2EntityXml.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile2EntityXml.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile2EntityXml.java (original) +++ ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/DataFile2EntityXml.java Mon Nov 23 23:41:34 2009 @@ -29,6 +29,7 @@ import org.ofbiz.base.util.UtilFormatOut; import org.ofbiz.base.util.UtilURL; +import org.ofbiz.base.util.UtilValidate; public class DataFile2EntityXml { @@ -112,7 +113,7 @@ //} DataFile dataFile = null; - if (dataFileUrl != null && definitionUrl != null && definitionName != null && definitionName.length() > 0) { + if (dataFileUrl != null && definitionUrl != null && UtilValidate.isNotEmpty(definitionName)) { try { dataFile = DataFile.readFile(dataFileUrl, definitionUrl, definitionName); } catch (Exception e) { Modified: ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java (original) +++ ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java Mon Nov 23 23:41:34 2009 @@ -195,7 +195,7 @@ dataFile.receiver = UtilXml.checkEmpty(dataFileElement.getAttribute("receiver")); tempStr = UtilXml.checkEmpty(dataFileElement.getAttribute("record-length")); - if (tempStr != null && tempStr.length() > 0) { + if (UtilValidate.isNotEmpty(tempStr)) { dataFile.recordLength = Integer.parseInt(tempStr); } tempStr = UtilXml.checkEmpty(dataFileElement.getAttribute("delimiter")); @@ -204,7 +204,7 @@ } tempStr = UtilXml.checkEmpty(dataFileElement.getAttribute("text-delimiter")); - if (tempStr != null && tempStr.length() > 0) { + if (UtilValidate.isNotEmpty(tempStr)) { dataFile.textDelimiter = tempStr; } @@ -254,16 +254,16 @@ if (record.tcMax.length() > 0) record.tcMaxNum = Long.parseLong(record.tcMax); tempStr = UtilXml.checkEmpty(recordElement.getAttribute("tc-isnum")); - if (tempStr != null && tempStr.length() > 0) { + if (UtilValidate.isNotEmpty(tempStr)) { record.tcIsNum = Boolean.parseBoolean(tempStr); } tempStr = UtilXml.checkEmpty(recordElement.getAttribute("tc-position")); - if (tempStr != null && tempStr.length() > 0) { + if (UtilValidate.isNotEmpty(tempStr)) { record.tcPosition = Integer.parseInt(tempStr); } tempStr = UtilXml.checkEmpty(recordElement.getAttribute("tc-length")); - if (tempStr != null && tempStr.length() > 0) { + if (UtilValidate.isNotEmpty(tempStr)) { record.tcLength = Integer.parseInt(tempStr); } @@ -301,11 +301,11 @@ field.name = UtilXml.checkEmpty(fieldElement.getAttribute("name")); tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("position")); - if (tempStr != null && tempStr.length() > 0) { + if (UtilValidate.isNotEmpty(tempStr)) { field.position = Integer.parseInt(tempStr); } tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("length")); - if (tempStr != null && tempStr.length() > 0) { + if (UtilValidate.isNotEmpty(tempStr)) { field.length = Integer.parseInt(tempStr); } @@ -317,17 +317,17 @@ field.refField = UtilXml.checkEmpty(fieldElement.getAttribute("ref-field")); tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("prim-key")); - if (tempStr != null && tempStr.length() > 0) { + if (UtilValidate.isNotEmpty(tempStr)) { field.isPk = Boolean.parseBoolean(tempStr); } tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("ignored")); - if (tempStr != null && tempStr.length() > 0) { + if (UtilValidate.isNotEmpty(tempStr)) { field.ignored = Boolean.parseBoolean(tempStr); } tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("expression")); - if (tempStr != null && tempStr.length() > 0) { + if (UtilValidate.isNotEmpty(tempStr)) { field.expression = Boolean.parseBoolean(tempStr); } Modified: ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/Record.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/Record.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/Record.java (original) +++ ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/Record.java Mon Nov 23 23:41:34 2009 @@ -31,6 +31,7 @@ import java.util.StringTokenizer; import org.ofbiz.base.crypto.HashCrypt; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.common.login.LoginServices; /** @@ -553,7 +554,7 @@ String strVal = null; if (modelField.expression) { - if (modelField.refField != null && modelField.refField.length() > 0) { + if (UtilValidate.isNotEmpty(modelField.refField)) { strVal = record.getString(modelField.refField); } if (strVal == null) { 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=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Mon Nov 23 23:41:34 2009 @@ -246,7 +246,7 @@ if (Debug.infoOn()) Debug.logInfo("Delegator \"" + delegatorName + "\" initializing helper \"" + helperName + "\" for entity group \"" + groupName + "\".", module); TreeSet<String> helpersDone = new TreeSet<String>(); - if (helperName != null && helperName.length() > 0) { + if (UtilValidate.isNotEmpty(helperName)) { // make sure each helper is only loaded once if (helpersDone.contains(helperName)) { if (Debug.infoOn()) Debug.logInfo("Helper \"" + helperName + "\" already initialized, not re-initializing.", module); @@ -461,7 +461,7 @@ public GenericHelper getEntityHelper(String entityName) throws GenericEntityException { String helperName = getEntityHelperName(entityName); - if (helperName != null && helperName.length() > 0) { + if (UtilValidate.isNotEmpty(helperName)) { return GenericHelperFactory.getHelper(helperName); } else { throw new GenericEntityException("There is no datasource (Helper) configured for the entity-group [" + this.getEntityGroupName(entityName) + "]; was trying to find datesource (helper) for entity [" + entityName + "]"); @@ -2762,7 +2762,7 @@ String name = modelField.getName(); String attr = element.getAttribute(name); - if (attr != null && attr.length() > 0) { + if (UtilValidate.isNotEmpty(attr)) { value.setString(name, attr); } else { // if no attribute try a subelement Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java Mon Nov 23 23:41:34 2009 @@ -26,6 +26,7 @@ import org.apache.commons.dbcp.managed.XAConnectionFactory; import org.apache.commons.pool.impl.GenericObjectPool; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.transaction.TransactionFactory; import org.w3c.dom.Element; @@ -135,7 +136,7 @@ factory.setDefaultReadOnly(false); String transIso = jdbcElement.getAttribute("isolation-level"); - if (transIso != null && transIso.length() > 0) { + if (UtilValidate.isNotEmpty(transIso)) { if ("Serializable".equals(transIso)) { factory.setDefaultTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); } else if ("RepeatableRead".equals(transIso)) { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/MinervaConnectionFactory.java Mon Nov 23 23:41:34 2009 @@ -28,6 +28,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilGenerics; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.transaction.TransactionFactory; import org.ofbiz.minerva.pool.jdbc.xa.XAPoolDataSource; @@ -66,7 +67,7 @@ ds.setURL(jdbcElement.getAttribute("jdbc-uri")); String transIso = jdbcElement.getAttribute("isolation-level"); - if (transIso != null && transIso.length() > 0) { + if (UtilValidate.isNotEmpty(transIso)) { if ("Serializable".equals(transIso)) { pds.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); } else if ("RepeatableRead".equals(transIso)) { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/TyrexConnectionFactory.java Mon Nov 23 23:41:34 2009 @@ -72,7 +72,7 @@ String transIso = inlineJdbcElement.getAttribute("isolation-level"); - if (transIso != null && transIso.length() > 0) + if (UtilValidate.isNotEmpty(transIso)) ds.setIsolationLevel(transIso); ds.setLogWriter(Debug.getPrintWriter()); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/XaPoolConnectionFactory.java Mon Nov 23 23:41:34 2009 @@ -84,7 +84,7 @@ ds.setTransactionManager(TransactionFactory.getTransactionManager()); String transIso = jdbcElement.getAttribute("isolation-level"); - if (transIso != null && transIso.length() > 0) { + if (UtilValidate.isNotEmpty(transIso)) { if ("Serializable".equals(transIso)) { ((StandardXADataSource) ds).setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); } else if ("RepeatableRead".equals(transIso)) { @@ -119,7 +119,7 @@ // set the test statement to test connections String testStmt = jdbcElement.getAttribute("pool-jdbc-test-stmt"); - if (testStmt != null && testStmt.length() > 0) { + if (UtilValidate.isNotEmpty(testStmt)) { pds.setJdbcTestStmt(testStmt); Debug.logInfo("Set JDBC Test Statement : " + testStmt, module); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperFactory.java Mon Nov 23 23:41:34 2009 @@ -22,6 +22,7 @@ import java.util.Map; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.config.DatasourceInfo; import org.ofbiz.entity.config.EntityConfigUtil; @@ -54,7 +55,7 @@ String helperClassName = datasourceInfo.helperClass; Class<?> helperClass = null; - if (helperClassName != null && helperClassName.length() > 0) { + if (UtilValidate.isNotEmpty(helperClassName)) { try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); helperClass = loader.loadClass(helperClassName); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java Mon Nov 23 23:41:34 2009 @@ -136,7 +136,7 @@ if ("forward".equals(resultSetTypeString)) resultSetType = ResultSet.TYPE_FORWARD_ONLY; - if (delegatorName != null && delegatorName.length() > 0) { + if (UtilValidate.isNotEmpty(delegatorName)) { delegator = DelegatorFactory.getDelegator(delegatorName); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/ConnectionFactory.java Mon Nov 23 23:41:34 2009 @@ -19,6 +19,7 @@ package org.ofbiz.entity.jdbc; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.config.EntityConfigUtil; import org.ofbiz.entity.connection.ConnectionFactoryInterface; @@ -47,7 +48,7 @@ } try { - if (userName != null && userName.length() > 0) + if (UtilValidate.isNotEmpty(userName)) return DriverManager.getConnection(connectionUrl, userName, password); else if (props != null) return DriverManager.getConnection(connectionUrl, props); @@ -95,7 +96,7 @@ } Class<?> cfClass = null; - if (className != null && className.length() > 0) { + if (UtilValidate.isNotEmpty(className)) { try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); cfClass = loader.loadClass(className); 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -326,7 +326,7 @@ // add the column String errMsg = addColumn(entity, field); - if (errMsg != null && errMsg.length() > 0) { + if (UtilValidate.isNotEmpty(errMsg)) { message = "Could not add column [" + field.getColName() + "] to table [" + entity.getTableName(datasourceInfo) + "]: " + errMsg; Debug.logError(message, module); if (messages != null) messages.add(message); @@ -346,7 +346,7 @@ if (addMissing) { // create the table String errMsg = createTable(entity, modelEntities, false); - if (errMsg != null && errMsg.length() > 0) { + if (UtilValidate.isNotEmpty(errMsg)) { message = "Could not create table [" + entity.getTableName(datasourceInfo) + "]: " + errMsg; Debug.logError(message, module); if (messages != null) messages.add(message); @@ -463,7 +463,7 @@ if (addMissing) { String errMsg = createForeignKey(entity, modelRelation, relModelEntity, datasourceInfo.constraintNameClipLength, datasourceInfo.fkStyle, datasourceInfo.useFkInitiallyDeferred); - if (errMsg != null && errMsg.length() > 0) { + if (UtilValidate.isNotEmpty(errMsg)) { String message = "Could not create foreign key " + relConstraintName + " for entity [" + entity.getEntityName() + "]: " + errMsg; Debug.logError(message, module); if (messages != null) messages.add(message); @@ -550,7 +550,7 @@ if (addMissing) { String errMsg = createForeignKeyIndex(entity, modelRelation, datasourceInfo.constraintNameClipLength); - if (errMsg != null && errMsg.length() > 0) { + if (UtilValidate.isNotEmpty(errMsg)) { String message = "Could not create foreign key index " + relConstraintName + " for entity [" + entity.getEntityName() + "]: " + errMsg; Debug.logError(message, module); if (messages != null) messages.add(message); @@ -633,7 +633,7 @@ if (addMissing) { String errMsg = createDeclaredIndex(entity, modelIndex); - if (errMsg != null && errMsg.length() > 0) { + if (UtilValidate.isNotEmpty(errMsg)) { String message = "Could not create index " + relIndexName + " for entity [" + entity.getEntityName() + "]: " + errMsg; Debug.logError(message, module); if (messages != null) messages.add(message); @@ -1220,7 +1220,7 @@ String lookupSchemaName = null; try { if (dbData.supportsSchemasInTableDefinitions()) { - if (this.datasourceInfo.schemaName != null && this.datasourceInfo.schemaName.length() > 0) { + if (UtilValidate.isNotEmpty(this.datasourceInfo.schemaName)) { lookupSchemaName = this.datasourceInfo.schemaName; } else { lookupSchemaName = dbData.getUserName(); @@ -1456,7 +1456,7 @@ // ResultSet rsCols = dbData.getCrossReference(null, null, null, null, null, null); String lookupSchemaName = null; if (dbData.supportsSchemasInTableDefinitions()) { - if (this.datasourceInfo.schemaName != null && this.datasourceInfo.schemaName.length() > 0) { + if (UtilValidate.isNotEmpty(this.datasourceInfo.schemaName)) { lookupSchemaName = this.datasourceInfo.schemaName; } else { lookupSchemaName = dbData.getUserName(); @@ -1609,7 +1609,7 @@ for (String curTableName: tableNames) { String lookupSchemaName = null; if (dbData.supportsSchemasInTableDefinitions()) { - if (this.datasourceInfo.schemaName != null && this.datasourceInfo.schemaName.length() > 0) { + if (UtilValidate.isNotEmpty(this.datasourceInfo.schemaName)) { lookupSchemaName = this.datasourceInfo.schemaName; } else { lookupSchemaName = dbData.getUserName(); @@ -2295,7 +2295,7 @@ } String retMsg = createForeignKey(entity, modelRelation, relModelEntity, constraintNameClipLength, fkStyle, useFkInitiallyDeferred); - if (retMsg != null && retMsg.length() > 0) { + if (UtilValidate.isNotEmpty(retMsg)) { Debug.logError(retMsg, module); if (messages != null) messages.add(retMsg); continue; @@ -2483,7 +2483,7 @@ } String retMsg = deleteForeignKey(entity, modelRelation, relModelEntity, constraintNameClipLength); - if (retMsg != null && retMsg.length() > 0) { + if (UtilValidate.isNotEmpty(retMsg)) { if (messages != null) messages.add(retMsg); Debug.logError(retMsg, module); } @@ -2740,7 +2740,7 @@ ModelIndex modelIndex = indexesIter.next(); String retMsg = createDeclaredIndex(entity, modelIndex); - if (retMsg != null && retMsg.length() > 0) { + if (UtilValidate.isNotEmpty(retMsg)) { String message = "Could not create declared indices for entity [" + entity.getEntityName() + "]: " + retMsg; Debug.logError(message, module); if (messages != null) messages.add(message); @@ -2850,7 +2850,7 @@ while (indexesIter.hasNext()) { ModelIndex modelIndex = indexesIter.next(); String retMsg = deleteDeclaredIndex(entity, modelIndex); - if (retMsg != null && retMsg.length() > 0) { + if (UtilValidate.isNotEmpty(retMsg)) { if (retMsgsBuffer.length() > 0) { retMsgsBuffer.append("\n"); } @@ -2946,7 +2946,7 @@ ModelRelation modelRelation = relationsIter.next(); if ("one".equals(modelRelation.getType())) { String retMsg = createForeignKeyIndex(entity, modelRelation, constraintNameClipLength); - if (retMsg != null && retMsg.length() > 0) { + if (UtilValidate.isNotEmpty(retMsg)) { String message = "Could not create foreign key indices for entity [" + entity.getEntityName() + "]: " + retMsg; Debug.logError(message, module); if (messages != null) messages.add(message); @@ -3070,7 +3070,7 @@ if ("one".equals(modelRelation.getType())) { String retMsg = deleteForeignKeyIndex(entity, modelRelation, constraintNameClipLength); - if (retMsg != null && retMsg.length() > 0) { + if (UtilValidate.isNotEmpty(retMsg)) { if (retMsgsBuffer.length() > 0) { retMsgsBuffer.append("\n"); } @@ -3144,7 +3144,7 @@ public String getSchemaName(DatabaseMetaData dbData) throws SQLException { if (!isLegacy && this.datasourceInfo.useSchemas && dbData.supportsSchemasInTableDefinitions()) { - if (this.datasourceInfo.schemaName != null && this.datasourceInfo.schemaName.length() > 0) { + if (UtilValidate.isNotEmpty(this.datasourceInfo.schemaName)) { return this.datasourceInfo.schemaName; } else { return dbData.getUserName(); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Mon Nov 23 23:41:34 2009 @@ -328,7 +328,7 @@ /** The table-name of the Entity including a Schema name if specified in the datasource config */ public String getTableName(DatasourceInfo datasourceInfo) { - if (datasourceInfo != null && datasourceInfo.schemaName != null && datasourceInfo.schemaName.length() > 0) { + if (UtilValidate.isNotEmpty(datasourceInfo.schemaName)) { return datasourceInfo.schemaName + "." + this.tableName; } else { return this.tableName; Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/JNDIFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/JNDIFactory.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/JNDIFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/JNDIFactory.java Mon Nov 23 23:41:34 2009 @@ -37,6 +37,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.JNDIContextFactory; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.config.DatasourceInfo; import org.ofbiz.entity.config.EntityConfigUtil; @@ -66,7 +67,7 @@ String jndiName = EntityConfigUtil.getTxFactoryTxMgrJndiName(); String jndiServerName = EntityConfigUtil.getTxFactoryTxMgrJndiServerName(); - if (jndiName != null && jndiName.length() > 0) { + if (UtilValidate.isNotEmpty(jndiName)) { // if (Debug.verboseOn()) Debug.logVerbose("[JNDIFactory.getTransactionManager] Trying JNDI name " + jndiName, module); try { @@ -102,7 +103,7 @@ String jndiName = EntityConfigUtil.getTxFactoryUserTxJndiName(); String jndiServerName = EntityConfigUtil.getTxFactoryUserTxJndiServerName(); - if (jndiName != null && jndiName.length() > 0) { + if (UtilValidate.isNotEmpty(jndiName)) { // if (Debug.verboseOn()) Debug.logVerbose("[JNDIFactory.getTransactionManager] Trying JNDI name " + jndiName, module); try { @@ -213,7 +214,7 @@ /* NOTE: This code causes problems because settting the transaction isolation level after a transaction has started is a no-no * The question is: how should we do this? String isolationLevel = jndiJdbcElement.getAttribute("isolation-level"); - if (con != null && isolationLevel != null && isolationLevel.length() > 0) { + if (UtilValidate.isNotEmpty(isolationLevel)) { if ("Serializable".equals(isolationLevel)) { con.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); } else if ("RepeatableRead".equals(isolationLevel)) { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactory.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionFactory.java Mon Nov 23 23:41:34 2009 @@ -24,6 +24,7 @@ import javax.transaction.UserTransaction; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.config.DatasourceInfo; import org.ofbiz.entity.config.EntityConfigUtil; @@ -50,7 +51,7 @@ } Class<?> tfClass = null; - if (className != null && className.length() > 0) { + if (UtilValidate.isNotEmpty(className)) { try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); tfClass = loader.loadClass(className); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java Mon Nov 23 23:41:34 2009 @@ -30,6 +30,7 @@ import org.ofbiz.base.config.MainResourceHandler; import org.ofbiz.base.config.ResourceHandler; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; @@ -51,12 +52,12 @@ public static String getPathsString(String helperName) { StringBuilder pathBuffer = new StringBuilder(); - if (helperName != null && helperName.length() > 0) { + if (UtilValidate.isNotEmpty(helperName)) { DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName); for (Element sqlLoadPathElement: datasourceInfo.sqlLoadPaths) { String prependEnv = sqlLoadPathElement.getAttribute("prepend-env"); pathBuffer.append(pathBuffer.length() == 0 ? "" : ";"); - if (prependEnv != null && prependEnv.length() > 0) { + if (UtilValidate.isNotEmpty(prependEnv)) { pathBuffer.append(System.getProperty(prependEnv)); pathBuffer.append("/"); } @@ -138,7 +139,7 @@ } // get files from the paths string - if (paths != null && paths.length() > 0) { + if (UtilValidate.isNotEmpty(paths)) { StringTokenizer tokenizer = new StringTokenizer(paths, ";"); while (tokenizer.hasMoreTokens()) { String path = tokenizer.nextToken().toLowerCase(); 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -375,7 +375,7 @@ if (currentValue != null) { if (currentFieldName != null) { - if (currentFieldValue != null && currentFieldValue.length() > 0) { + if (UtilValidate.isNotEmpty(currentFieldValue)) { if (currentValue.getModelEntity().isField(currentFieldName.toString())) { ModelEntity modelEntity = currentValue.getModelEntity(); ModelField modelField = modelEntity.getField(currentFieldName.toString()); @@ -553,7 +553,7 @@ } try { // treat empty strings as nulls - if (value != null && value.length() > 0) { + if (UtilValidate.isNotEmpty(value)) { if (currentValue.getModelEntity().isField(name.toString())) { currentValue.setString(name.toString(), value.toString()); } else { Modified: ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java (original) +++ ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java Mon Nov 23 23:41:34 2009 @@ -281,7 +281,7 @@ } // check for null values - if (value != null && value.length() > 0) { + if (UtilValidate.isNotEmpty(value)) { char first = value.charAt(0); if (first == 0x00) { value = null; Modified: ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaAction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaAction.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaAction.java (original) +++ ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaAction.java Mon Nov 23 23:41:34 2009 @@ -71,7 +71,7 @@ // pull out context parameters needed for this service. Map<String, Object> actionContext = dctx.getModelService(serviceName).makeValid(context, ModelService.IN_PARAM); // if value-attr is specified, insert the value object in that attr name - if (valueAttr != null && valueAttr.length() > 0) { + if (UtilValidate.isNotEmpty(valueAttr)) { actionContext.put(valueAttr, newValue); } 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -715,7 +715,7 @@ boolean forceError = false; String tempErrorMsg = (String) methodContext.getEnv(eventErrorMessageName); - if (errorMsg.length() > 0 || (tempErrorMsg != null && tempErrorMsg.length() > 0)) { + if (errorMsg.length() > 0 || UtilValidate.isNotEmpty(tempErrorMsg)) { errorMsg += tempErrorMsg; methodContext.getRequest().setAttribute("_ERROR_MESSAGE_", errorMsg); forceError = true; @@ -732,7 +732,7 @@ } String eventMsg = (String) methodContext.getEnv(eventEventMessageName); - if (eventMsg != null && eventMsg.length() > 0) { + if (UtilValidate.isNotEmpty(eventMsg)) { methodContext.getRequest().setAttribute("_EVENT_MESSAGE_", eventMsg); } List<String> eventMsgList = UtilGenerics.checkList(methodContext.getEnv(eventEventMessageListName)); @@ -758,7 +758,7 @@ boolean forceError = false; String tempErrorMsg = (String) methodContext.getEnv(serviceErrorMessageName); - if (errorMsg.length() > 0 || (tempErrorMsg != null && tempErrorMsg.length() > 0)) { + if (errorMsg.length() > 0 || UtilValidate.isNotEmpty(tempErrorMsg)) { errorMsg += tempErrorMsg; methodContext.putResult(ModelService.ERROR_MESSAGE, errorMsg); forceError = true; @@ -785,7 +785,7 @@ } String successMsg = (String) methodContext.getEnv(serviceSuccessMessageName); - if (successMsg != null && successMsg.length() > 0) { + if (UtilValidate.isNotEmpty(successMsg)) { methodContext.putResult(ModelService.SUCCESS_MESSAGE, successMsg); } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallBsh.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallBsh.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallBsh.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallBsh.java Mon Nov 23 23:41:34 2009 @@ -58,7 +58,7 @@ resource = element.getAttribute("resource"); errorListAcsr = new ContextAccessor<List<Object>>(element.getAttribute("error-list-name"), "error_list"); - if (inline != null && inline.length() > 0) {// pre-parse/compile inlined bsh, only accessed here + if (UtilValidate.isNotEmpty(inline)) {// pre-parse/compile inlined bsh, only accessed here } } @@ -81,7 +81,7 @@ } // run external, from resource, first if resource specified - if (resource != null && resource.length() > 0) { + if (UtilValidate.isNotEmpty(resource)) { String resource = methodContext.expandString(this.resource); InputStream is = methodContext.getLoader().getResourceAsStream(resource); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMapProcessor.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMapProcessor.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMapProcessor.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMapProcessor.java Mon Nov 23 23:41:34 2009 @@ -86,8 +86,7 @@ } // run external map processor first - if (this.xmlResource != null && this.xmlResource.length() > 0 && - this.processorName != null && this.processorName.length() > 0) { + if (UtilValidate.isNotEmpty(this.xmlResource) && UtilValidate.isNotEmpty(this.processorName)) { String xmlResource = methodContext.expandString(this.xmlResource); String processorName = methodContext.expandString(this.processorName); try { 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -63,7 +63,7 @@ @Override public boolean exec(MethodContext methodContext) { - if (this.methodName != null && this.methodName.length() > 0) { + if (UtilValidate.isNotEmpty(this.methodName)) { String methodName = methodContext.expandString(this.methodName); String xmlResource = methodContext.expandString(this.xmlResource); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/FlexibleMessage.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/FlexibleMessage.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/FlexibleMessage.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/FlexibleMessage.java Mon Nov 23 23:41:34 2009 @@ -47,11 +47,11 @@ elVal = UtilXml.elementValue(element); } - if (resAttr != null && resAttr.length() > 0) { + if (UtilValidate.isNotEmpty(resAttr)) { propertyResource = resAttr; message = propAttr; isProperty = true; - } else if (elVal != null && elVal.length() > 0) { + } else if (UtilValidate.isNotEmpty(elVal)) { message = elVal; isProperty = false; } else { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java Mon Nov 23 23:41:34 2009 @@ -67,7 +67,7 @@ Authorization authz = methodContext.getAuthz(); Security security = methodContext.getSecurity(); - if (action != null && action.length() > 0) { + if (UtilValidate.isNotEmpty(action)) { // run hasEntityPermission if (security.hasEntityPermission(permission, action, userLogin)) { runSubOps = true; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java Mon Nov 23 23:41:34 2009 @@ -101,7 +101,7 @@ String entityName = this.entityNameExdr.expandString(context); String delegatorName = this.delegatorNameExdr.expandString(context); - if (delegatorName != null && delegatorName.length() > 0) { + if (UtilValidate.isNotEmpty(delegatorName)) { delegator = DelegatorFactory.getDelegator(delegatorName); } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java Mon Nov 23 23:41:34 2009 @@ -86,7 +86,7 @@ String delegatorName = this.delegatorNameExdr.expandString(methodContext.getEnvMap()); Delegator delegator = methodContext.getDelegator(); - if (delegatorName != null && delegatorName.length() > 0) { + if (UtilValidate.isNotEmpty(delegatorName)) { delegator = DelegatorFactory.getDelegator(delegatorName); } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java Mon Nov 23 23:41:34 2009 @@ -22,6 +22,7 @@ import java.util.Map; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.DelegatorFactory; import org.ofbiz.entity.GenericEntityException; @@ -84,7 +85,7 @@ } Delegator delegator = methodContext.getDelegator(); - if (delegatorName != null && delegatorName.length() > 0) { + if (UtilValidate.isNotEmpty(delegatorName)) { delegator = DelegatorFactory.getDelegator(delegatorName); } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java Mon Nov 23 23:41:34 2009 @@ -77,7 +77,7 @@ boolean useCache = "true".equals(useCacheStr); Delegator delegator = methodContext.getDelegator(); - if (delegatorName != null && delegatorName.length() > 0) { + if (UtilValidate.isNotEmpty(delegatorName)) { delegator = DelegatorFactory.getDelegator(delegatorName); } 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -99,7 +99,7 @@ } StringBuilder newValue = new StringBuilder(); - if (value != null && value.length() > 0) { + if (UtilValidate.isNotEmpty(value)) { if (UtilValidate.isEmpty(oldValue)) { newValue.append(value); } else { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToField.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToField.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToField.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToField.java Mon Nov 23 23:41:34 2009 @@ -74,7 +74,7 @@ } Object value; - if (this.messageFieldName != null && this.messageFieldName.length() > 0) { + if (UtilValidate.isNotEmpty(this.messageFieldName)) { value = new MessageString(valueStr, this.messageFieldName, true); } else { value = valueStr; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToList.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToList.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToList.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToList.java Mon Nov 23 23:41:34 2009 @@ -69,7 +69,7 @@ } Object value; - if (this.messageFieldName != null && this.messageFieldName.length() > 0) { + if (UtilValidate.isNotEmpty(this.messageFieldName)) { value = new MessageString(valueStr, this.messageFieldName, true); } else { value = valueStr; 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=883549&r1=883548&r2=883549&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 23:41:34 2009 @@ -178,7 +178,7 @@ String permission = methodContext.expandString(this.permission); String action = methodContext.expandString(this.action); - if (action != null && action.length() > 0) { + if (UtilValidate.isNotEmpty(action)) { // run hasEntityPermission return security.hasEntityPermission(permission, action, userLogin); } else { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfHasPermission.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfHasPermission.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfHasPermission.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfHasPermission.java Mon Nov 23 23:41:34 2009 @@ -22,6 +22,7 @@ import javolution.util.FastList; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.string.FlexibleStringExpander; import org.ofbiz.entity.GenericValue; @@ -84,7 +85,7 @@ Authorization authz = methodContext.getAuthz(); Security security = methodContext.getSecurity(); - if (action != null && action.length() > 0) { + if (UtilValidate.isNotEmpty(action)) { // run hasEntityPermission if (security.hasEntityPermission(permission, action, userLogin)) { runSubOps = true; Modified: ofbiz/trunk/framework/security/src/org/ofbiz/security/OFBizSecurity.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/security/src/org/ofbiz/security/OFBizSecurity.java?rev=883549&r1=883548&r2=883549&view=diff ============================================================================== --- ofbiz/trunk/framework/security/src/org/ofbiz/security/OFBizSecurity.java (original) +++ ofbiz/trunk/framework/security/src/org/ofbiz/security/OFBizSecurity.java Mon Nov 23 23:41:34 2009 @@ -29,6 +29,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; @@ -262,7 +263,7 @@ // if we pass all tests //Debug.logInfo("Found (" + (roleTest == null ? 0 : roleTest.size()) + ") matches :: " + roleTest, module); - if (roleTest != null && roleTest.size() > 0) return true; + if (UtilValidate.isNotEmpty(roleTest)) return true; } return false; |
Free forum by Nabble | Edit this page |