This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 0308189 Fixed: Inconsistent String Comparisons (OFBIZ-9254) & Uploading image to data resource (OFBIZ-10834) 0308189 is described below commit 03081897c6889eb5c48d14673eea735bf6daf055 Author: Jacques Le Roux <[hidden email]> AuthorDate: Mon Jul 27 09:20:21 2020 +0200 Fixed: Inconsistent String Comparisons (OFBIZ-9254) & Uploading image to data resource (OFBIZ-10834) Changes made in startsWith and indexOf methods in ContentManagementServices for OFBIZ-9254 where wrong (reversed). Fortunately only place where this happened. I added a comment to make clear why we have 2 empty else if I'll backport later, conflicts to handle by hand... Thanks: Ankush Upadhyay for spotting the bug --- .../org/apache/ofbiz/content/ContentManagementServices.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java index 8d91954..13a9cf4 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java @@ -522,7 +522,8 @@ public class ContentManagementServices { return result; } - public static Map<String, Object> persistDataResourceAndDataMethod(DispatchContext dctx, Map<String, ? extends Object> rcontext) throws GenericServiceException, GenericEntityException { + public static Map<String, Object> persistDataResourceAndDataMethod(DispatchContext dctx, Map<String, ? extends Object> rcontext) + throws GenericServiceException, GenericEntityException { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Map<String, Object> context = UtilMisc.makeMapWritable(rcontext); @@ -597,9 +598,10 @@ public class ContentManagementServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult)); } } + // We don't want SHORT_TEXT and SURVEY to be caught by the last else if, hence the 2 empty else if } else if ("SHORT_TEXT".equals(dataResourceTypeId)) { - } else if ("SURVEY".startsWith(dataResourceTypeId)) { - } else if ("_FILE".indexOf(dataResourceTypeId) >= 0) { + } else if (dataResourceTypeId.startsWith("SURVEY")) { + } else if (dataResourceTypeId.indexOf("_FILE") >= 0) { Map<String, Object> uploadImage = new HashMap<>(); uploadImage.put("userLogin", userLogin); uploadImage.put("dataResourceId", dataResourceId); @@ -640,9 +642,10 @@ public class ContentManagementServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult)); } } + // We don't want SHORT_TEXT and SURVEY to be caught by the last else if, hence the 2 empty else if } else if ("SHORT_TEXT".equals(dataResourceTypeId)) { - } else if ("SURVEY".startsWith(dataResourceTypeId)) { - } else if ("_FILE".indexOf(dataResourceTypeId) >= 0) { + } else if (dataResourceTypeId.startsWith("SURVEY")) { + } else if (dataResourceTypeId.indexOf("_FILE") >= 0) { Map<String, Object> uploadImage = new HashMap<>(); uploadImage.put("userLogin", userLogin); uploadImage.put("dataResourceId", dataResourceId); |
Free forum by Nabble | Edit this page |