This is an automated email from the ASF dual-hosted git repository.
pawan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git
The following commit(s) were added to refs/heads/trunk by this push:
new 5545b13 Improved: Replace .size() == 0 with isEmpty() in Java
files(OFBIZ-11944)
5545b13 is described below
commit 5545b13b137fa30afe1edad97e7af0944f7dd4d8
Author: Pawan Verma <[email protected]>
AuthorDate: Sat Aug 22 19:18:38 2020 +0530
Improved: Replace .size() == 0 with isEmpty() in Java files(OFBIZ-11944)
Thanks, priya for the report and patch and jacques for the review.
---
.../apache/ofbiz/ebay/ImportOrdersFromEbay.java | 2 +-
.../apache/ofbiz/ebay/ProductsExportToEbay.java | 2 +-
.../ofbiz/ebaystore/EbayBestOfferAutoPref.java | 2 +-
.../java/org/apache/ofbiz/ebaystore/EbayStore.java | 26 +++++++-------
.../ofbiz/ebaystore/EbayStoreAutoPreferences.java | 40 +++++++++++-----------
.../apache/ofbiz/ebaystore/EbayStoreHelper.java | 8 ++---
.../apache/ofbiz/ebaystore/EbayStoreOptions.java | 6 ++--
.../apache/ofbiz/htmlreport/AbstractReport.java | 4 +--
.../org/apache/ofbiz/htmlreport/HtmlReport.java | 2 +-
.../ofbiz/htmlreport/util/ReportStringUtil.java | 8 ++---
.../apache/ofbiz/pricat/AbstractPricatParser.java | 2 +-
.../java/org/apache/ofbiz/project/Various.java | 2 +-
.../java/org/apache/ofbiz/solr/CategoryUtil.java | 2 +-
.../org/apache/ofbiz/solr/SolrProductSearch.java | 2 +-
.../apache/ofbiz/webpos/search/WebPosSearch.java | 2 +-
15 files changed, 55 insertions(+), 55 deletions(-)
diff --git a/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java
b/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java
index 40c2296..7a4aab8 100755
--- a/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java
+++ b/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java
@@ -196,7 +196,7 @@ public class ImportOrdersFromEbay {
if (orders == null) {
Debug.logError("Error :" + errorMessage.toString(), MODULE);
return ServiceUtil.returnFailure(errorMessage.toString());
- } else if (orders.size() == 0) {
+ } else if (orders.isEmpty()) {
Debug.logError("No orders found", MODULE);
return
ServiceUtil.returnFailure(UtilProperties.getMessage(RESOURCE,
"ordersImportFromEbay.noOrdersFound", locale));
} else {
diff --git a/ebay/src/main/java/org/apache/ofbiz/ebay/ProductsExportToEbay.java
b/ebay/src/main/java/org/apache/ofbiz/ebay/ProductsExportToEbay.java
index 07738dc..aa91401 100755
--- a/ebay/src/main/java/org/apache/ofbiz/ebay/ProductsExportToEbay.java
+++ b/ebay/src/main/java/org/apache/ofbiz/ebay/ProductsExportToEbay.java
@@ -304,7 +304,7 @@ public class ProductsExportToEbay {
if (categoryCode != null) {
if (categoryCode.indexOf("_") != -1) {
String[] params = categoryCode.split("_");
- if (UtilValidate.isEmpty(params) || params[1].length()
== 0) {
+ if (UtilValidate.isEmpty(params) ||
params[1].isEmpty()) {
ServiceUtil.returnFailure(UtilProperties.getMessage(RESOURCE,
"productsExportToEbay"
+
".parametersNotCorrectInGetEbayCategories", locale));
} else {
diff --git
a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java
b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java
index 2ded91a..cc41173 100644
---
a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java
+++
b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java
@@ -217,7 +217,7 @@ public class EbayBestOfferAutoPref {
String parentPrefCondId =
productStorePref.getString("parentPrefCondId");
List<GenericValue> productPref =
EntityQuery.use(delegator).from("EbayProductStorePrefCond").where("parentPrefCondId",
parentPrefCondId).queryList();
- if (productPref.size() != 0) {
+ if (!productPref.isEmpty()) {
String[] condition = {condition1, condition2, condition3,
condition4, condition5, condition6, condition7, condition8, condition9,
condition10, condition11};
Map<String, Object> ebayPrefCond = UtilMisc.<String,
Object>toMap("userLogin", userLogin);
for (int i = 0; i < productPref.size(); i++) {
diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java
b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java
index 9267e43..23123be 100644
--- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java
+++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java
@@ -235,7 +235,7 @@ public class EbayStore {
SetStoreCategoriesCall call = new
SetStoreCategoriesCall(EbayStoreHelper.getApiContext((String)
context.get("productStoreId"), locale, delegator));
catalogCategories =
EntityQuery.use(delegator).from("ProdCatalogCategory").where("prodCatalogId",
context.get("prodCatalogId").toString(), "prodCatalogCategoryTypeId",
"PCCT_EBAY_ROOT").orderBy("sequenceNum ASC").queryList();
- if (catalogCategories != null && catalogCategories.size() > 0) {
+ if (catalogCategories != null && !catalogCategories.isEmpty()) {
List<StoreCustomCategoryType> listAdd = new
LinkedList<StoreCustomCategoryType>();
List<StoreCustomCategoryType> listEdit = new
LinkedList<StoreCustomCategoryType>();
//start at level 0 of categories
@@ -255,14 +255,14 @@ public class EbayStore {
}
}
}
- if (listAdd.size() > 0) {
+ if (!listAdd.isEmpty()) {
req = new SetStoreCategoriesRequestType();
categoryArrayType = new StoreCustomCategoryArrayType();
categoryArrayType.setCustomCategory(toStoreCustomCategoryTypeArray(listAdd));
req.setStoreCategories(categoryArrayType);
result = excuteExportCategoryToEbayStore(call, req,
StoreCategoryUpdateActionCodeType.ADD, delegator,
context.get("partyId").toString(), catalogCategories, locale);
}
- if (listEdit.size() > 0) {
+ if (!listEdit.isEmpty()) {
req = new SetStoreCategoriesRequestType();
categoryArrayType = new StoreCustomCategoryArrayType();
categoryArrayType.setCustomCategory(toStoreCustomCategoryTypeArray(listEdit));
@@ -293,7 +293,7 @@ public class EbayStore {
}
}
}
- if (listAdd.size() > 0) {
+ if (!listAdd.isEmpty()) {
req = new SetStoreCategoriesRequestType();
categoryArrayType = new
StoreCustomCategoryArrayType();
categoryArrayType.setCustomCategory(toStoreCustomCategoryTypeArray(listAdd));
@@ -301,7 +301,7 @@ public class EbayStore {
req.setDestinationParentCategoryID(new
Long(ebayParentCategoryId));
result = excuteExportCategoryToEbayStore(call,
req, StoreCategoryUpdateActionCodeType.ADD, delegator,
context.get("partyId").toString(), catalogCategories, locale);
}
- if (listEdit.size() > 0) {
+ if (!listEdit.isEmpty()) {
req = new SetStoreCategoriesRequestType();
categoryArrayType = new
StoreCustomCategoryArrayType();
categoryArrayType.setCustomCategory(toStoreCustomCategoryTypeArray(listEdit));
@@ -337,7 +337,7 @@ public class EbayStore {
listEdit.add(childCategoryType);
}
}
- if (listAdd.size() > 0) {
+ if (!listAdd.isEmpty()) {
req = new SetStoreCategoriesRequestType();
categoryArrayType = new
StoreCustomCategoryArrayType();
categoryArrayType.setCustomCategory(toStoreCustomCategoryTypeArray(listAdd));
@@ -345,7 +345,7 @@ public class EbayStore {
req.setDestinationParentCategoryID(new
Long(ebayParentCategoryId));
result =
excuteExportCategoryToEbayStore(call, req,
StoreCategoryUpdateActionCodeType.ADD, delegator,
context.get("partyId").toString(), catalogCategories, locale);
}
- if (listEdit.size() > 0) {
+ if (!listEdit.isEmpty()) {
req = new SetStoreCategoriesRequestType();
categoryArrayType = new
StoreCustomCategoryArrayType();
categoryArrayType.setCustomCategory(toStoreCustomCategoryTypeArray(listEdit));
@@ -370,7 +370,7 @@ public class EbayStore {
}
public static StoreCustomCategoryType[]
toStoreCustomCategoryTypeArray(List<StoreCustomCategoryType> list) {
StoreCustomCategoryType[] storeCustomCategoryTypeArry = null;
- if (list != null && list.size() > 0) {
+ if (list != null && !list.isEmpty()) {
storeCustomCategoryTypeArry = new
StoreCustomCategoryType[list.size()];
int i = 0;
for (StoreCustomCategoryType val : list) {
@@ -594,10 +594,10 @@ public class EbayStore {
String productStoreId = (String) context.get("productStoreId");
try {
List<GenericValue> productStores =
EntityQuery.use(delegator).from("ProductStoreRole").where("productStoreId",
productStoreId, "roleTypeId", "EBAY_ACCOUNT").queryList();
- if (productStores.size() != 0) {
+ if (!productStores.isEmpty()) {
String partyId = (productStores.get(0)).getString("partyId");
List<GenericValue> userLoginStore =
EntityQuery.use(delegator).from("UserLogin").where("partyId",
partyId).queryList();
- if (userLoginStore.size() != 0) {
+ if (!userLoginStore.isEmpty()) {
String userLoginId =
(userLoginStore.get(0)).getString("userLoginId");
result.put("userLoginId", userLoginId);
}
@@ -624,10 +624,10 @@ public class EbayStore {
String partyId = null;
try {
List<GenericValue> productStoreRoles =
EntityQuery.use(delegator).from("ProductStoreRole").where("productStoreId",
context.get("productStoreId").toString(), "roleTypeId",
"EBAY_ACCOUNT").queryList();
- if (productStoreRoles.size() != 0) {
+ if (!productStoreRoles.isEmpty()) {
partyId = (String) productStoreRoles.get(0).get("partyId");
List<GenericValue> userLogins =
EntityQuery.use(delegator).from("UserLogin").where("partyId",
partyId).queryList();
- if (userLogins.size() != 0) {
+ if (!userLogins.isEmpty()) {
userLoginId = (String)
userLogins.get(0).get("userLoginId");
}
@@ -1756,7 +1756,7 @@ public class EbayStore {
serviceMap.put("userLogin", userLogin);
Map<String, Object> bidderTest =
UtilGenerics.checkMap(getEbayAllBidders(dctx, serviceMap));
List<Map<String, String>> test =
UtilGenerics.checkList(bidderTest.get("allBidders"));
- if (test.size() != 0) {
+ if (!test.isEmpty()) {
verify.setRecipientBidderUserID(test.get(0).get("userId"));
}
result.put("checkVerify", true);
diff --git
a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java
b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java
index 08cc027..5a4090f 100644
---
a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java
+++
b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java
@@ -189,7 +189,7 @@ public class EbayStoreAutoPreferences {
LeaveFeedbackCall leaveFeedbackCall = new
LeaveFeedbackCall(apiContext);
FeedbackDetailType detail = new
FeedbackDetailType();
// ramdom comments
- if (list.size() > 0) {
+ if (!list.isEmpty()) {
Collections.shuffle(list, new
Random());
comment = list.get(0);
}
@@ -256,7 +256,7 @@ public class EbayStoreAutoPreferences {
}
for (int i = 1; i <= 5; i++) {
String comment = (String)
paramMap.get("comment_".concat(String.valueOf(i)));
- if (comment != null && comment.length() > 0) {
+ if (comment != null && !comment.isEmpty()) {
if (comments == null) {
comments = comment;
} else {
@@ -408,7 +408,7 @@ public class EbayStoreAutoPreferences {
serviceMap.put("userLogin", userLogin);
//ProductStore
List<GenericValue> productStores =
EntityQuery.use(delegator).from("EbayProductStorePref").where("autoPrefJobId",
jobId).queryList();
- if (productStores.size() != 0) {
+ if (!productStores.isEmpty()) {
// get auto preference setting
String productStoreId =
productStores.get(0).getString("productStoreId");
String condition1 =
productStores.get(0).getString("condition1");
@@ -432,7 +432,7 @@ public class EbayStoreAutoPreferences {
return
ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultService));
}
List<Map<String, Object>> soldItems =
UtilGenerics.checkList(serviceResult.get("soldItems"));
- if (soldItems.size() != 0) {
+ if (!soldItems.isEmpty()) {
for (Map<String, Object> soldItemMap : soldItems) {
if
(UtilValidate.isNotEmpty(soldItemMap.get("itemId"))) {
GenericValue productCheck =
EntityQuery.use(delegator).from("Product").where("productId",
soldItemMap.get("itemId")).queryOne();
@@ -448,7 +448,7 @@ public class EbayStoreAutoPreferences {
}
// ProductRole (VENDOR)
List<GenericValue> productRole =
EntityQuery.use(delegator).from("ProductRole").where("partyId", partyId,
"productId", soldItemMap.get("itemId"), "roleTypeId", "VENDOR").queryList();
- if (productRole.size() == 0) {
+ if (productRole.isEmpty()) {
Map<String, Object> addRole = new
HashMap<>();
addRole.put("productId",
soldItemMap.get("itemId"));
addRole.put("roleTypeId", "VENDOR");
@@ -474,7 +474,7 @@ public class EbayStoreAutoPreferences {
}
List<Map<String, Object>> activeItems =
UtilGenerics.checkList(serviceResult.get("activeItems"));
List<String> activeItemMaps = new LinkedList<>();
- if (activeItems.size() != 0) {
+ if (!activeItems.isEmpty()) {
for (Map<String, Object> activeItem : activeItems) {
Map<String, Object> activeItemMap =
UtilGenerics.checkMap(activeItem);
if
(UtilValidate.isNotEmpty(activeItemMap.get("itemId"))) {
@@ -485,7 +485,7 @@ public class EbayStoreAutoPreferences {
//check product role
List<GenericValue> productRoles =
EntityQuery.use(delegator).from("ProductRole").where("partyId", partyId,
"roleTypeId", "VENDOR").queryList();
List<String> productRoleIds = new LinkedList<>();
- if (productRoles.size() != 0) {
+ if (!productRoles.isEmpty()) {
for (GenericValue productRole : productRoles) {
String productId =
productRole.getString("productId");
productRoleIds.add(productId);
@@ -501,7 +501,7 @@ public class EbayStoreAutoPreferences {
EntityCondition productRole =
EntityCondition.makeCondition("productId", EntityOperator.IN, productRoleIds);
andExpr.add(productRole);
List<GenericValue> itemsToRelist =
EntityQuery.use(delegator).from("Product").where(andExpr).queryList();
- if (itemsToRelist.size() != 0) {
+ if (!itemsToRelist.isEmpty()) {
//re-list sold items and not active
ApiContext apiContext =
EbayStoreHelper.getApiContext(productStoreId, locale, delegator);
for (GenericValue genericValue : itemsToRelist) {
@@ -533,7 +533,7 @@ public class EbayStoreAutoPreferences {
try {
GenericValue userLogin =
EntityQuery.use(delegator).from("UserLogin").where("userLoginId",
"system").queryOne();
List<GenericValue> productStores =
EntityQuery.use(delegator).from("EbayProductStorePref").where("autoPrefJobId",
jobId).queryList();
- if (productStores.size() != 0) {
+ if (!productStores.isEmpty()) {
// get automatic setting
String productStoreId =
productStores.get(0).getString("productStoreId");
String condition1 =
productStores.get(0).getString("condition1");
@@ -575,7 +575,7 @@ public class EbayStoreAutoPreferences {
}
}
// Dispute items
- if (disputeReason != null && disputeExplanation != null &&
itemsToDispute.size() != 0) {
+ if (disputeReason != null && disputeExplanation != null &&
!itemsToDispute.isEmpty()) {
ApiContext apiContext =
EbayStoreHelper.getApiContext(productStoreId, locale, delegator);
DetailLevelCodeType[] detailLevels = new
DetailLevelCodeType[]{
DetailLevelCodeType.RETURN_ALL,
@@ -606,7 +606,7 @@ public class EbayStoreAutoPreferences {
try {
GenericValue userLogin =
EntityQuery.use(delegator).from("UserLogin").where("userLoginId",
"system").queryOne();
List<GenericValue> productStores =
EntityQuery.use(delegator).from("EbayProductStorePref").where("autoPrefJobId",
jobId).queryList();
- if (productStores.size() != 0) {
+ if (!productStores.isEmpty()) {
// get automatic setting
String productStoreId =
productStores.get(0).getString("productStoreId");
String condition1 =
productStores.get(0).getString("condition1");
@@ -648,7 +648,7 @@ public class EbayStoreAutoPreferences {
}
}
// Dispute items
- if (disputeReason != null && disputeExplanation != null &&
itemsToDispute.size() != 0) {
+ if (disputeReason != null && disputeExplanation != null &&
!itemsToDispute.isEmpty()) {
ApiContext apiContext =
EbayStoreHelper.getApiContext(productStoreId, locale, delegator);
DetailLevelCodeType[] detailLevels = new
DetailLevelCodeType[]{
DetailLevelCodeType.RETURN_ALL,
@@ -775,7 +775,7 @@ public class EbayStoreAutoPreferences {
Map<String, Object> mymap = new HashMap<>();
mymap.put("group", "");
mymap.put("soldorder", sellingManagerSoldOrder);
- if (h.size() > 0) {
+ if (!h.isEmpty()) {
Enumeration<String> enums = h.keys();
String key = "";
while (enums.hasMoreElements()) {
@@ -810,7 +810,7 @@ public class EbayStoreAutoPreferences {
Map<String, Object> myMap =
soldGroupList.get(j);
SellingManagerSoldOrderType soldorder =
(SellingManagerSoldOrderType) myMap.get("soldorder");
Timestamp createdate =
UtilDateTime.toTimestamp(soldorder.getCreationTime().getTime());
- if (myMap.get("group").toString().length() ==
0) {
+ if (myMap.get("group").toString().isEmpty()) {
beginDate = createdate;
}
beginDate = findStartDate(beginDate,
soldGroupList);
@@ -911,7 +911,7 @@ public class EbayStoreAutoPreferences {
SellingManagerSoldOrderType soldorder =
(SellingManagerSoldOrderType) inMap.get("soldorder");
Timestamp createTimestamp =
UtilDateTime.toTimestamp(soldorder.getCreationTime().getTime());
String group = (String) inMap.get("group");
- if (createTimestamp.before(lessStartTimestamp) && group.length()
== 0) {
+ if (createTimestamp.before(lessStartTimestamp) && group.isEmpty())
{
lessStartTimestamp = createTimestamp;
}
}
@@ -923,7 +923,7 @@ public class EbayStoreAutoPreferences {
for (Map<String, Object> inMap : inList) {
String group = inMap.get("group").toString();
SellingManagerSoldOrderType soldorder =
(SellingManagerSoldOrderType) inMap.get("soldorder");
- if (group.length() == 0) {
+ if (group.isEmpty()) {
Timestamp createtimestamp =
UtilDateTime.toTimestamp(soldorder.getCreationTime().getTime());
if (((createtimestamp.equals(startTimestamp)) ||
(createtimestamp.after(startTimestamp))) && (createtimestamp.before(endDate))) {
inMap.put("group", "" + groupRunning);
@@ -945,7 +945,7 @@ public class EbayStoreAutoPreferences {
return
ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultSold));
}
List<Map<String, Object>> soldItems =
UtilGenerics.checkList(resultSold.get("soldItems"));
- if (soldItems.size() != 0) {
+ if (!soldItems.isEmpty()) {
for (Map<String, Object> item : soldItems) {
Timestamp lastestTime =
UtilDateTime.getDayStart(UtilDateTime.nowTimestamp(), 1);
Date creationDate = (Date) item.get("creationTime");
@@ -963,7 +963,7 @@ public class EbayStoreAutoPreferences {
}
List<Map<String, Object>> allBidders =
UtilGenerics.checkList(resultBid.get("allBidders"));
- if (allBidders.size() != 0) {
+ if (!allBidders.isEmpty()) {
// call to send email to bidder
for (Map<String, Object> bidder : allBidders) {
UserType user = (UserType)
bidder.get("bidder");
@@ -1020,7 +1020,7 @@ public class EbayStoreAutoPreferences {
return
ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultSold));
}
List<Map<String, Object>> soldItems =
UtilGenerics.checkList(resultSold.get("soldItems"));
- if (soldItems.size() != 0) {
+ if (!soldItems.isEmpty()) {
for (Map<String, Object> item : soldItems) {
String shippedStatus =
item.get("shippedStatus").toString();
Timestamp lastestTime =
UtilDateTime.getDayStart(UtilDateTime.nowTimestamp(), 1);
@@ -1355,7 +1355,7 @@ public class EbayStoreAutoPreferences {
}
}
- if (acceptBestOfferIndexId.size() > 0) {
+ if (!acceptBestOfferIndexId.isEmpty()) {
int quantityAvailable = inventoryQuantityItem;
acceptBestOfferIndexId.sort(null);
RespondToBestOfferCall respondAcceptBestOfferCall
= new RespondToBestOfferCall(apiContext);
diff --git
a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java
b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java
index 64fde81..3f929ba 100644
--- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java
+++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java
@@ -192,7 +192,7 @@ public class EbayStoreHelper {
return ebayCategoryId;
}
productCategoryRoles =
EntityQuery.use(delegator).from("ProductCategoryRole").where("productCategoryId",
productCategoryId, "partyId", partyId, "roleTypeId",
"EBAY_ACCOUNT").queryList();
- if (productCategoryRoles != null && productCategoryRoles.size()>0)
{
+ if (productCategoryRoles != null &&
!productCategoryRoles.isEmpty()) {
for (GenericValue productCategoryRole : productCategoryRoles) {
ebayCategoryId = productCategoryRole.getString("comments");
}
@@ -275,7 +275,7 @@ public class EbayStoreHelper {
String jobId = ebayProductPref.getString("autoPrefJobId");
if (UtilValidate.isNotEmpty(jobId)) {
List<GenericValue> jobs =
EntityQuery.use(delegator).from("JobSandbox").where("parentJobId", jobId,
"statusId", "SERVICE_PENDING").queryList();
- if (jobs.size() == 0) {
+ if (jobs.isEmpty()) {
Map<String, Object>inMap = new HashMap<>();
inMap.put("jobId", jobId);
inMap.put("userLogin", userLogin);
@@ -621,7 +621,7 @@ public class EbayStoreHelper {
if (orderHeader != null) {
String externalId = orderHeader.getString("externalId").toString();
List<GenericValue> orderShipment =
orderHeader.getRelated("OrderShipment", null, null, false);
- if (orderShipment.size() > 0) {
+ if (!orderShipment.isEmpty()) {
List<GenericValue> trackingOrders =
orderHeader.getRelated("TrackingCodeOrder", null, null, false);
ApiContext apiContext =
EbayStoreHelper.getApiContext(productStoreId, locale, delegator);
GetOrdersCall ordersCall = new GetOrdersCall(apiContext);
@@ -649,7 +649,7 @@ public class EbayStoreHelper {
AddOrderResponseType addResp = null;
OrderType newOrder = new OrderType();
ShippingDetailsType shippingDetail =
order.getShippingDetails();
- if (trackingOrders.size() > 0) {
+ if (!trackingOrders.isEmpty()) {
ShipmentTrackingDetailsType[] trackDetails =
new ShipmentTrackingDetailsType[trackingOrders.size()];
for (int i = 0; i < trackDetails.length; i++) {
ShipmentTrackingDetailsType track = new
ShipmentTrackingDetailsType();
diff --git
a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOptions.java
b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOptions.java
index 182bc57..2621edc 100644
--- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOptions.java
+++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOptions.java
@@ -137,7 +137,7 @@ public class EbayStoreOptions {
if (UtilValidate.isNotEmpty(addItemObj.get(refName))) {
EbayStoreCategoryFacade cf = (EbayStoreCategoryFacade)
addItemObj.get(refName);
List<Map<String, Object>> theme =
cf.getAdItemTemplates(temGroupId);
- if (theme.size() > 0) {
+ if (!theme.isEmpty()) {
request.setAttribute("itemTemplates", theme);
}
}
@@ -178,7 +178,7 @@ public class EbayStoreOptions {
context.put("IsLeafCategory", isLeaf);
categories.add(context);
}
- if (categories.size() > 0) {
+ if (!categories.isEmpty()) {
request.setAttribute("categories", categories);
}
}
@@ -230,7 +230,7 @@ public class EbayStoreOptions {
context.put("IsLeafCategory", isLeaf);
categories.add(context);
}
- if (categories.size() > 0) {
+ if (!categories.isEmpty()) {
request.setAttribute("categories", categories);
}
}
diff --git
a/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java
b/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java
index f1bf262..5d1be4a 100644
--- a/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java
+++ b/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java
@@ -121,12 +121,12 @@ public abstract class AbstractReport implements
InterfaceReport {
@Override
public boolean hasError() {
- return (errors.size() > 0);
+ return (!errors.isEmpty());
}
@Override
public boolean hasWarning() {
- return (warnings.size() > 0);
+ return (!warnings.isEmpty());
}
@Override
diff --git a/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java
b/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java
index 3adabb6..73e5cfa 100644
--- a/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java
+++ b/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java
@@ -259,7 +259,7 @@ public class HtmlReport extends AbstractReport {
}
}
indexNext = isTransient ? 0 : indexEnd;
- if (isTransient && logFileOutputStream != null &&
logResult.toString().length() > 0) {
+ if (isTransient && logFileOutputStream != null &&
!logResult.toString().isEmpty()) {
try {
logFileOutputStream.write((logResult.toString() +
"\n").getBytes());
logFileOutputStream.flush();
diff --git
a/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ReportStringUtil.java
b/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ReportStringUtil.java
index b5b2c3d..373fdfb 100644
---
a/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ReportStringUtil.java
+++
b/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ReportStringUtil.java
@@ -250,7 +250,7 @@ public final class ReportStringUtil {
*/
public static boolean isEmpty(String value) {
- return (value == null) || (value.length() == 0);
+ return (value == null) || (value.isEmpty());
}
/**
@@ -261,7 +261,7 @@ public final class ReportStringUtil {
*/
public static boolean isEmptyOrWhitespaceOnly(String value) {
- return isEmpty(value) || (value.trim().length() == 0);
+ return isEmpty(value) || (value.trim().isEmpty());
}
/**
@@ -288,7 +288,7 @@ public final class ReportStringUtil {
*/
public static boolean isNotEmpty(String value) {
- return (value != null) && (value.length() != 0);
+ return (value != null) && (!value.isEmpty());
}
/**
@@ -300,7 +300,7 @@ public final class ReportStringUtil {
*/
public static boolean isNotEmptyOrWhitespaceOnly(String value) {
- return (value != null) && (value.trim().length() > 0);
+ return (value != null) && (!value.trim().isEmpty());
}
/**
diff --git
a/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java
b/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java
index eca0871..3644ac3 100644
--- a/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java
+++ b/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java
@@ -318,7 +318,7 @@ public abstract class AbstractPricatParser implements
InterfacePricatParser {
plainFont.setFontHeightInPoints((short) 9);
XSSFSheet errorSheet = null;
- if (errorMessages.keySet().size() > 0) {
+ if (!errorMessages.keySet().isEmpty()) {
String errorSheetName = UtilDateTime.nowDateString("yyyy-MM-dd
HHmm") + " Errors";
errorSheetName = WorkbookUtil.createSafeSheetName(errorSheetName);
errorSheet = workbook.createSheet(errorSheetName);
diff --git a/projectmgr/src/main/java/org/apache/ofbiz/project/Various.java
b/projectmgr/src/main/java/org/apache/ofbiz/project/Various.java
index 5d09fba..9c87ec9 100644
--- a/projectmgr/src/main/java/org/apache/ofbiz/project/Various.java
+++ b/projectmgr/src/main/java/org/apache/ofbiz/project/Various.java
@@ -94,7 +94,7 @@ public class Various {
if (timesheetId != null) {
try {
List<GenericValue> actuals =
EntityQuery.use(delegator).from("TimeEntry").where("timesheetId",
timesheetId).queryList();
- if (actuals.size() > 0) {
+ if (!actuals.isEmpty()) {
for (GenericValue actual : actuals) {
Double hour = (Double) actual.get("hours");
double hours = hour;
diff --git a/solr/src/main/java/org/apache/ofbiz/solr/CategoryUtil.java
b/solr/src/main/java/org/apache/ofbiz/solr/CategoryUtil.java
index 8aa7a01..760fc48 100644
--- a/solr/src/main/java/org/apache/ofbiz/solr/CategoryUtil.java
+++ b/solr/src/main/java/org/apache/ofbiz/solr/CategoryUtil.java
@@ -105,7 +105,7 @@ public final class CategoryUtil {
Debug.logError(e, "Cannot generate trail from product
category", MODULE);
}
}
- if (trailElements.size() == 0) {
+ if (trailElements.isEmpty()) {
List<String> trailElement = new ArrayList<>();
trailElement.add(productCategoryId);
trailElements.add(trailElement);
diff --git a/solr/src/main/java/org/apache/ofbiz/solr/SolrProductSearch.java
b/solr/src/main/java/org/apache/ofbiz/solr/SolrProductSearch.java
index 473ccc5..670c879 100644
--- a/solr/src/main/java/org/apache/ofbiz/solr/SolrProductSearch.java
+++ b/solr/src/main/java/org/apache/ofbiz/solr/SolrProductSearch.java
@@ -333,7 +333,7 @@ public abstract class SolrProductSearch {
}
// if ((Boolean) context.get("sortByReverse"))order.reverse();
- if ((String) context.get("sortBy") != null && ((String)
context.get("sortBy")).length() > 0) {
+ if ((String) context.get("sortBy") != null && !((String)
context.get("sortBy")).isEmpty()) {
SolrQuery.ORDER order;
if (!((Boolean) context.get("sortByReverse"))) {
order = SolrQuery.ORDER.asc;
diff --git
a/webpos/src/main/java/org/apache/ofbiz/webpos/search/WebPosSearch.java
b/webpos/src/main/java/org/apache/ofbiz/webpos/search/WebPosSearch.java
index f69142c..2ba6161 100644
--- a/webpos/src/main/java/org/apache/ofbiz/webpos/search/WebPosSearch.java
+++ b/webpos/src/main/java/org/apache/ofbiz/webpos/search/WebPosSearch.java
@@ -138,7 +138,7 @@ public class WebPosSearch {
if (UtilValidate.isNotEmpty(shippingLocation) &&
"Y".equalsIgnoreCase(shippingLocation)) {
orExprs.add(EntityCondition.makeCondition("contactMechPurposeTypeId",
EntityOperator.EQUALS, "SHIPPING_LOCATION"));
}
- if (orExprs.size() > 0) {
+ if (!orExprs.isEmpty()) {
andExprs.add(EntityCondition.makeCondition(orExprs,
EntityOperator.OR));
}
andExprs.add(EntityCondition.makeCondition("partyTypeId",
EntityOperator.EQUALS, "PERSON"));