You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mt...@apache.org on 2019/04/07 23:02:39 UTC
svn commit: r1857089 - in /ofbiz/ofbiz-framework/trunk:
applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/
applications/content/src/main/java/org/apache/ofbiz/content/
applications/content/src/main/java/org/apache/ofbiz/content/...
Author: mthl
Date: Sun Apr 7 23:02:39 2019
New Revision: 1857089
URL: http://svn.apache.org/viewvc?rev=1857089&view=rev
Log:
Improved: Remove redundant null checks (OFBIZ-10911)
Redundant null checks detected by Eclipse has been removed.
Modified:
ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java
ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java
ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java
ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java
ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java
ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java
ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java
ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/NotificationServices.java
ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeServices.java
ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMapProcessor.java
ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/Iterate.java
ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/SOAPEventHandler.java
ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java
ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTree.java
Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java Sun Apr 7 23:02:39 2019
@@ -212,8 +212,7 @@ public class PaymentMethodServices {
// add a PartyContactMechPurpose of BILLING_LOCATION if necessary
String contactMechPurposeTypeId = "BILLING_LOCATION";
- GenericValue tempVal = null;
-
+ GenericValue tempVal;
try {
List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();
@@ -393,8 +392,7 @@ public class PaymentMethodServices {
// add a PartyContactMechPurpose of BILLING_LOCATION if necessary
String contactMechPurposeTypeId = "BILLING_LOCATION";
- GenericValue tempVal = null;
-
+ GenericValue tempVal;
try {
List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();
@@ -740,7 +738,7 @@ public class PaymentMethodServices {
// add a PartyContactMechPurpose of BILLING_LOCATION if necessary
String contactMechPurposeTypeId = "BILLING_LOCATION";
- GenericValue tempVal = null;
+ GenericValue tempVal;
try {
List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();
@@ -871,8 +869,7 @@ public class PaymentMethodServices {
// add a PartyContactMechPurpose of BILLING_LOCATION if necessary
String contactMechPurposeTypeId = "BILLING_LOCATION";
- GenericValue tempVal = null;
-
+ GenericValue tempVal;
try {
List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();
@@ -976,7 +973,7 @@ public class PaymentMethodServices {
// add a PartyContactMechPurpose of BILLING_LOCATION if necessary
String contactMechPurposeTypeId = "BILLING_LOCATION";
- GenericValue tempVal = null;
+ GenericValue tempVal;
try {
List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();
@@ -1098,8 +1095,7 @@ public class PaymentMethodServices {
// add a PartyContactMechPurpose of BILLING_LOCATION if necessary
String contactMechPurposeTypeId = "BILLING_LOCATION";
- GenericValue tempVal = null;
-
+ GenericValue tempVal;
try {
List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();
Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java Sun Apr 7 23:02:39 2019
@@ -222,7 +222,6 @@ public class ContentManagementEvents {
Timestamp origFromDate = null;
for (Object [] pubArr : origSubList) {
Timestamp fromDate = (Timestamp)pubArr[2];
- origSubContentId = null;
if (fromDate != null) {
origSubContentId = (String)pubArr[0];
origFromDate = fromDate;
Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java Sun Apr 7 23:02:39 2019
@@ -163,10 +163,8 @@ public class ContentManagementServices {
List<String> tmpPurposes = StringUtil.split(contentPurposeString, "|");
contentPurposeList.addAll(tmpPurposes);
}
- if (contentPurposeList != null) {
- context.put("contentPurposeList", contentPurposeList);
- context.put("contentPurposeString", null);
- }
+ context.put("contentPurposeList", contentPurposeList);
+ context.put("contentPurposeString", null);
if (Debug.infoOn()) {
Debug.logInfo("in persist... contentPurposeList(0):" + contentPurposeList, module);
Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java Sun Apr 7 23:02:39 2019
@@ -195,7 +195,7 @@ public class ContentWorker implements or
custMethod = EntityQuery.use(delegator).from("CustomMethod").where("customMethodId", content.get("customMethodId")).cache().queryOne();
}
if (custMethod != null) serviceName = custMethod.getString("customMethodName");
- if (dispatcher != null && UtilValidate.isNotEmpty(serviceName)) {
+ if (UtilValidate.isNotEmpty(serviceName)) {
DispatchContext dctx = dispatcher.getDispatchContext();
ModelService service = dctx.getModelService(serviceName);
if (service != null) {
Modified: ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java Sun Apr 7 23:02:39 2019
@@ -350,11 +350,9 @@ public class BOMNode {
oneChildNode = new BOMNode(oneChild.getString("productId"), delegator, dispatcher, userLogin);
// Configurator
// If the node is null this means that the node has been discarded by the rules.
- if (oneChildNode != null) {
- oneChildNode.setParentNode(this);
- oneChildNode.setTree(tree);
- oneChildNode.loadParents(partBomTypeId, inDate, productFeatures);
- }
+ oneChildNode.setParentNode(this);
+ oneChildNode.setTree(tree);
+ oneChildNode.loadParents(partBomTypeId, inDate, productFeatures);
childrenNodes.add(oneChildNode);
}
}
Modified: ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java Sun Apr 7 23:02:39 2019
@@ -319,16 +319,16 @@ public class BOMServices {
fromDate = new Date();
}
- BOMTree tree = null;
+ BOMTree tree;
try {
tree = new BOMTree(productId, bomType, fromDate, type, delegator, dispatcher, userLogin);
} catch (GenericEntityException gee) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale));
}
- if (tree != null && quantity != null) {
+ if (quantity != null) {
tree.setRootQuantity(quantity);
}
- if (tree != null && amount != null) {
+ if (amount != null) {
tree.setRootAmount(amount);
}
result.put("tree", tree);
Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java Sun Apr 7 23:02:39 2019
@@ -1253,9 +1253,7 @@ public class OrderServices {
Map<String, Object> reserveResult = dispatcher.runSync("reserveStoreInventory", reserveInput);
if (ServiceUtil.isError(reserveResult)) {
String invErrMsg = "The product ";
- if (product != null) {
- invErrMsg += getProductName(product, orderItem);
- }
+ invErrMsg += getProductName(product, orderItem);
invErrMsg += " with ID " + orderItem.getString("productId") + " is no longer in stock. Please try reducing the quantity or removing the product from this order.";
resErrorMessages.add(invErrMsg);
}
@@ -5984,10 +5982,8 @@ public class OrderServices {
if (rowNumber == null) {
Long count = EntityQuery.use(delegator).from("OrderItemShipGroupAssoc").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryCount();
- if (count != null) {
- rowNumber = count.intValue();
- result.put("rowNumber", rowNumber);
- }
+ rowNumber = count.intValue();
+ result.put("rowNumber", rowNumber);
}
//find OISG Assoc
@@ -6099,7 +6095,7 @@ public class OrderServices {
result.put("totalQuantity", totalQuantity);
//Only for multi service calling and the last row : test if orderItem quantity equals OrderItemShipGroupAssocs quantitys
- if (rowCount != null && rowNumber != null ) {
+ if (rowCount != null) {
int rowCountInt = rowCount;
int rowNumberInt = rowNumber;
if (rowCountInt == rowNumberInt - 1) {
Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java Sun Apr 7 23:02:39 2019
@@ -435,18 +435,20 @@ public class CheckOutEvents {
public static String checkoutValidation(HttpServletRequest request, HttpServletResponse response) {
ShoppingCart cart = (ShoppingCart) request.getSession().getAttribute("shoppingCart");
if (cart.isSalesOrder()) {
- List<GenericValue> paymentMethodTypes = cart.getPaymentMethodTypes();
- if (UtilValidate.isEmpty(paymentMethodTypes)) {
- String errMsg = UtilProperties.getMessage(resource_error, "OrderNoPaymentMethodTypeSelected", (cart != null ? cart.getLocale() : UtilHttp.getLocale(request)));
- request.setAttribute("_ERROR_MESSAGE_",errMsg);
- return "error";
- }
- String shipmentMethod = cart.getShipmentMethodTypeId();
- if (UtilValidate.isEmpty(shipmentMethod)) {
- String errMsg = UtilProperties.getMessage(resource_error, "OrderNoShipmentMethodSelected", (cart != null ? cart.getLocale() : UtilHttp.getLocale(request)));
- request.setAttribute("_ERROR_MESSAGE_",errMsg);
- return "error";
- }
+ List<GenericValue> paymentMethodTypes = cart.getPaymentMethodTypes();
+ if (UtilValidate.isEmpty(paymentMethodTypes)) {
+ String errMsg = UtilProperties.getMessage(resource_error, "OrderNoPaymentMethodTypeSelected",
+ cart.getLocale());
+ request.setAttribute("_ERROR_MESSAGE_",errMsg);
+ return "error";
+ }
+ String shipmentMethod = cart.getShipmentMethodTypeId();
+ if (UtilValidate.isEmpty(shipmentMethod)) {
+ String errMsg = UtilProperties.getMessage(resource_error, "OrderNoShipmentMethodSelected",
+ cart.getLocale());
+ request.setAttribute("_ERROR_MESSAGE_",errMsg);
+ return "error";
+ }
}
return "success";
}
Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java Sun Apr 7 23:02:39 2019
@@ -4706,7 +4706,7 @@ public class ShoppingCart implements Ite
Delegator delegator = cart.delegator;
//check information from the cart ship info
try {
- if (originAddress == null && facilityId != null) {
+ if (facilityId != null) {
originAddress = ShippingEvents.getShippingOriginContactMechFromFacility(delegator, facilityId);
}
if (originAddress == null && supplierPartyId != null) {
Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java Sun Apr 7 23:02:39 2019
@@ -471,7 +471,7 @@ public class ShoppingListEvents {
Debug.logError(e, module);
}
cart.setAutoSaveListId(autoSaveListId);
- } else if (userLogin != null) {
+ } else {
String existingAutoSaveListId = null;
try {
existingAutoSaveListId = getAutoSaveListId(delegator, dispatcher, null, userLogin, cart.getProductStoreId());
@@ -519,7 +519,7 @@ public class ShoppingListEvents {
if (okayToLoad) {
String prodCatalogId = CatalogWorker.getCurrentCatalogId(request);
try {
- addListToCart(delegator, dispatcher, cart, prodCatalogId, autoSaveListId, false, false, userLogin != null ? true : false);
+ addListToCart(delegator, dispatcher, cart, prodCatalogId, autoSaveListId, false, false, true);
cart.setLastListRestore(UtilDateTime.nowTimestamp());
} catch (IllegalArgumentException e) {
Debug.logError(e, module);
Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java Sun Apr 7 23:02:39 2019
@@ -171,7 +171,7 @@ public class ShoppingListServices {
// store the order
Map<String, Object> createResp = helper.createOrder(userLogin);
- if (createResp == null || (createResp != null && ServiceUtil.isError(createResp))) {
+ if (createResp == null || ServiceUtil.isError(createResp)) {
Debug.logError("Cannot create order for shopping list - " + shoppingList, module);
} else {
Modified: ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java Sun Apr 7 23:02:39 2019
@@ -157,7 +157,7 @@ public class ContactMechServices {
}
String contactMechId = (String) context.get("contactMechId");
- GenericValue contactMech = null;
+ GenericValue contactMech;
GenericValue partyContactMech = null;
try {
@@ -427,7 +427,7 @@ public class ContactMechServices {
}
String contactMechId = (String) context.get("contactMechId");
- GenericValue contactMech = null;
+ GenericValue contactMech;
GenericValue partyContactMech = null;
try {
@@ -469,8 +469,7 @@ public class ContactMechServices {
GenericValue relatedEntityToSet = null;
if ("POSTAL_ADDRESS".equals(contactMech.getString("contactMechTypeId"))) {
- GenericValue addr = null;
-
+ GenericValue addr;
try {
addr = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", contactMechId).queryOne();
} catch (GenericEntityException e) {
@@ -669,7 +668,6 @@ public class ContactMechServices {
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
contactMech = null;
- partyContactMech = null;
}
if (contactMech == null) {
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -687,8 +685,7 @@ public class ContactMechServices {
GenericValue relatedEntityToSet = null;
if ("TELECOM_NUMBER".equals(contactMech.getString("contactMechTypeId"))) {
- GenericValue telNum = null;
-
+ GenericValue telNum;
try {
telNum = EntityQuery.use(delegator).from("TelecomNumber").where("contactMechId", contactMechId).queryOne();
} catch (GenericEntityException e) {
@@ -834,7 +831,7 @@ public class ContactMechServices {
String contactMechPurposeTypeId = (String) context.get("contactMechPurposeTypeId");
Timestamp fromDate = (Timestamp) context.get("fromDate");
- GenericValue tempVal = null;
+ GenericValue tempVal;
try {
tempVal = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId)
Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java Sun Apr 7 23:02:39 2019
@@ -249,7 +249,7 @@ public class CategoryServices {
Debug.logError(e.getMessage(), module);
}
- GenericValue productCategory = null;
+ GenericValue productCategory;
try {
productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", productCategoryId).cache().queryOne();
} catch (GenericEntityException e) {
Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java Sun Apr 7 23:02:39 2019
@@ -18,7 +18,6 @@
*******************************************************************************/
package org.apache.ofbiz.product.category;
-import java.io.FileInputStream;
import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
@@ -101,7 +100,6 @@ public final class SeoConfigUtil {
* Initialize url regular express configuration.
*/
public static void init() {
- FileInputStream configFileIS = null;
String result = "success";
seoPatterns = new HashMap<String, Pattern>();
seoReplacements = new HashMap<String, String>();
@@ -322,15 +320,6 @@ public final class SeoConfigUtil {
} catch (IOException e) {
result = "error";
Debug.logError(e, module);
- } finally {
- if (configFileIS != null) {
- try {
- configFileIS.close();
- } catch (IOException e) {
- result = "error";
- Debug.logError(e, module);
- }
- }
}
if (seoReplacements.keySet().isEmpty()) {
useUrlRegexp = false;
Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java Sun Apr 7 23:02:39 2019
@@ -79,10 +79,9 @@ public final class ProductConfigWorker {
} else {
configWrapper = new ProductConfigWrapper(configWrapper);
}
- } catch (ProductConfigWrapperException we) {
- configWrapper = null;
} catch (Exception e) {
Debug.logWarning(e.getMessage(), module);
+ configWrapper = null;
}
return configWrapper;
}
Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java Sun Apr 7 23:02:39 2019
@@ -281,7 +281,6 @@ public class ProductEvents {
productAssoc = EntityQuery.use(delegator).from(tempProductAssoc.getEntityName()).where(tempProductAssoc.getPrimaryKey()).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
- productAssoc = null;
}
if (productAssoc == null) {
errMsg = UtilProperties.getMessage(resource,"productevents.could_not_remove_product_association_exist", UtilHttp.getLocale(request));
@@ -348,8 +347,7 @@ public class ProductEvents {
request.setAttribute("ProductAssocCreateFromDate", fromDate);
}
- GenericValue productAssoc = null;
-
+ GenericValue productAssoc;
try {
productAssoc = EntityQuery.use(delegator).from(tempProductAssoc.getEntityName()).where(tempProductAssoc.getPrimaryKey()).queryOne();
} catch (GenericEntityException e) {
Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java Sun Apr 7 23:02:39 2019
@@ -517,7 +517,7 @@ public class UpsServices {
UtilXml.addChildElementValue(dimensionsElement, "Length", UtilValidate.isNotEmpty(boxLength) ? ""+boxLength.intValue() : "", shipmentConfirmRequestDoc);
UtilXml.addChildElementValue(dimensionsElement, "Width", UtilValidate.isNotEmpty(boxWidth) ? ""+boxWidth.intValue() : "", shipmentConfirmRequestDoc);
UtilXml.addChildElementValue(dimensionsElement, "Height", UtilValidate.isNotEmpty(boxHeight) ? ""+boxHeight.intValue() : "", shipmentConfirmRequestDoc);
- } else if (shipmentPackage != null && UtilValidate.isNotEmpty(shipmentPackage.getBigDecimal("boxLength"))
+ } else if (UtilValidate.isNotEmpty(shipmentPackage.getBigDecimal("boxLength"))
&& UtilValidate.isNotEmpty(shipmentPackage.getBigDecimal("boxWidth"))
&& UtilValidate.isNotEmpty(shipmentPackage.getBigDecimal("boxHeight"))) {
Element dimensionsElement = UtilXml.addChildElement(packageElement, "Dimensions", shipmentConfirmRequestDoc);
Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java Sun Apr 7 23:02:39 2019
@@ -197,9 +197,7 @@ public final class ScriptUtil {
localContext.put("context", context);
ScriptContext scriptContext = new SimpleScriptContext();
ScriptHelper helper = new ScriptHelperImpl(scriptContext);
- if (helper != null) {
- localContext.put(SCRIPT_HELPER_KEY, helper);
- }
+ localContext.put(SCRIPT_HELPER_KEY, helper);
Bindings bindings = new SimpleBindings(localContext);
scriptContext.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
return scriptContext;
Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java Sun Apr 7 23:02:39 2019
@@ -136,7 +136,6 @@ public final class UtilURL {
}
} catch (java.net.MalformedURLException e) {
Debug.logError(e, "unable to retrieve URL for file: " + filename, module);
- url = null;
}
return url;
}
Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java Sun Apr 7 23:02:39 2019
@@ -341,7 +341,7 @@ public final class FreeMarkerWorker {
@SuppressWarnings("unchecked")
public static <T> T unwrap(Object o) {
- Object returnObj = null;
+ Object returnObj;
if (o == TemplateModel.NOTHING) {
returnObj = null;
@@ -349,6 +349,8 @@ public final class FreeMarkerWorker {
returnObj = o.toString();
} else if (o instanceof BeanModel) {
returnObj = ((BeanModel) o).getWrappedObject();
+ } else {
+ returnObj = null;
}
return (T) returnObj;
Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/NotificationServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/NotificationServices.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/NotificationServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/email/NotificationServices.java Sun Apr 7 23:02:39 2019
@@ -139,7 +139,6 @@ public class NotificationServices {
} else {
// otherwise just report the error
Debug.logError("prepareNotification failed: " + bodyResult.get(ModelService.ERROR_MESSAGE), module);
- body = null;
}
}
Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeServices.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeServices.java Sun Apr 7 23:02:39 2019
@@ -139,9 +139,7 @@ public class QRCodeServices {
if (UtilValidate.isEmpty(defaultLogoImage)) {
Debug.logError("Your logo image file(" + qrCodeDefaultLogoImage + ") cannot be read by javax.imageio.ImageIO. Please use png, jpeg formats instead of ico and etc.", module);
}
- } catch (IllegalArgumentException e) {
- defaultLogoImage = null;
- } catch (IOException e) {
+ } catch (IllegalArgumentException | IOException e) {
defaultLogoImage = null;
}
}
Modified: ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java Sun Apr 7 23:02:39 2019
@@ -573,8 +573,6 @@ public class Record implements Serializa
catch (NoSuchElementException nsee) {
throw new DataFileException("Field " + modelField.name + " could not be read from a line (" + lineNum + ") with only " + line.length() + " chars.", nsee);
}
- } else { //if input line is less than the header model then pad with null
- strVal = null;
}
}
try {
Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java Sun Apr 7 23:02:39 2019
@@ -1271,7 +1271,7 @@ public class GenericDelegator implements
if (!primaryKey.isPrimaryKey()) {
throw new GenericModelException("[GenericDelegator.storeAll] One of the passed primary keys is not a valid primary key: " + primaryKey);
}
- GenericValue existing = null;
+ GenericValue existing;
try {
existing = helper.findByPrimaryKey(primaryKey);
} catch (GenericEntityNotFoundException e) {
Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java Sun Apr 7 23:02:39 2019
@@ -252,38 +252,37 @@ public class DatabaseUtil {
if (tableNames.contains(tableName)) {
tableNames.remove(tableName);
- if (colInfo != null) {
- Map<String, ModelField> fieldColNames = new HashMap<String, ModelField>();
- Iterator<ModelField> fieldIter = entity.getFieldsIterator();
- while (fieldIter.hasNext()) {
- ModelField field = fieldIter.next();
- fieldColNames.put(field.getColName(), field);
- }
-
- Map<String, ColumnCheckInfo> colMap = colInfo.get(tableName);
- if (colMap != null) {
- for (ColumnCheckInfo ccInfo: colMap.values()) {
- // -list all columns that do not have a corresponding field
- if (fieldColNames.containsKey(ccInfo.columnName)) {
- ModelField field = null;
-
- field = fieldColNames.remove(ccInfo.columnName);
- ModelFieldType modelFieldType = modelFieldTypeReader.getModelFieldType(field.getType());
-
- if (modelFieldType != null) {
- // make sure each corresponding column is of the correct type
- String fullTypeStr = modelFieldType.getSqlType();
- String typeName;
- int columnSize = -1;
- int decimalDigits = -1;
-
- int openParen = fullTypeStr.indexOf('(');
- int closeParen = fullTypeStr.indexOf(')');
- int comma = fullTypeStr.indexOf(',');
-
- if (openParen > 0 && closeParen > 0 && closeParen > openParen) {
- typeName = fullTypeStr.substring(0, openParen);
- if (!("DATETIME".equals(typeName) || "TIME".equals(typeName))) { // for DATETIME and TIME fields the number within the parenthesis doesn't represent the column size
+ Map<String, ModelField> fieldColNames = new HashMap<String, ModelField>();
+ Iterator<ModelField> fieldIter = entity.getFieldsIterator();
+ while (fieldIter.hasNext()) {
+ ModelField field = fieldIter.next();
+ fieldColNames.put(field.getColName(), field);
+ }
+
+ Map<String, ColumnCheckInfo> colMap = colInfo.get(tableName);
+ if (colMap != null) {
+ for (ColumnCheckInfo ccInfo: colMap.values()) {
+ // -list all columns that do not have a corresponding field
+ if (fieldColNames.containsKey(ccInfo.columnName)) {
+ ModelField field = null;
+
+ field = fieldColNames.remove(ccInfo.columnName);
+ ModelFieldType modelFieldType = modelFieldTypeReader.getModelFieldType(field.getType());
+
+ if (modelFieldType != null) {
+ // make sure each corresponding column is of the correct type
+ String fullTypeStr = modelFieldType.getSqlType();
+ String typeName;
+ int columnSize = -1;
+ int decimalDigits = -1;
+
+ int openParen = fullTypeStr.indexOf('(');
+ int closeParen = fullTypeStr.indexOf(')');
+ int comma = fullTypeStr.indexOf(',');
+
+ if (openParen > 0 && closeParen > 0 && closeParen > openParen) {
+ typeName = fullTypeStr.substring(0, openParen);
+ if (!("DATETIME".equals(typeName) || "TIME".equals(typeName))) { // for DATETIME and TIME fields the number within the parenthesis doesn't represent the column size
if (comma > 0 && comma > openParen && comma < closeParen) {
String csStr = fullTypeStr.substring(openParen + 1, comma);
try {
@@ -306,109 +305,99 @@ public class DatabaseUtil {
Debug.logError(e, module);
}
}
- }
- } else {
- typeName = fullTypeStr;
}
+ } else {
+ typeName = fullTypeStr;
+ }
- // override the default typeName with the sqlTypeAlias if it is specified
- if (UtilValidate.isNotEmpty(modelFieldType.getSqlTypeAlias())) {
- typeName = modelFieldType.getSqlTypeAlias();
- }
+ // override the default typeName with the sqlTypeAlias if it is specified
+ if (UtilValidate.isNotEmpty(modelFieldType.getSqlTypeAlias())) {
+ typeName = modelFieldType.getSqlTypeAlias();
+ }
- // NOTE: this may need a toUpperCase in some cases, keep an eye on it, okay just compare with ignore case
- if (!ccInfo.typeName.equalsIgnoreCase(typeName)) {
- String message = "Column [" + ccInfo.columnName + "] of table [" + tableName + "] of entity [" +
+ // NOTE: this may need a toUpperCase in some cases, keep an eye on it, okay just compare with ignore case
+ if (!ccInfo.typeName.equalsIgnoreCase(typeName)) {
+ String message = "Column [" + ccInfo.columnName + "] of table [" + tableName + "] of entity [" +
entity.getEntityName() + "] is of type [" + ccInfo.typeName + "] in the database, but is defined as type [" +
typeName + "] in the entity definition.";
- Debug.logError(message, module);
- if (messages != null) messages.add(message);
- }
- if (columnSize != -1 && ccInfo.columnSize != -1 && columnSize != ccInfo.columnSize && (columnSize * 3) != ccInfo.columnSize) {
- String message = "Column [" + ccInfo.columnName + "] of table [" + tableName + "] of entity [" +
+ Debug.logError(message, module);
+ if (messages != null) messages.add(message);
+ }
+ if (columnSize != -1 && ccInfo.columnSize != -1 && columnSize != ccInfo.columnSize && (columnSize * 3) != ccInfo.columnSize) {
+ String message = "Column [" + ccInfo.columnName + "] of table [" + tableName + "] of entity [" +
entity.getEntityName() + "] has a column size of [" + ccInfo.columnSize +
"] in the database, but is defined to have a column size of [" + columnSize + "] in the entity definition.";
- Debug.logWarning(message, module);
- if (messages != null) messages.add(message);
- if (columnSize > ccInfo.columnSize && colWrongSize != null) {
- // add item to list of wrong sized columns; only if the entity is larger
- colWrongSize.add(entity.getEntityName() + "." + field.getName());
- }
+ Debug.logWarning(message, module);
+ if (messages != null) messages.add(message);
+ if (columnSize > ccInfo.columnSize && colWrongSize != null) {
+ // add item to list of wrong sized columns; only if the entity is larger
+ colWrongSize.add(entity.getEntityName() + "." + field.getName());
}
- if (decimalDigits != -1 && decimalDigits != ccInfo.decimalDigits) {
- String message = "Column [" + ccInfo.columnName + "] of table [" + tableName + "] of entity [" +
+ }
+ if (decimalDigits != -1 && decimalDigits != ccInfo.decimalDigits) {
+ String message = "Column [" + ccInfo.columnName + "] of table [" + tableName + "] of entity [" +
entity.getEntityName() + "] has a decimalDigits of [" + ccInfo.decimalDigits +
"] in the database, but is defined to have a decimalDigits of [" + decimalDigits + "] in the entity definition.";
- Debug.logWarning(message, module);
- if (messages != null) messages.add(message);
- }
+ Debug.logWarning(message, module);
+ if (messages != null) messages.add(message);
+ }
- // do primary key matching check
- if (checkPks && ccInfo.isPk && !field.getIsPk()) {
- String message = "Column [" + ccInfo.columnName + "] of table [" + tableName + "] of entity [" +
+ // do primary key matching check
+ if (checkPks && ccInfo.isPk && !field.getIsPk()) {
+ String message = "Column [" + ccInfo.columnName + "] of table [" + tableName + "] of entity [" +
entity.getEntityName() + "] IS a primary key in the database, but IS NOT a primary key in the entity definition. The primary key for this table needs to be re-created or modified so that this column is NOT part of the primary key.";
- Debug.logError(message, module);
- if (messages != null) messages.add(message);
- }
- if (checkPks && !ccInfo.isPk && field.getIsPk()) {
- String message = "Column [" + ccInfo.columnName + "] of table [" + tableName + "] of entity [" +
+ Debug.logError(message, module);
+ if (messages != null) messages.add(message);
+ }
+ if (checkPks && !ccInfo.isPk && field.getIsPk()) {
+ String message = "Column [" + ccInfo.columnName + "] of table [" + tableName + "] of entity [" +
entity.getEntityName() + "] IS NOT a primary key in the database, but IS a primary key in the entity definition. The primary key for this table needs to be re-created or modified to add this column to the primary key. Note that data may need to be added first as a primary key column cannot have an null values.";
- Debug.logError(message, module);
- if (messages != null) messages.add(message);
- }
- } else {
- String message = "Column [" + ccInfo.columnName + "] of table [" + tableName + "] of entity [" + entity.getEntityName() +
- "] has a field type name of [" + field.getType() + "] which is not found in the field type definitions";
Debug.logError(message, module);
if (messages != null) messages.add(message);
}
} else {
- String message = "Column [" + ccInfo.columnName + "] of table [" + tableName + "] of entity [" + entity.getEntityName() + "] exists in the database but has no corresponding field" + ((checkPks && ccInfo.isPk) ? " (and it is a PRIMARY KEY COLUMN)" : "");
- Debug.logWarning(message, module);
+ String message = "Column [" + ccInfo.columnName + "] of table [" + tableName + "] of entity [" + entity.getEntityName() +
+ "] has a field type name of [" + field.getType() + "] which is not found in the field type definitions";
+ Debug.logError(message, module);
if (messages != null) messages.add(message);
}
- }
-
- // -display message if number of table columns does not match number of entity fields
- if (colMap.size() != entity.getFieldsSize()) {
- String message = "Entity [" + entity.getEntityName() + "] has " + entity.getFieldsSize() + " fields but table [" + tableName + "] has " + colMap.size() + " columns.";
+ } else {
+ String message = "Column [" + ccInfo.columnName + "] of table [" + tableName + "] of entity [" + entity.getEntityName() + "] exists in the database but has no corresponding field" + ((checkPks && ccInfo.isPk) ? " (and it is a PRIMARY KEY COLUMN)" : "");
Debug.logWarning(message, module);
if (messages != null) messages.add(message);
}
}
- // -list all fields that do not have a corresponding column
- for (ModelField field : fieldColNames.values()) {
- String message = "Field [" + field.getName() + "] of entity [" + entity.getEntityName() + "] is missing its corresponding column [" + field.getColName() + "]" + (field.getIsPk() ? " (and it is a PRIMARY KEY FIELD)" : "");
-
+ // -display message if number of table columns does not match number of entity fields
+ if (colMap.size() != entity.getFieldsSize()) {
+ String message = "Entity [" + entity.getEntityName() + "] has " + entity.getFieldsSize() + " fields but table [" + tableName + "] has " + colMap.size() + " columns.";
Debug.logWarning(message, module);
if (messages != null) messages.add(message);
+ }
+ }
- if (addMissing) {
- // add the column
- String errMsg = addColumn(entity, field);
-
- if (UtilValidate.isNotEmpty(errMsg)) {
- message = "Could not add column [" + field.getColName() + "] to table [" + tableName + "]: " + errMsg;
- Debug.logError(message, module);
- if (messages != null) messages.add(message);
- } else {
- message = "Added column [" + field.getColName() + "] to table [" + tableName + "]" + (field.getIsPk() ? " (NOTE: this is a PRIMARY KEY FIELD, but the primary key was not updated automatically (not considered a safe operation), be sure to fill in any needed data and re-create the primary key)" : "");
- Debug.logImportant(message, module);
- if (messages != null) messages.add(message);
- }
+ // -list all fields that do not have a corresponding column
+ for (ModelField field : fieldColNames.values()) {
+ String message = "Field [" + field.getName() + "] of entity [" + entity.getEntityName() + "] is missing its corresponding column [" + field.getColName() + "]" + (field.getIsPk() ? " (and it is a PRIMARY KEY FIELD)" : "");
+
+ Debug.logWarning(message, module);
+ if (messages != null) messages.add(message);
+
+ if (addMissing) {
+ // add the column
+ String errMsg = addColumn(entity, field);
+
+ if (UtilValidate.isNotEmpty(errMsg)) {
+ message = "Could not add column [" + field.getColName() + "] to table [" + tableName + "]: " + errMsg;
+ Debug.logError(message, module);
+ if (messages != null) messages.add(message);
+ } else {
+ message = "Added column [" + field.getColName() + "] to table [" + tableName + "]" + (field.getIsPk() ? " (NOTE: this is a PRIMARY KEY FIELD, but the primary key was not updated automatically (not considered a safe operation), be sure to fill in any needed data and re-create the primary key)" : "");
+ Debug.logImportant(message, module);
+ if (messages != null) messages.add(message);
}
}
}
- } else {
- String message = "Entity [" + entity.getEntityName() + "] has no table in the database";
- Debug.logWarning(message, module);
- if (messages != null) messages.add(message);
-
- if (addMissing) {
- // create the table
- tableFutures.add(executor.submit(new CreateTableCallable(entity, modelEntities, tableName)));
- }
}
}
for (CreateTableCallable tableCallable: ExecutionPool.getAllFutures(tableFutures)) {
@@ -694,12 +683,10 @@ public class DatabaseUtil {
}
// show index key references that exist but are unknown
- if (tableIndexList != null) {
- for (String indexLeft: tableIndexList) {
- String message = "Unknown Index " + indexLeft + " found in table " + entity.getTableName(datasourceInfo);
- Debug.logImportant(message, module);
- if (messages != null) messages.add(message);
- }
+ for (String indexLeft: tableIndexList) {
+ String message = "Unknown Index " + indexLeft + " found in table " + entity.getTableName(datasourceInfo);
+ Debug.logImportant(message, module);
+ if (messages != null) messages.add(message);
}
}
}
Modified: ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMapProcessor.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMapProcessor.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMapProcessor.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMapProcessor.java Sun Apr 7 23:02:39 2019
@@ -101,8 +101,7 @@ public class SimpleMapProcessor {
MapProcessor processor = mapProcessors.get(name);
if (processor == null) {
throw new MiniLangException("Could not find SimpleMapProcessor named " + name + " in XML document resource: " + xmlResource);
- }
- if (processor != null) {
+ } else {
processor.exec(inMap, results, messages, locale, loader);
}
}
@@ -114,8 +113,7 @@ public class SimpleMapProcessor {
MapProcessor processor = mapProcessors.get(name);
if (processor == null) {
throw new MiniLangException("Could not find SimpleMapProcessor named " + name + " in XML document: " + xmlURL.toString());
- }
- if (processor != null) {
+ } else {
processor.exec(inMap, results, messages, locale, loader);
}
}
Modified: ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/Iterate.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/Iterate.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/Iterate.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/Iterate.java Sun Apr 7 23:02:39 2019
@@ -154,7 +154,8 @@ public final class Iterate extends Metho
}
} else {
if (Debug.verboseOn()) {
- Debug.logVerbose("Cannot iterate over a " + objList == null ? "null object" : objList.getClass().getName()
+ Debug.logVerbose("Cannot iterate over a "
+ + (objList == null ? "null object" : objList.getClass().getName())
+ ", doing nothing: " + this, module);
}
return true;
Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/SOAPEventHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/SOAPEventHandler.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/SOAPEventHandler.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/SOAPEventHandler.java Sun Apr 7 23:02:39 2019
@@ -116,9 +116,7 @@ public class SOAPEventHandler implements
sendError(response, "Unable to obtain WSDL", serviceName);
throw new EventHandlerException("Unable to obtain WSDL");
}
- }
-
- if (serviceName == null) {
+ } else {
try {
Writer writer = response.getWriter();
StringBuilder sb = new StringBuilder();
Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java Sun Apr 7 23:02:39 2019
@@ -234,7 +234,7 @@ public class WebToolsServices {
}
if (UtilValidate.isNotEmpty(path)) {
- long pauseLong = filePause != null ? filePause : 0;
+ long pauseLong = filePause;
File baseDir = new File(path);
if (baseDir.isDirectory() && baseDir.canRead()) {
Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTree.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTree.java?rev=1857089&r1=1857088&r2=1857089&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTree.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTree.java Sun Apr 7 23:02:39 2019
@@ -512,7 +512,7 @@ public class ModelTree extends ModelWidg
getChildren(context);
nodeCount = (long) subNodeValues.size();
}
- if (nodeCount != null && nodeCount.intValue() > 0) {
+ if (nodeCount.intValue() > 0) {
hasChildren = true;
}
return hasChildren;
@@ -639,7 +639,7 @@ public class ModelTree extends ModelWidg
showPeers = true;
} else if (!isFollowTrail()) {
showPeers = true;
- } else if ((currentDepth < trailSize) && (rStyle != null)
+ } else if ((currentDepth < trailSize)
&& ("show-peers".equals(rStyle) || "expand-collapse".equals(rStyle))) {
showPeers = true;
} else if (openDepth >= currentDepth) {