Author: mthl
Date: Sun Apr 7 23:36:29 2019 New Revision: 1857091 URL: http://svn.apache.org/viewvc?rev=1857091&view=rev Log: Reverted: Changes done at r#1857089 and r#1857090 (OFBIZ-10911)(OFBIZ-10912) The Cleanups introduced by those revisions has introduced some unexpected regressions making the Gradle ‘loadAll’ task fail. 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -212,7 +212,8 @@ public class PaymentMethodServices { // add a PartyContactMechPurpose of BILLING_LOCATION if necessary String contactMechPurposeTypeId = "BILLING_LOCATION"; - GenericValue tempVal; + GenericValue tempVal = null; + try { List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose") .where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList(); @@ -392,7 +393,8 @@ public class PaymentMethodServices { // add a PartyContactMechPurpose of BILLING_LOCATION if necessary String contactMechPurposeTypeId = "BILLING_LOCATION"; - GenericValue tempVal; + GenericValue tempVal = null; + try { List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose") .where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList(); @@ -738,7 +740,7 @@ public class PaymentMethodServices { // add a PartyContactMechPurpose of BILLING_LOCATION if necessary String contactMechPurposeTypeId = "BILLING_LOCATION"; - GenericValue tempVal; + GenericValue tempVal = null; try { List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose") .where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList(); @@ -869,7 +871,8 @@ public class PaymentMethodServices { // add a PartyContactMechPurpose of BILLING_LOCATION if necessary String contactMechPurposeTypeId = "BILLING_LOCATION"; - GenericValue tempVal; + GenericValue tempVal = null; + try { List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose") .where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList(); @@ -973,7 +976,7 @@ public class PaymentMethodServices { // add a PartyContactMechPurpose of BILLING_LOCATION if necessary String contactMechPurposeTypeId = "BILLING_LOCATION"; - GenericValue tempVal; + GenericValue tempVal = null; try { List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose") .where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList(); @@ -1095,7 +1098,8 @@ public class PaymentMethodServices { // add a PartyContactMechPurpose of BILLING_LOCATION if necessary String contactMechPurposeTypeId = "BILLING_LOCATION"; - GenericValue tempVal; + GenericValue tempVal = null; + 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -222,6 +222,7 @@ 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -163,8 +163,10 @@ public class ContentManagementServices { List<String> tmpPurposes = StringUtil.split(contentPurposeString, "|"); contentPurposeList.addAll(tmpPurposes); } - context.put("contentPurposeList", contentPurposeList); - context.put("contentPurposeString", null); + if (contentPurposeList != 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=1857091&r1=1857090&r2=1857091&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:36:29 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 (UtilValidate.isNotEmpty(serviceName)) { + if (dispatcher != null && 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -350,9 +350,11 @@ 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. - oneChildNode.setParentNode(this); - oneChildNode.setTree(tree); - oneChildNode.loadParents(partBomTypeId, inDate, productFeatures); + if (oneChildNode != null) { + 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -319,16 +319,16 @@ public class BOMServices { fromDate = new Date(); } - BOMTree tree; + BOMTree tree = null; 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 (quantity != null) { + if (tree != null && quantity != null) { tree.setRootQuantity(quantity); } - if (amount != null) { + if (tree != null && 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -1253,7 +1253,9 @@ public class OrderServices { Map<String, Object> reserveResult = dispatcher.runSync("reserveStoreInventory", reserveInput); if (ServiceUtil.isError(reserveResult)) { String invErrMsg = "The product "; - invErrMsg += getProductName(product, orderItem); + if (product != null) { + 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); } @@ -5982,8 +5984,10 @@ public class OrderServices { if (rowNumber == null) { Long count = EntityQuery.use(delegator).from("OrderItemShipGroupAssoc").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryCount(); - rowNumber = count.intValue(); - result.put("rowNumber", rowNumber); + if (count != null) { + rowNumber = count.intValue(); + result.put("rowNumber", rowNumber); + } } //find OISG Assoc @@ -6095,7 +6099,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) { + if (rowCount != null && rowNumber != 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -435,20 +435,18 @@ 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.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"; - } + 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"; + } } 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -4706,7 +4706,7 @@ public class ShoppingCart implements Ite Delegator delegator = cart.delegator; //check information from the cart ship info try { - if (facilityId != null) { + if (originAddress == null && 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -471,7 +471,7 @@ public class ShoppingListEvents { Debug.logError(e, module); } cart.setAutoSaveListId(autoSaveListId); - } else { + } else if (userLogin != null) { 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, true); + addListToCart(delegator, dispatcher, cart, prodCatalogId, autoSaveListId, false, false, userLogin != null ? true : false); 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -171,7 +171,7 @@ public class ShoppingListServices { // store the order Map<String, Object> createResp = helper.createOrder(userLogin); - if (createResp == null || ServiceUtil.isError(createResp)) { + if (createResp == null || (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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -157,7 +157,7 @@ public class ContactMechServices { } String contactMechId = (String) context.get("contactMechId"); - GenericValue contactMech; + GenericValue contactMech = null; GenericValue partyContactMech = null; try { @@ -427,7 +427,7 @@ public class ContactMechServices { } String contactMechId = (String) context.get("contactMechId"); - GenericValue contactMech; + GenericValue contactMech = null; GenericValue partyContactMech = null; try { @@ -469,7 +469,8 @@ public class ContactMechServices { GenericValue relatedEntityToSet = null; if ("POSTAL_ADDRESS".equals(contactMech.getString("contactMechTypeId"))) { - GenericValue addr; + GenericValue addr = null; + try { addr = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", contactMechId).queryOne(); } catch (GenericEntityException e) { @@ -668,6 +669,7 @@ public class ContactMechServices { } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), module); contactMech = null; + partyContactMech = null; } if (contactMech == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, @@ -685,7 +687,8 @@ public class ContactMechServices { GenericValue relatedEntityToSet = null; if ("TELECOM_NUMBER".equals(contactMech.getString("contactMechTypeId"))) { - GenericValue telNum; + GenericValue telNum = null; + try { telNum = EntityQuery.use(delegator).from("TelecomNumber").where("contactMechId", contactMechId).queryOne(); } catch (GenericEntityException e) { @@ -831,7 +834,7 @@ public class ContactMechServices { String contactMechPurposeTypeId = (String) context.get("contactMechPurposeTypeId"); Timestamp fromDate = (Timestamp) context.get("fromDate"); - GenericValue tempVal; + GenericValue tempVal = null; 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -249,7 +249,7 @@ public class CategoryServices { Debug.logError(e.getMessage(), module); } - GenericValue productCategory; + GenericValue productCategory = null; 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -18,6 +18,7 @@ *******************************************************************************/ package org.apache.ofbiz.product.category; +import java.io.FileInputStream; import java.io.IOException; import java.net.URL; import java.util.HashMap; @@ -100,6 +101,7 @@ 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>(); @@ -320,6 +322,15 @@ 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -79,9 +79,10 @@ 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -281,6 +281,7 @@ 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)); @@ -347,7 +348,8 @@ public class ProductEvents { request.setAttribute("ProductAssocCreateFromDate", fromDate); } - GenericValue productAssoc; + GenericValue productAssoc = null; + 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=1857091&r1=1857090&r2=1857091&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:36:29 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 (UtilValidate.isNotEmpty(shipmentPackage.getBigDecimal("boxLength")) + } else if (shipmentPackage != null && 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -197,7 +197,9 @@ public final class ScriptUtil { localContext.put("context", context); ScriptContext scriptContext = new SimpleScriptContext(); ScriptHelper helper = new ScriptHelperImpl(scriptContext); - localContext.put(SCRIPT_HELPER_KEY, helper); + if (helper != null) { + 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -136,6 +136,7 @@ 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -341,7 +341,7 @@ public final class FreeMarkerWorker { @SuppressWarnings("unchecked") public static <T> T unwrap(Object o) { - Object returnObj; + Object returnObj = null; if (o == TemplateModel.NOTHING) { returnObj = null; @@ -349,8 +349,6 @@ 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -139,6 +139,7 @@ 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -139,7 +139,9 @@ 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 | IOException e) { + } catch (IllegalArgumentException e) { + defaultLogoImage = null; + } catch (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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -573,6 +573,8 @@ 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=1857091&r1=1857090&r2=1857091&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:36:29 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; + GenericValue existing = null; 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -217,7 +217,7 @@ public class DatabaseUtil { Debug.logError(message, module); return; } - + List<Future<CreateTableCallable>> tableFutures = new LinkedList<Future<CreateTableCallable>>(); for (ModelEntity entity: modelEntityList) { curEnt++; @@ -252,37 +252,38 @@ public class DatabaseUtil { if (tableNames.contains(tableName)) { tableNames.remove(tableName); - 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 (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 if (comma > 0 && comma > openParen && comma < closeParen) { String csStr = fullTypeStr.substring(openParen + 1, comma); try { @@ -305,101 +306,114 @@ 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() + - "] has a field type name of [" + field.getType() + "] which is not found in the field type definitions"; - Debug.logError(message, module); + 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); } - } 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)" : ""); + } + + // -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); } } - // -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."; + // -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); - } - } - // -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 (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); + 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)) { + tableCallable.updateData(messages, entitiesAdded); + } timer.timerString("After Individual Table/Column Check"); @@ -680,10 +694,12 @@ public class DatabaseUtil { } // show index key references that exist but are unknown - 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); + 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); + } } } } @@ -1479,6 +1495,47 @@ public class DatabaseUtil { return indexInfo; } + private class CreateTableCallable implements Callable<CreateTableCallable> { + private final ModelEntity entity; + private final Map<String, ModelEntity> modelEntities; + private final String tableName; + private String message; + private boolean success; + + protected CreateTableCallable(ModelEntity entity, Map<String, ModelEntity> modelEntities, String tableName) { + this.entity = entity; + this.modelEntities = modelEntities; + this.tableName = tableName; + } + + public CreateTableCallable call() throws Exception { + String errMsg = createTable(entity, modelEntities, false); + if (UtilValidate.isNotEmpty(errMsg)) { + this.success = false; + this.message = "Could not create table [" + tableName + "]: " + errMsg; + Debug.logError(this.message, module); + } else { + this.success = true; + this.message = "Created table [" + tableName + "]"; + Debug.logImportant(this.message, module); + } + return this; + } + + protected void updateData(Collection<String> messages, List<ModelEntity> entitiesAdded) { + if (this.success) { + entitiesAdded.add(entity); + if (messages != null) { + messages.add(this.message); + } + } else { + if (messages != null) { + messages.add(this.message); + } + } + } + } + private abstract class AbstractCountingCallable implements Callable<AbstractCountingCallable> { protected final ModelEntity entity; protected final Map<String, ModelEntity> modelEntities; 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -101,7 +101,8 @@ 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); - } else { + } + if (processor != null) { processor.exec(inMap, results, messages, locale, loader); } } @@ -113,7 +114,8 @@ 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()); - } else { + } + if (processor != null) { 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -154,8 +154,7 @@ 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -116,7 +116,9 @@ public class SOAPEventHandler implements sendError(response, "Unable to obtain WSDL", serviceName); throw new EventHandlerException("Unable to obtain WSDL"); } - } else { + } + + if (serviceName == null) { 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -234,7 +234,7 @@ public class WebToolsServices { } if (UtilValidate.isNotEmpty(path)) { - long pauseLong = filePause; + long pauseLong = filePause != null ? filePause : 0; 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=1857091&r1=1857090&r2=1857091&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:36:29 2019 @@ -512,7 +512,7 @@ public class ModelTree extends ModelWidg getChildren(context); nodeCount = (long) subNodeValues.size(); } - if (nodeCount.intValue() > 0) { + if (nodeCount != null && 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) + } else if ((currentDepth < trailSize) && (rStyle != null) && ("show-peers".equals(rStyle) || "expand-collapse".equals(rStyle))) { showPeers = true; } else if (openDepth >= currentDepth) { |
Free forum by Nabble | Edit this page |