svn commit: r1863507 - in /ofbiz/ofbiz-framework/trunk: applications/content/src/main/java/org/apache/ofbiz/content/data/ applications/content/src/main/java/org/apache/ofbiz/content/survey/ applicatio
Author: mthl Date: Sat Jul 20 18:45:21 2019 New Revision: 1863507 URL: http://svn.apache.org/viewvc?rev=1863507=rev Log: Improved: Remove useless imports (OFBIZ-11142) Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.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/promo/PromoServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile.java ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile2EntityXml.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/GenericEntity.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntitySaxReader.java ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataServices.java ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonHelper.java Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java?rev=1863507=1863506=1863507=diff == --- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java Sat Jul 20 18:45:21 2019 @@ -38,7 +38,6 @@ import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.GeneralException; import org.apache.ofbiz.base.util.UtilDateTime; import org.apache.ofbiz.base.util.UtilGenerics; -import org.apache.ofbiz.base.util.UtilIO; import org.apache.ofbiz.base.util.UtilMisc; import org.apache.ofbiz.base.util.UtilProperties; import org.apache.ofbiz.base.util.UtilValidate; Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java?rev=1863507=1863506=1863507=diff == --- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java Sat Jul 20 18:45:21 2019 @@ -37,7 +37,6 @@ import java.util.Map.Entry; import org.apache.ofbiz.base.location.FlexibleLocation; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.GeneralException; -import org.apache.ofbiz.base.util.UtilIO; import org.apache.ofbiz.base.util.UtilMisc; import org.apache.ofbiz.base.util.UtilValidate; import org.apache.ofbiz.base.util.template.FreeMarkerWorker; 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=1863507=1863506=1863507=diff == ---
svn commit: r1863505 - in /ofbiz/ofbiz-framework/trunk: applications/content/src/main/java/org/apache/ofbiz/content/data/ applications/content/src/main/java/org/apache/ofbiz/content/survey/ applicatio
Author: mthl Date: Sat Jul 20 18:41:37 2019 New Revision: 1863505 URL: http://svn.apache.org/viewvc?rev=1863505=rev Log: Improved: Use ‘StandardCharsets.UTF_8’ (OFBIZ-11142) Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.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/promo/PromoServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/FileUtil.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/KeyStoreUtil.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/UtilFormatOut.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilIOTests.java ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile.java ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile2EntityXml.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/GenericEntity.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntitySaxReader.java ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataServices.java ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonHelper.java Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java?rev=1863505=1863504=1863505=diff == --- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java Sat Jul 20 18:41:37 2019 @@ -30,6 +30,7 @@ import java.io.Writer; import java.net.URL; import java.net.URLConnection; import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.StandardOpenOption; import java.sql.Timestamp; @@ -987,7 +988,7 @@ public class DataResourceWorker impleme if (!file.isAbsolute()) { throw new GeneralException("File (" + objectInfo + ") is not absolute"); } -try (InputStreamReader in = new InputStreamReader(new FileInputStream(file), UtilIO.getUtf8())) { +try (InputStreamReader in = new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8)) { UtilIO.copy(in, out); } } else if ("OFBIZ_FILE".equals(dataResourceTypeId) && UtilValidate.isNotEmpty(objectInfo)) { @@ -997,7 +998,7 @@ public class DataResourceWorker impleme sep = "/"; } File file = FileUtil.getFile(prefix + sep + objectInfo); -try
svn commit: r1863504 - in /ofbiz/ofbiz-framework/trunk: applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/ applications/product/src/main/java/org/apache/ofbiz/shipment/thirdp
Author: mthl Date: Sat Jul 20 18:39:57 2019 New Revision: 1863504 URL: http://svn.apache.org/viewvc?rev=1863504=rev Log: Improved: Use ‘java.util.Base64’ (OFBIZ-11142) Since Java 8 a standard Base64 encoder/decoder is available. As a consequence we can remove our embedded implementation and use it instead. Removed: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/Base64.java Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpClient.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityJsonReader.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntitySaxReader.java ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/WebDavUtil.java ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonHelper.java Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java?rev=1863504=1863503=1863504=diff == --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java Sat Jul 20 18:39:57 2019 @@ -22,6 +22,7 @@ import java.io.IOException; import java.io.StringWriter; import java.math.BigDecimal; import java.math.RoundingMode; +import java.util.Base64; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -30,7 +31,6 @@ import java.util.Map; import javax.xml.parsers.ParserConfigurationException; -import org.apache.ofbiz.base.util.Base64; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.GeneralException; import org.apache.ofbiz.base.util.HttpClient; @@ -850,7 +850,7 @@ public class DhlServices { continue; sb.append(encodedImageString.charAt(i)); } -byte[] labelBytes = Base64.base64Decode(sb.toString().getBytes(UtilIO.getUtf8())); +byte[] labelBytes = Base64.getMimeDecoder().decode(sb.toString().getBytes(UtilIO.getUtf8())); if (labelBytes != null) { // store in db blob Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java?rev=1863504=1863503=1863504=diff == --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java Sat Jul 20 18:39:57 2019 @@ -24,6 +24,7 @@ import java.io.StringWriter; import java.math.BigDecimal; import java.math.RoundingMode; import java.sql.Timestamp; +import java.util.Base64; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -32,7 +33,6 @@ import java.util.Map; import javax.xml.parsers.ParserConfigurationException; -import org.apache.ofbiz.base.util.Base64; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.GeneralException; import org.apache.ofbiz.base.util.HttpClient; @@ -1021,7 +1021,7 @@ public class FedexServices { "fDXShipReplyString", fDXShipReplyString), locale)); } -byte[] labelBytes = Base64.base64Decode(encodedImageString.getBytes(UtilIO.getUtf8())); +byte[] labelBytes =
buildbot success in on ofbizTrunkFrameworkPlugins
The Buildbot has detected a restored build on builder ofbizTrunkFrameworkPlugins while building . Full details are available at: https://ci.apache.org/builders/ofbizTrunkFrameworkPlugins/builds/890 Buildbot URL: https://ci.apache.org/ Buildslave for this Build: asf946_ubuntu Build Reason: The AnyBranchScheduler scheduler named 'onTrunkPluginsCommit' triggered this build Build Source Stamp: [branch ofbiz/ofbiz-plugins/trunk] 1863492 Blamelist: mthl Build succeeded! Sincerely, -The Buildbot
svn commit: r1863502 - in /ofbiz/ofbiz-framework/trunk: applications/product/src/main/java/org/apache/ofbiz/product/product/ applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffor
Author: mthl Date: Sat Jul 20 16:36:12 2019 New Revision: 1863502 URL: http://svn.apache.org/viewvc?rev=1863502=rev Log: Improved: Inline ‘UtilGenerics#checkCollection(Object)’ (OFBIZ-11141) Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/Compare.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/CoreEvents.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java?rev=1863502=1863501=1863502=diff == --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java Sat Jul 20 16:36:12 2019 @@ -179,7 +179,7 @@ public class ProductServices { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Map result = new HashMap<>(); -List featureOrder = UtilMisc.makeListWritable(UtilGenerics.checkCollection(context.get("featureOrder"))); +List featureOrder = UtilMisc.makeListWritable(UtilGenerics.cast(context.get("featureOrder"))); if (UtilValidate.isEmpty(featureOrder)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, Modified: ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=1863502=1863501=1863502=diff == --- ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java Sat Jul 20 16:36:12 2019 @@ -520,7 +520,7 @@ public class WorkEffortServices { calendarType = "CAL_PERSONAL"; } String partyId = (String) context.get("partyId"); -Collection partyIds = UtilGenerics.checkCollection(context.get("partyIds")); +Collection partyIds = UtilGenerics.cast(context.get("partyIds")); String facilityId = (String) context.get("facilityId"); String fixedAssetId = (String) context.get("fixedAssetId"); String workEffortTypeId = (String) context.get("workEffortTypeId"); Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java?rev=1863502=1863501=1863502=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Sat Jul 20 16:36:12 2019 @@ -32,10 +32,6 @@ public final class UtilGenerics { return (V) object; } -public static Collection checkCollection(Object object) { -return cast(object); -} - public static > C checkCollection(Object object, Class type) { if (object != null) { if (!(Collection.class.isInstance(object))) { Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java?rev=1863502=1863501=1863502=diff
svn commit: r1863501 [3/3] - in /ofbiz/ofbiz-framework/trunk: applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/ applications/accounting/src/main/java/org/apache/ofbiz/accounti
Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/FlexibleServletAccessor.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/FlexibleServletAccessor.java?rev=1863501=1863500=1863501=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/FlexibleServletAccessor.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/FlexibleServletAccessor.java Sat Jul 20 16:35:13 2019 @@ -294,7 +294,7 @@ public class FlexibleServletAccessor public void put(ServletRequest request, T value) { if (fma == null) { if (isListReference) { -List lst = UtilGenerics.checkList(request.getAttribute(attributeName)); +List lst = UtilGenerics.cast(request.getAttribute(attributeName)); putInList(lst, value); } else { request.setAttribute(attributeName, value); @@ -302,7 +302,7 @@ public class FlexibleServletAccessor } else { Object theObj = request.getAttribute(attributeName); if (isListReference) { -List lst = UtilGenerics.checkList(theObj); +List lst = UtilGenerics.cast(theObj); fma.put(UtilGenerics.checkMap(lst.get(listIndex), String.class, Object.class), value); } else { fma.put(UtilGenerics.checkMap(theObj, String.class, Object.class), value); @@ -313,7 +313,7 @@ public class FlexibleServletAccessor public void put(HttpSession session, T value) { if (fma == null) { if (isListReference) { -List lst = UtilGenerics.checkList(session.getAttribute(attributeName)); +List lst = UtilGenerics.cast(session.getAttribute(attributeName)); putInList(lst, value); } else { session.setAttribute(attributeName, value); @@ -321,7 +321,7 @@ public class FlexibleServletAccessor } else { Object theObj = session.getAttribute(attributeName); if (isListReference) { -List lst = UtilGenerics.checkList(theObj); +List lst = UtilGenerics.cast(theObj); fma.put(UtilGenerics.checkMap(lst.get(listIndex), String.class, Object.class), value); } else { fma.put(UtilGenerics.checkMap(theObj, String.class, Object.class), value); @@ -333,13 +333,13 @@ public class FlexibleServletAccessor if (fma != null) { Object theObj = request.getAttribute(attributeName); if (isListReference) { -List lst = UtilGenerics.checkList(theObj); +List lst = UtilGenerics.cast(theObj); return fma.remove(UtilGenerics.checkMap(lst.get(listIndex), String.class, Object.class)); } return fma.remove(UtilGenerics.checkMap(theObj, String.class, Object.class)); } if (isListReference) { -List lst = UtilGenerics.checkList(request.getAttribute(attributeName)); +List lst = UtilGenerics.cast(request.getAttribute(attributeName)); return UtilGenerics.cast(lst.remove(listIndex)); } Object theValue = request.getAttribute(attributeName); @@ -351,13 +351,13 @@ public class FlexibleServletAccessor if (fma != null) { Object theObj = session.getAttribute(attributeName); if (isListReference) { -List lst = UtilGenerics.checkList(theObj); +List lst = UtilGenerics.cast(theObj); return fma.remove(UtilGenerics.checkMap(lst.get(listIndex), String.class, Object.class)); } return fma.remove(UtilGenerics.checkMap(theObj, String.class, Object.class)); } if (isListReference) { -List lst = UtilGenerics.checkList(session.getAttribute(attributeName)); +List lst = UtilGenerics.cast(session.getAttribute(attributeName)); return UtilGenerics.cast(lst.remove(listIndex)); } Object theValue = session.getAttribute(attributeName); 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=1863501=1863500=1863501=diff
svn commit: r1863501 [1/3] - in /ofbiz/ofbiz-framework/trunk: applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/ applications/accounting/src/main/java/org/apache/ofbiz/accounti
Author: mthl Date: Sat Jul 20 16:35:13 2019 New Revision: 1863501 URL: http://svn.apache.org/viewvc?rev=1863501=rev Log: Improved: Inline ‘UtilGenerics#checkList’ (OFBIZ-11141) Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.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/ContentManagementWorker.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentPermissionServices.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchSession.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServicesComplex.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutWorker.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/output/OutputServices.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/CheckPermissionTransform.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LoopSubContentTransform.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentAsText.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.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/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/ProposedOrder.java ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderLookupServices.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/quote/QuoteServices.java
svn commit: r1863501 [2/3] - in /ofbiz/ofbiz-framework/trunk: applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/ applications/accounting/src/main/java/org/apache/ofbiz/accounti
Modified: ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=1863501=1863500=1863501=diff == --- ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Sat Jul 20 16:35:13 2019 @@ -233,7 +233,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(routingOutMap)); } routing = (GenericValue)routingOutMap.get("routing"); -routingTaskAssocs = UtilGenerics.checkList(routingOutMap.get("tasks")); +routingTaskAssocs = UtilGenerics.cast(routingOutMap.get("tasks")); } catch (GenericServiceException gse) { Debug.logWarning(gse.getMessage(), module); } @@ -260,7 +260,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } -components = UtilGenerics.checkList(serviceResult.get("components")); // a list of objects representing the product's components +components = UtilGenerics.cast(serviceResult.get("components")); // a list of objects representing the product's components } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the getManufacturingComponents service", module); return ServiceUtil.returnError(e.getMessage()); @@ -3409,7 +3409,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } -List> components = UtilGenerics.checkList(serviceResult.get("componentsMap")); +List> components = UtilGenerics.cast(serviceResult.get("componentsMap")); if (UtilValidate.isEmpty(components)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunCannotDecomposingInventoryItemNoComponentsFound", UtilMisc.toMap("productId", inventoryItem.getString("productId")), locale)); } @@ -3439,7 +3439,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } -List newInventoryItemIds = UtilGenerics.checkList(serviceResult.get("inventoryItemIds")); +List newInventoryItemIds = UtilGenerics.cast(serviceResult.get("inventoryItemIds")); inventoryItemIds.addAll(newInventoryItemIds); } // the components are put in warehouse Modified: ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java?rev=1863501=1863500=1863501=diff == --- ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java Sat Jul 20 16:35:13 2019 @@ -747,7 +747,7 @@ public class MrpServices { } catch (Exception e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpErrorExplodingProduct", UtilMisc.toMap("productId", product.getString("productId")), locale)); } -components = UtilGenerics.checkList(serviceResponse.get("components")); +components = UtilGenerics.cast(serviceResponse.get("components")); if (UtilValidate.isNotEmpty(components)) { BOMNode node = (components.get(0)).getParentNode(); isBuilt = node.isManufactured(); @@ -784,7 +784,7 @@ public class MrpServices { } catch (Exception e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpErrorExplodingProduct", UtilMisc.toMap("productId", product.getString("productId")),
svn commit: r1863500 [1/2] - in /ofbiz/ofbiz-framework/trunk: applications/accounting/src/main/java/org/apache/ofbiz/accounting/ledger/ applications/accounting/src/main/java/org/apache/ofbiz/accountin
Author: mthl Date: Sat Jul 20 16:32:34 2019 New Revision: 1863500 URL: http://svn.apache.org/viewvc?rev=1863500=rev Log: Improved: Inline ‘UtilGenerics#checkMap’ (OFBIZ-11141) Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/ledger/GeneralLedgerServices.java ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/output/OutputServices.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java ofbiz/ofbiz-framework/trunk/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.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/ShoppingCart.java ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechWorker.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlDirective.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/test/StockMovesTest.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickServices.java ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentLoaderConfig.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java
svn commit: r1863500 [2/2] - in /ofbiz/ofbiz-framework/trunk: applications/accounting/src/main/java/org/apache/ofbiz/accounting/ledger/ applications/accounting/src/main/java/org/apache/ofbiz/accountin
Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java?rev=1863500=1863499=1863500=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java Sat Jul 20 16:32:34 2019 @@ -1498,7 +1498,7 @@ public final class UtilHttp { public static String stashParameterMap(HttpServletRequest request) { HttpSession session = request.getSession(); -Map> paramMapStore = UtilGenerics.checkMap(session.getAttribute("_PARAM_MAP_STORE_")); +Map> paramMapStore = UtilGenerics.cast(session.getAttribute("_PARAM_MAP_STORE_")); if (paramMapStore == null) { paramMapStore = new HashMap<>(); session.setAttribute("_PARAM_MAP_STORE_", paramMapStore); @@ -1511,7 +1511,7 @@ public final class UtilHttp { public static void restoreStashedParameterMap(HttpServletRequest request, String paramMapId) { HttpSession session = request.getSession(); -Map> paramMapStore = UtilGenerics.checkMap(session.getAttribute("_PARAM_MAP_STORE_")); +Map> paramMapStore = UtilGenerics.cast(session.getAttribute("_PARAM_MAP_STORE_")); if (paramMapStore != null) { Map paramMap = paramMapStore.get(paramMapId); if (paramMap != null) { Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java?rev=1863500=1863499=1863500=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java Sat Jul 20 16:32:34 2019 @@ -130,7 +130,7 @@ public final class UtilMisc { @SuppressWarnings("unchecked") public static Map toMap(Supplier> constructor, Object... kvs) { if (kvs.length == 1 && kvs[0] instanceof Map) { -return UtilGenerics.checkMap(kvs[0]); +return UtilGenerics.cast(kvs[0]); } if (kvs.length % 2 == 1) { IllegalArgumentException e = new IllegalArgumentException( @@ -221,7 +221,7 @@ public final class UtilMisc { * Assuming outerMap not null; if null will throw a NullPointerException */ public static Map getMapFromMap(Map outerMap, K key) { -Map innerMap = UtilGenerics.checkMap(outerMap.get(key)); +Map innerMap = UtilGenerics.cast(outerMap.get(key)); if (innerMap == null) { innerMap = new HashMap<>(); outerMap.put(key, innerMap); Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilPlist.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilPlist.java?rev=1863500=1863499=1863500=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilPlist.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilPlist.java Sat Jul 20 16:32:34 2019 @@ -19,7 +19,6 @@ package org.apache.ofbiz.base.util; import static org.apache.ofbiz.base.util.UtilGenerics.checkList; -import static org.apache.ofbiz.base.util.UtilGenerics.checkMap; import java.io.BufferedWriter; import java.io.File; @@ -53,7 +52,7 @@ public final class UtilPlist { writer.print(" = "); if (value instanceof Map) { writer.println(); -Map map = checkMap(value); +Map map = UtilGenerics.cast(value); writePlistPropertyMap(map, indentLevel, writer, false); } else if (value instanceof List) { List list = checkList(value); @@ -90,7 +89,7 @@ public final class UtilPlist { while (propertyValueIter.hasNext()) { Object propertyValue = propertyValueIter.next(); if (propertyValue instanceof Map) { -Map propertyMap = checkMap(propertyValue); +Map propertyMap = UtilGenerics.cast(propertyValue); writePlistPropertyMap(propertyMap, indentLevel + 1, writer, propertyValueIter.hasNext()); } else { writer.print(propertyValue); @@ -114,7 +113,7 @@ public final class UtilPlist { writer.print(name); writer.println("");
svn commit: r1863499 - in /ofbiz/ofbiz-framework/trunk: applications/content/src/main/java/org/apache/ofbiz/content/ applications/content/src/main/java/org/apache/ofbiz/content/content/ applications/c
Author: mthl Date: Sat Jul 20 16:31:29 2019 New Revision: 1863499 URL: http://svn.apache.org/viewvc?rev=1863499=rev Log: Improved: Inline ‘UtilGenerics#checkSet’ (OFBIZ-11141) Modified: 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/ContentMapFacade.java ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java 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=1863499=1863498=1863499=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 Sat Jul 20 16:31:29 2019 @@ -989,7 +989,7 @@ public class ContentManagementServices { Map context = UtilMisc.makeMapWritable(rcontext); Map results = new HashMap<>(); Locale locale = (Locale) context.get("locale"); -Set visitedSet = UtilGenerics.checkSet(context.get("visitedSet")); +Set visitedSet = UtilGenerics.cast(context.get("visitedSet")); if (visitedSet == null) { visitedSet = new HashSet<>(); context.put("visitedSet", visitedSet); @@ -1029,7 +1029,7 @@ public class ContentManagementServices { Map context = UtilMisc.makeMapWritable(rcontext); Map results = new HashMap<>(); Locale locale = (Locale) context.get("locale"); -Set visitedSet = UtilGenerics.checkSet(context.get("visitedSet")); +Set visitedSet = UtilGenerics.cast(context.get("visitedSet")); if (visitedSet == null) { visitedSet = new HashSet<>(); context.put("visitedSet", visitedSet); @@ -1103,7 +1103,7 @@ public class ContentManagementServices { public static void updatePageNodeChildren(GenericValue content, Map context) throws GenericEntityException { String contentId = content.getString("contentId"); -Set visitedSet = UtilGenerics.checkSet(context.get("visitedSet")); +Set visitedSet = UtilGenerics.cast(context.get("visitedSet")); if (visitedSet == null) { visitedSet = new HashSet<>(); context.put("visitedSet", visitedSet); @@ -1126,7 +1126,7 @@ public class ContentManagementServices { public static void updateOutlineNodeChildren(GenericValue content, boolean forceOutline, Map context) throws GenericEntityException { String contentId = content.getString("contentId"); -Set visitedSet = UtilGenerics.checkSet(context.get("visitedSet")); +Set visitedSet = UtilGenerics.cast(context.get("visitedSet")); if (visitedSet == null) { visitedSet = new HashSet<>(); context.put("visitedSet", visitedSet); @@ -1520,7 +1520,7 @@ public class ContentManagementServices { String contentId = content.getString("contentId"); List contentAssocTypeIdList = UtilGenerics.checkList(context.get("contentAssocTypeIdList")); Locale locale = (Locale) context.get("locale"); -Set visitedSet = UtilGenerics.checkSet(context.get("visitedSet")); +Set visitedSet = UtilGenerics.cast(context.get("visitedSet")); if (visitedSet == null) { visitedSet = new HashSet<>(); context.put("visitedSet", visitedSet); Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java?rev=1863499=1863498=1863499=diff == --- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java (original) +++
svn commit: r1863498 - in /ofbiz/ofbiz-framework/trunk/framework: base/src/main/java/org/apache/ofbiz/base/util/ base/src/test/java/org/apache/ofbiz/base/conversion/ common/src/main/java/org/apache/of
Author: mthl Date: Sat Jul 20 16:30:45 2019 New Revision: 1863498 URL: http://svn.apache.org/viewvc?rev=1863498=rev Log: Improved: Inline ‘UtilGenerics#toList’ (OFBIZ-11141) Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestJSONConverters.java ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTree.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/ScreenRenderer.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlTreeRenderer.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java?rev=1863498=1863497=1863498=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Sat Jul 20 16:30:45 2019 @@ -85,11 +85,4 @@ public final class UtilGenerics { public static Set checkSet(Object object) { return cast(object); } - -/** Returns the Object argument as a parameterized List if the Object argument - * is an instance of List. Otherwise returns null. - */ -public static List toList(Object obj) { -return (obj instanceof List) ? cast(obj) : null; -} } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestJSONConverters.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestJSONConverters.java?rev=1863498=1863497=1863498=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestJSONConverters.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestJSONConverters.java Sat Jul 20 16:30:45 2019 @@ -58,7 +58,8 @@ public class TestJSONConverters { list.add("field1"); list.add("field2"); JSON json = JSON.from(list); -convertedList = UtilGenerics.toList(converter.convert(json)); +Object obj = converter.convert(json); +convertedList = (obj instanceof List) ? UtilGenerics.cast(obj) : null; assertEquals("JSON to List", list, convertedList); } Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java?rev=1863498=1863497=1863498=diff == --- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java Sat Jul 20 16:30:45 2019 @@ -366,7 +366,8 @@ public class FindServices { fieldOp = entityOperators.get(operation); } } else { -if (UtilValidate.isNotEmpty(UtilGenerics.toList(fieldValue))) { +List fieldList = (fieldValue instanceof List) ? UtilGenerics.cast(fieldValue) : null; +if (UtilValidate.isNotEmpty(fieldList)) { fieldOp = EntityOperator.IN; } else { fieldOp = EntityOperator.EQUALS; Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java?rev=1863498=1863497=1863498=diff == --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java (original) +++
svn commit: r1863497 - in /ofbiz/ofbiz-framework/trunk/framework: base/src/main/java/org/apache/ofbiz/base/util/ base/src/test/java/org/apache/ofbiz/base/conversion/ widget/src/main/java/org/apache/of
Author: mthl Date: Sat Jul 20 16:29:52 2019 New Revision: 1863497 URL: http://svn.apache.org/viewvc?rev=1863497=rev Log: Improved: Inline ‘UtilGenerics#toMap’ (OFBIZ-11141) Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestJSONConverters.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelCondition.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/IterateSectionWidget.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenCondition.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuWrapper.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java?rev=1863497=1863496=1863497=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Sat Jul 20 16:29:52 2019 @@ -92,11 +92,4 @@ public final class UtilGenerics { public static List toList(Object obj) { return (obj instanceof List) ? cast(obj) : null; } - -/** Returns the Object argument as a parameterized Map if the Object argument - * is an instance of Map. Otherwise returns null. - */ -public static Map toMap(Object obj) { -return (obj instanceof Map) ? cast(obj) : null; -} } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestJSONConverters.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestJSONConverters.java?rev=1863497=1863496=1863497=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestJSONConverters.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/conversion/TestJSONConverters.java Sat Jul 20 16:29:52 2019 @@ -45,7 +45,8 @@ public class TestJSONConverters { map = new HashMap<>(); map.put("field1", "value1"); JSON json = JSON.from(map); -convertedMap = UtilGenerics.toMap(converter.convert(json)); +Object obj = converter.convert(json); +convertedMap = (obj instanceof Map) ? UtilGenerics.cast(obj) : null; assertEquals("JSON to Map", map, convertedMap); } Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java?rev=1863497=1863496=1863497=diff == --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelAction.java Sat Jul 20 16:29:52 2019 @@ -685,7 +685,8 @@ public abstract class AbstractModelActio DispatchContext dc = WidgetWorker.getDispatcher(context).getDispatchContext(); // try a map called "parameters", try it first so values from here are overriden by values in the main context Map combinedMap = new HashMap<>(); -Map parametersObj = UtilGenerics.toMap(context.get("parameters")); +Object obj = context.get("parameters"); +Map parametersObj = (obj instanceof Map) ? UtilGenerics.cast(obj) : null; if (parametersObj != null) { combinedMap.putAll(parametersObj); } @@ -693,7 +694,8 @@ public abstract class AbstractModelActio
svn commit: r1863496 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java
Author: mthl Date: Sat Jul 20 16:28:33 2019 New Revision: 1863496 URL: http://svn.apache.org/viewvc?rev=1863496=rev Log: Improved: Rewrite ‘UtilGenerics#toList’ and ‘UtilGenerics#toMap’ (OFBIZ-11141) Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java?rev=1863496=1863495=1863496=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Sat Jul 20 16:28:33 2019 @@ -89,22 +89,14 @@ public final class UtilGenerics { /** Returns the Object argument as a parameterized List if the Object argument * is an instance of List. Otherwise returns null. */ -@SuppressWarnings("unchecked") -public static List toList(Object object) { -if (object != null && !(object instanceof List)) { -return null; -} -return (List) object; +public static List toList(Object obj) { +return (obj instanceof List) ? cast(obj) : null; } /** Returns the Object argument as a parameterized Map if the Object argument * is an instance of Map. Otherwise returns null. */ -@SuppressWarnings("unchecked") -public static Map toMap(Object object) { -if (object != null && !(object instanceof Map)) { -return null; -} -return (Map) object; +public static Map toMap(Object obj) { +return (obj instanceof Map) ? cast(obj) : null; } }
svn commit: r1863495 - in /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util: UtilGenerics.java UtilProperties.java
Author: mthl Date: Sat Jul 20 16:27:23 2019 New Revision: 1863495 URL: http://svn.apache.org/viewvc?rev=1863495=rev Log: Improved: Remove useless ‘UtilGenerics#toMap’ overloads (OFBIZ-11141) Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java?rev=1863495=1863494=1863495=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Sat Jul 20 16:27:23 2019 @@ -19,7 +19,6 @@ package org.apache.ofbiz.base.util; import java.util.Collection; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -108,50 +107,4 @@ public final class UtilGenerics { } return (Map) object; } - -public static Map toMap(Class keyType, Class valueType, Object... data) { -if (data == null) { -return null; -} -if (data.length % 2 == 1) { -throw new IllegalArgumentException("You must pass an even sized array to the toMap method"); -} -Map map = new LinkedHashMap<>(); -for (int i = 0; i < data.length;) { -Object key = data[i]; -if (key != null && !(keyType.isInstance(key))) { -throw new IllegalArgumentException("Key(" + i + ") is not a " + keyType.getName() + ", was(" + key.getClass().getName() + ")"); -} -i++; -Object value = data[i]; -if (value != null && !(valueType.isInstance(value))) { -throw new IllegalArgumentException("Value(" + i + ") is not a " + keyType.getName() + ", was(" + key.getClass().getName() + ")"); -} -i++; -map.put(keyType.cast(key), valueType.cast(value)); -} -return map; -} - -@SafeVarargs -@SuppressWarnings("hiding") -public static Map toMap(Class keyType, Object... data) { -if (data == null) { -return null; -} -if (data.length % 2 == 1) { -throw new IllegalArgumentException("You must pass an even sized array to the toMap method"); -} -Map map = new LinkedHashMap<>(); -for (int i = 0; i < data.length;) { -Object key = data[i]; -if (key != null && !(keyType.isInstance(key))) { -throw new IllegalArgumentException("Key(" + i + ") is not a " + keyType.getName() + ", was(" + key.getClass().getName() + ")"); -} -i++; -Object value = data[i]; -map.put(keyType.cast(key), value); -} -return map; -} } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java?rev=1863495=1863494=1863495=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java Sat Jul 20 16:27:23 2019 @@ -682,7 +682,7 @@ public final class UtilProperties implem } public static String getMessageMap(String resource, String name, Locale locale, Object... context) { -return getMessage(resource, name, UtilGenerics.toMap(String.class, context), locale); +return getMessage(resource, name, UtilMisc.toMap(context), locale); } private static Set resourceNotFoundMessagesShown = new HashSet<>();
svn commit: r1863494 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java
Author: mthl Date: Sat Jul 20 16:25:51 2019 New Revision: 1863494 URL: http://svn.apache.org/viewvc?rev=1863494=rev Log: Improved: Rewrite ‘UtilGenerics#checkMap’ to do a simple cast (OFBIZ-11141) Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java?rev=1863494=1863493=1863494=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Sat Jul 20 16:25:51 2019 @@ -59,12 +59,8 @@ public final class UtilGenerics { return cast(object); } -@SuppressWarnings("unchecked") public static Map checkMap(Object object) { -if (object != null && !(object instanceof Map)) { -throw new ClassCastException("Not a map"); -} -return (Map) object; +return cast(object); } public static Map checkMap(Object object, Class keyType, Class valueType) {
svn commit: r1863493 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java
Author: mthl Date: Sat Jul 20 16:24:39 2019 New Revision: 1863493 URL: http://svn.apache.org/viewvc?rev=1863493=rev Log: Improved: Inline ‘UtilGenerics#checkCollectionContainment’ (OFBIZ-11141) Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java?rev=1863493=1863492=1863493=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Sat Jul 20 16:24:39 2019 @@ -35,10 +35,14 @@ public final class UtilGenerics { return (V) object; } -public static > void checkCollectionContainment(Object object, Class clz, Class type) { +public static Collection checkCollection(Object object) { +return cast(object); +} + +public static > C checkCollection(Object object, Class type) { if (object != null) { -if (!(clz.isInstance(object))) { -throw new ClassCastException("Not a " + clz.getName()); +if (!(Collection.class.isInstance(object))) { +throw new ClassCastException("Not a " + Collection.class.getName()); } int i = 0; for (Object value: (Collection) object) { @@ -48,14 +52,6 @@ public final class UtilGenerics { i++; } } -} - -public static Collection checkCollection(Object object) { -return cast(object); -} - -public static > C checkCollection(Object object, Class type) { -checkCollectionContainment(object, Collection.class, type); return cast(object); }
svn commit: r1863492 - in /ofbiz/ofbiz-plugins/trunk: birt/src/main/java/org/apache/ofbiz/birt/flexible/ ebay/src/main/java/org/apache/ofbiz/ebay/ msggateway/src/main/java/org/apache/ofbiz/msg91/ pric
Author: mthl Date: Sat Jul 20 16:22:24 2019 New Revision: 1863492 URL: http://svn.apache.org/viewvc?rev=1863492=rev Log: Improved: Inline ‘UtilGenerics#checkList’ (OFBIZ-11141) Modified: ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtMasterReportServices.java ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java ofbiz/ofbiz-plugins/trunk/msggateway/src/main/java/org/apache/ofbiz/msg91/Msg91Services.java ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/PricatParseExcelHtmlThread.java ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/SolrProductSearch.java ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/SolrUtil.java Modified: ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtMasterReportServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtMasterReportServices.java?rev=1863492=1863491=1863492=diff == --- ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtMasterReportServices.java (original) +++ ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtMasterReportServices.java Sat Jul 20 16:22:24 2019 @@ -242,7 +242,7 @@ public class BirtMasterReportServices { String productCategoryId = (String) parameters.get("productCategoryId"); productCategoryList.add(productCategoryId); } else if (parameters.get("productStoreId") instanceof String) { -productCategoryList = UtilGenerics.checkList(parameters.get("productCategoryId")); +productCategoryList = UtilGenerics.cast(parameters.get("productCategoryId")); } // getting productIds in these categories EntityExpr conditionProductCategory = EntityCondition.makeCondition("primaryProductCategoryId", EntityOperator.IN, productCategoryList); @@ -266,7 +266,7 @@ public class BirtMasterReportServices { String productStoreId = (String) parameters.get("productStoreId"); productStoreList.add(productStoreId); } else if (parameters.get("productStoreId") instanceof List) { -productStoreList = UtilGenerics.checkList(parameters.get("productStoreId")); +productStoreList = UtilGenerics.cast(parameters.get("productStoreId")); } // getting list of invoice Ids linked to these productStore EntityExpr conditionProductStoreId = EntityCondition.makeCondition("productStoreId", EntityOperator.IN, productStoreList); Modified: ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java?rev=1863492=1863491=1863492=diff == --- ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java (original) +++ ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java Sat Jul 20 16:22:24 2019 @@ -125,7 +125,7 @@ public class EbayOrderServices { Locale locale = (Locale) context.get("locale"); Map result = new HashMap<>(); String externalId = (String) context.get("externalId"); -List> orderList = UtilGenerics.checkList(context.get("orderList")); +List> orderList = UtilGenerics.cast(context.get("orderList")); try { if (UtilValidate.isNotEmpty(orderList)) { Iterator> orderListIter = orderList.iterator(); @@ -1047,7 +1047,7 @@ public class EbayOrderServices { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.paymentIsStillNotReceived", locale)); } -List> orderItemList = UtilGenerics.checkList(context.get("orderItemList")); +List> orderItemList = UtilGenerics.cast(context.get("orderItemList")); Iterator> orderItemIter = orderItemList.iterator(); while (orderItemIter.hasNext()) { Map orderItem = orderItemIter.next(); Modified: ofbiz/ofbiz-plugins/trunk/msggateway/src/main/java/org/apache/ofbiz/msg91/Msg91Services.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/msggateway/src/main/java/org/apache/ofbiz/msg91/Msg91Services.java?rev=1863492=1863491=1863492=diff == --- ofbiz/ofbiz-plugins/trunk/msggateway/src/main/java/org/apache/ofbiz/msg91/Msg91Services.java (original) +++
svn commit: r1863491 - in /ofbiz/ofbiz-plugins/trunk: birt/src/main/java/org/apache/ofbiz/birt/flexible/ ebay/src/main/java/org/apache/ofbiz/ebay/ solr/src/main/java/org/apache/ofbiz/solr/
Author: mthl Date: Sat Jul 20 16:21:23 2019 New Revision: 1863491 URL: http://svn.apache.org/viewvc?rev=1863491=rev Log: Improved: Inline ‘UtilGenerics#checkMap’ (OFBIZ-11141) Modified: ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtMasterReportServices.java ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/ReportDesignGenerator.java ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/SolrUtil.java Modified: ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtMasterReportServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtMasterReportServices.java?rev=1863491=1863490=1863491=diff == --- ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtMasterReportServices.java (original) +++ ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtMasterReportServices.java Sat Jul 20 16:21:23 2019 @@ -89,7 +89,7 @@ public class BirtMasterReportServices { public static Map workEffortPerPerson(DispatchContext dctx, Map context) { Delegator delegator = dctx.getDelegator(); IReportContext reportContext = (IReportContext) context.get("reportContext"); -Map parameters = UtilGenerics.checkMap(reportContext.getParameterValue("parameters")); +Map parameters = UtilGenerics.cast(reportContext.getParameterValue("parameters")); List listWorkEffortTime = null; if (UtilValidate.isEmpty(parameters.get("firstName")) && UtilValidate.isEmpty(parameters.get("lastName"))) { @@ -211,7 +211,7 @@ public class BirtMasterReportServices { Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); IReportContext reportContext = (IReportContext) context.get("reportContext"); -Map parameters = UtilGenerics.checkMap(reportContext.getParameterValue("parameters")); +Map parameters = UtilGenerics.cast(reportContext.getParameterValue("parameters")); List listTurnOver = null; List> listInvoiceEditable = new ArrayList<>(); @@ -328,7 +328,7 @@ public class BirtMasterReportServices { // adding missing fields for (GenericValue invoice : listTurnOver) { -Map invoiceEditableTemp = UtilGenerics.checkMap(invoice.clone()); +Map invoiceEditableTemp = UtilGenerics.cast(invoice.clone()); invoiceEditableTemp.remove("GenericEntity"); Map invoiceEditable = new HashMap<>(); invoiceEditable.putAll(invoiceEditableTemp); Modified: ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java?rev=1863491=1863490=1863491=diff == --- ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java (original) +++ ofbiz/ofbiz-plugins/trunk/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java Sat Jul 20 16:21:23 2019 @@ -170,7 +170,7 @@ public class BirtServices { Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); String entityViewName = (String) reportContext.getParameterValue("modelElementName"); -Map inputFields = UtilGenerics.checkMap(reportContext.getParameterValue("parameters")); +Map inputFields = UtilGenerics.cast(reportContext.getParameterValue("parameters")); Map resultPerformFind = new HashMap<>(); Map resultToBirt = null; List list = null; @@ -353,18 +353,18 @@ public class BirtServices { if (ServiceUtil.isError(resultMapsForGeneration)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultMapsForGeneration)); } -Map dataMap = UtilGenerics.checkMap(resultMapsForGeneration.get("dataMap")); +Map dataMap = UtilGenerics.cast(resultMapsForGeneration.get("dataMap")); Map fieldDisplayLabels = null; if (UtilValidate.isNotEmpty(resultMapsForGeneration.get("fieldDisplayLabels"))) { -fieldDisplayLabels = UtilGenerics.checkMap(resultMapsForGeneration.get("fieldDisplayLabels")); +fieldDisplayLabels = UtilGenerics.cast(resultMapsForGeneration.get("fieldDisplayLabels")); } Map filterMap = null; if
buildbot exception in on ofbizTrunkFrameworkPlugins
The Buildbot has detected a build exception on builder ofbizTrunkFrameworkPlugins while building . Full details are available at: https://ci.apache.org/builders/ofbizTrunkFrameworkPlugins/builds/888 Buildbot URL: https://ci.apache.org/ Buildslave for this Build: asf946_ubuntu Build Reason: downstream Build Source Stamp: [branch ofbiz/ofbiz-framework/trunk] 1863487 Blamelist: mthl BUILD FAILED: exception shell_1 upload_1 Sincerely, -The Buildbot
svn commit: r1863490 - /ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/SolrUtil.java
Author: mthl Date: Sat Jul 20 16:20:16 2019 New Revision: 1863490 URL: http://svn.apache.org/viewvc?rev=1863490=rev Log: Improved: Inline ‘UtilGenerics#checkSet’ (OFBIZ-11141) Modified: ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/SolrUtil.java Modified: ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/SolrUtil.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/SolrUtil.java?rev=1863490=1863489=1863490=diff == --- ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/SolrUtil.java (original) +++ ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/SolrUtil.java Sat Jul 20 16:20:16 2019 @@ -187,7 +187,7 @@ public final class SolrUtil { // add features if (context.get("features") != null) { -Set features = UtilGenerics.checkSet(context.get("features")); +Set features = UtilGenerics.cast(context.get("features")); Iterator featIter = features.iterator(); while (featIter.hasNext()) { String feat = featIter.next();
svn commit: r1863489 - in /ofbiz/ofbiz-framework/trunk: applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ framework/base/src/main/java/org/apache/ofbiz/base/util/ framework
Author: mthl Date: Sat Jul 20 16:18:23 2019 New Revision: 1863489 URL: http://svn.apache.org/viewvc?rev=1863489=rev Log: Improved: Make ‘UtilGenerics#checkCollection(Object, Class)’ more generic (OFBIZ-11141) Remove ‘checkList’, ‘checkSet’ and ‘checkStack’ by using ‘checkCollection’ instead. Modified: ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalConverter.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilGenericsTest.java ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FtpServices.java ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/status/StatusServices.java ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/telecom/TelecomServices.java ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncServices.java Modified: ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalConverter.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalConverter.java?rev=1863489=1863488=1863489=diff == --- ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalConverter.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/ICalConverter.java Sat Jul 20 16:18:23 2019 @@ -440,7 +440,7 @@ public class ICalConverter { protected static List getRelatedWorkEfforts(GenericValue workEffort, Map context) { Map serviceMap = UtilMisc.toMap("workEffortId", workEffort.getString("workEffortId")); Map resultMap = invokeService("getICalWorkEfforts", serviceMap, context); -List workEfforts = UtilGenerics.checkList(resultMap.get("workEfforts"), GenericValue.class); +List workEfforts = UtilGenerics.checkCollection(resultMap.get("workEfforts"), GenericValue.class); if (workEfforts != null) { return WorkEffortWorker.removeDuplicateWorkEfforts(workEfforts); } @@ -735,7 +735,7 @@ public class ICalConverter { validWorkEfforts.add(workEffort.getString("workEffortId")); } } -List components = UtilGenerics.checkList(calendar.getComponents(), Component.class); +List components = UtilGenerics.checkCollection(calendar.getComponents(), Component.class); ResponseProperties responseProps = null; for (Component component : components) { if (Component.VEVENT.equals(component.getName()) || Component.VTODO.equals(component.getName())) { @@ -784,9 +784,9 @@ public class ICalConverter { ResponseProperties responseProps = null; Map serviceMap = new HashMap<>(); List partyList = new LinkedList<>(); - partyList.addAll(UtilGenerics.checkList(component.getProperties("ATTENDEE"), Property.class)); - partyList.addAll(UtilGenerics.checkList(component.getProperties("CONTACT"), Property.class)); - partyList.addAll(UtilGenerics.checkList(component.getProperties("ORGANIZER"), Property.class)); + partyList.addAll(UtilGenerics.checkCollection(component.getProperties("ATTENDEE"), Property.class)); + partyList.addAll(UtilGenerics.checkCollection(component.getProperties("CONTACT"), Property.class)); + partyList.addAll(UtilGenerics.checkCollection(component.getProperties("ORGANIZER"), Property.class)); for (Property property : partyList) { String partyId = fromXParameter(property.getParameters(), partyIdXParamName); if (partyId == null) { Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java?rev=1863489=1863488=1863489=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Sat Jul 20 16:18:23 2019 @@
svn commit: r1863488 - in /ofbiz/ofbiz-plugins/trunk: bi/src/main/java/org/apache/ofbiz/bi/util/DimensionServices.java ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java ebay/src/main/jav
Author: mthl Date: Sat Jul 20 16:17:32 2019 New Revision: 1863488 URL: http://svn.apache.org/viewvc?rev=1863488=rev Log: Improved: Use ‘UtilGenerics#checkCollection’ when possible (OFBIZ-11141) Modified: ofbiz/ofbiz-plugins/trunk/bi/src/main/java/org/apache/ofbiz/bi/util/DimensionServices.java ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/ProductsExportToEbay.java Modified: ofbiz/ofbiz-plugins/trunk/bi/src/main/java/org/apache/ofbiz/bi/util/DimensionServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/bi/src/main/java/org/apache/ofbiz/bi/util/DimensionServices.java?rev=1863488=1863487=1863488=diff == --- ofbiz/ofbiz-plugins/trunk/bi/src/main/java/org/apache/ofbiz/bi/util/DimensionServices.java (original) +++ ofbiz/ofbiz-plugins/trunk/bi/src/main/java/org/apache/ofbiz/bi/util/DimensionServices.java Sat Jul 20 16:17:32 2019 @@ -65,7 +65,7 @@ public class DimensionServices { public static Map storeGenericDimension(DispatchContext ctx, Map context) { Delegator delegator = ctx.getDelegator(); GenericValue dimensionValue = (GenericValue) context.get("dimensionValue"); -List naturalKeyFields = UtilGenerics.checkList(context.get("naturalKeyFields"), String.class); +List naturalKeyFields = UtilGenerics.checkCollection(context.get("naturalKeyFields"), String.class); String updateMode = (String) context.get("updateMode"); Locale locale = (Locale) context.get("locale"); Modified: ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java?rev=1863488=1863487=1863488=diff == --- ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java (original) +++ ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java Sat Jul 20 16:17:32 2019 @@ -1214,7 +1214,7 @@ public class EbayOrderServices { Map orderCreate = checkout.createOrder(userLogin); if ("error".equals(orderCreate.get("responseMessage"))) { -List errorMessageList = UtilGenerics.checkList(orderCreate.get("errorMessageList"), String.class); +List errorMessageList = UtilGenerics.checkCollection(orderCreate.get("errorMessageList"), String.class); return ServiceUtil.returnError(errorMessageList); } String orderId = (String) orderCreate.get("orderId"); Modified: ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/ProductsExportToEbay.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/ProductsExportToEbay.java?rev=1863488=1863487=1863488=diff == --- ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/ProductsExportToEbay.java (original) +++ ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/ProductsExportToEbay.java Sat Jul 20 16:17:32 2019 @@ -71,7 +71,7 @@ public class ProductsExportToEbay { Map result = new HashMap<>(); Map response = null; try { -List selectResult = UtilGenerics.checkList(context.get("selectResult"), String.class); +List selectResult = UtilGenerics.checkCollection(context.get("selectResult"), String.class); List productsList = EntityQuery.use(delegator).from("Product").where(EntityCondition.makeCondition("productId", EntityOperator.IN, selectResult)).queryList(); if (UtilValidate.isNotEmpty(productsList)) { for (GenericValue product : productsList) {
svn commit: r1863487 - /ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilGenericsTest.java
Author: mthl Date: Sat Jul 20 16:10:54 2019 New Revision: 1863487 URL: http://svn.apache.org/viewvc?rev=1863487=rev Log: Implememented: Add unit tests for ‘UtilGenerics#checkCollectionCast’ (OFBIZ-11141) Added: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilGenericsTest.java (with props) Added: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilGenericsTest.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilGenericsTest.java?rev=1863487=auto == --- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilGenericsTest.java (added) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilGenericsTest.java Sat Jul 20 16:10:54 2019 @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ofbiz.base.util; + +import static org.junit.Assert.assertNull; + +import java.util.Arrays; + +import org.junit.Test; + +public class UtilGenericsTest { + +@Test +public void basicCheckCollection() { +UtilGenerics.checkCollection(Arrays.asList("foo", "bar", "baz"), String.class); +} + +@Test(expected = ClassCastException.class) +public void incompatibleCollectionCheckCollection() { +UtilGenerics.checkCollection("not a collection", String.class); +} + +@Test(expected = IllegalArgumentException.class) +public void heterogenousCheckCollection() { +UtilGenerics.checkCollection(Arrays.asList("foo", 0), String.class); +} + +@Test +public void nullCheckCollection() { +assertNull(UtilGenerics.checkCollection(null, String.class)); +} +} Propchange: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilGenericsTest.java -- svn:eol-style = native Propchange: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilGenericsTest.java -- svn:keywords = Date Rev Author URL Id Propchange: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilGenericsTest.java -- svn:mime-type = text/plain
svn commit: r1863486 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java
Author: mthl Date: Sat Jul 20 16:09:29 2019 New Revision: 1863486 URL: http://svn.apache.org/viewvc?rev=1863486=rev Log: Improved: Inline ‘UtilGenerics#checkStack(Object)’ (OFBIZ-11141) Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java?rev=1863486=1863485=1863486=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Sat Jul 20 16:09:29 2019 @@ -97,13 +97,9 @@ public final class UtilGenerics { return checkMap(object); } -public static Stack checkStack(Object object) { -return cast(object); -} - public static Stack checkStack(Object object, Class type) { checkCollectionContainment(object, Stack.class, type); -return checkStack(object); +return cast(object); } public static Set checkSet(Object object) {
svn commit: r1863485 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java
Author: mthl Date: Sat Jul 20 16:08:21 2019 New Revision: 1863485 URL: http://svn.apache.org/viewvc?rev=1863485=rev Log: Improved: Inline ‘UtilGenerics#checkCollectionCast’ (OFBIZ-11141) Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java?rev=1863485=1863484=1863485=diff == --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Sat Jul 20 16:08:21 2019 @@ -36,10 +36,6 @@ public final class UtilGenerics { return (V) object; } -private static > C checkCollectionCast(Object object, Class clz) { -return clz.cast(object); -} - public static > void checkCollectionContainment(Object object, Class clz, Class type) { if (object != null) { if (!(clz.isInstance(object))) { @@ -55,9 +51,8 @@ public final class UtilGenerics { } } -@SuppressWarnings("unchecked") public static Collection checkCollection(Object object) { -return checkCollectionCast(object, Collection.class); +return cast(object); } public static Collection checkCollection(Object object, Class type) { @@ -65,9 +60,8 @@ public final class UtilGenerics { return checkCollection(object); } -@SuppressWarnings("unchecked") public static List checkList(Object object) { -return checkCollectionCast(object, List.class); +return cast(object); } public static List checkList(Object object, Class type) { @@ -103,9 +97,8 @@ public final class UtilGenerics { return checkMap(object); } -@SuppressWarnings("unchecked") public static Stack checkStack(Object object) { -return checkCollectionCast(object, Stack.class); +return cast(object); } public static Stack checkStack(Object object, Class type) { @@ -113,9 +106,8 @@ public final class UtilGenerics { return checkStack(object); } -@SuppressWarnings("unchecked") public static Set checkSet(Object object) { -return checkCollectionCast(object, Set.class); +return cast(object); } public static Set checkSet(Object object, Class type) {
svn commit: r1863474 - in /ofbiz/branches/release16.11: ./ applications/order/minilang/order/OrderServices.xml applications/party/minilang/contact/PartyContactMechServices.xml
Author: jleroux Date: Sat Jul 20 11:12:20 2019 New Revision: 1863474 URL: http://svn.apache.org/viewvc?rev=1863474=rev Log: "Applied fix from trunk framework for revision: 1835871" r1835871 | surajk | 2018-07-14 07:35:44 +0200 (sam. 14 juil. 2018) | 10 lignes Improved: All existing party contact mechs should be deleted before creating new one. (OFBIZ-10396) Currently, everywhere in code base, before creating new party contact mech record, we use deletePartyContactMechPurposeIfExists service to delete old records. But, problem is http://svn.apache.org/viewvc/ofbiz/branches/release16.11/applications/order/minilang/order/OrderServices.xml?rev=1863474=1863473=1863474=diff == --- ofbiz/branches/release16.11/applications/order/minilang/order/OrderServices.xml (original) +++ ofbiz/branches/release16.11/applications/order/minilang/order/OrderServices.xml Sat Jul 20 11:12:20 2019 @@ -890,12 +890,11 @@ under the License. - - + - + @@ -923,11 +922,10 @@ under the License. - - + - + @@ -973,12 +971,11 @@ under the License. - - + - + @@ -1022,12 +1019,11 @@ under the License. - - + - + @@ -1073,12 +1069,11 @@ under the License. - - + - + Modified: ofbiz/branches/release16.11/applications/party/minilang/contact/PartyContactMechServices.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release16.11/applications/party/minilang/contact/PartyContactMechServices.xml?rev=1863474=1863473=1863474=diff == --- ofbiz/branches/release16.11/applications/party/minilang/contact/PartyContactMechServices.xml (original) +++ ofbiz/branches/release16.11/applications/party/minilang/contact/PartyContactMechServices.xml Sat Jul 20 11:12:20 2019 @@ -445,12 +445,11 @@ under the License. - - + - + @@ -464,11 +463,10 @@ under the License. - - + - + @@ -550,12 +548,11 @@ under the License. - - + - + @@ -582,11 +579,10 @@ under the License. - - + - +
svn commit: r1863473 - in /ofbiz/ofbiz-framework/branches/release17.12: ./ applications/order/minilang/order/OrderServices.xml applications/party/minilang/contact/PartyContactMechServices.xml
Author: jleroux Date: Sat Jul 20 11:12:09 2019 New Revision: 1863473 URL: http://svn.apache.org/viewvc?rev=1863473=rev Log: "Applied fix from trunk for revision: 1835871" r1835871 | surajk | 2018-07-14 07:35:44 +0200 (sam. 14 juil. 2018) | 10 lignes Improved: All existing party contact mechs should be deleted before creating new one. (OFBIZ-10396) Currently, everywhere in code base, before creating new party contact mech record, we use deletePartyContactMechPurposeIfExists service to delete old records. But, problem is http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/applications/order/minilang/order/OrderServices.xml?rev=1863473=1863472=1863473=diff == --- ofbiz/ofbiz-framework/branches/release17.12/applications/order/minilang/order/OrderServices.xml (original) +++ ofbiz/ofbiz-framework/branches/release17.12/applications/order/minilang/order/OrderServices.xml Sat Jul 20 11:12:09 2019 @@ -890,12 +890,11 @@ under the License. - - + - + @@ -923,11 +922,10 @@ under the License. - - + - + @@ -973,12 +971,11 @@ under the License. - - + - + @@ -1022,12 +1019,11 @@ under the License. - - + - + @@ -1073,12 +1069,11 @@ under the License. - - + - + Modified: ofbiz/ofbiz-framework/branches/release17.12/applications/party/minilang/contact/PartyContactMechServices.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/applications/party/minilang/contact/PartyContactMechServices.xml?rev=1863473=1863472=1863473=diff == --- ofbiz/ofbiz-framework/branches/release17.12/applications/party/minilang/contact/PartyContactMechServices.xml (original) +++ ofbiz/ofbiz-framework/branches/release17.12/applications/party/minilang/contact/PartyContactMechServices.xml Sat Jul 20 11:12:09 2019 @@ -457,12 +457,11 @@ under the License. - - + - + @@ -476,11 +475,10 @@ under the License. - - + - + @@ -562,12 +560,11 @@ under the License. - - + - + @@ -594,11 +591,10 @@ under the License. - - +