Author: jleroux
Date: Mon Dec 31 09:23:36 2018 New Revision: 1850027 URL: http://svn.apache.org/viewvc?rev=1850027&view=rev Log: Improved: function parseBigDecimalForEntity is in wrong location (OFBIZ-10689) Actually this is a firts step that simply renames ObjectType::simpleTypeOrObjectConvert to ObjectType::simpleTypeOrObjectConvert and improves the simpleTypeOrObjectConvert Javadoc Thanks: Pierre Smits for report, Deepak Dixit for discussion Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/OrderManagerEvents.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/shoppingcart/CheckOutHelper.java ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/task/TaskEvents.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java 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/ObjectType.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ObjectTypeTests.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/model/ModelEntity.java ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/Converters.java ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/SetCalendar.java ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/Convert.java ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/InFieldOper.java ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/Regexp.java ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/ValidateMethod.java ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ModelService.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/ModelFormField.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java Mon Dec 31 09:23:36 2018 @@ -137,7 +137,7 @@ public class PcChargeApi { String objString = null; try { - objString = (String) ObjectType.simpleTypeConvert(value, "java.lang.String", null, null); + objString = (String) ObjectType.simpleTypeOrObjectConvert(value, "java.lang.String", null, null); } catch (GeneralException | ClassCastException e) { Debug.logError(e, module); throw new IllegalArgumentException("Unable to convert value to String"); Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java Mon Dec 31 09:23:36 2018 @@ -121,7 +121,7 @@ public class RitaApi { String objString = null; try { - objString = (String) ObjectType.simpleTypeConvert(value, "java.lang.String", null, null); + objString = (String) ObjectType.simpleTypeOrObjectConvert(value, "java.lang.String", null, null); } catch (GeneralException | ClassCastException e) { Debug.logError(e, module); throw new IllegalArgumentException("Unable to convert value to String"); Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/OrderManagerEvents.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/OrderManagerEvents.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/OrderManagerEvents.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/OrderManagerEvents.java Mon Dec 31 09:23:36 2018 @@ -185,7 +185,7 @@ public class OrderManagerEvents { if (UtilValidate.isNotEmpty(paymentMethodAmountStr)) { BigDecimal paymentMethodAmount = BigDecimal.ZERO; try { - paymentMethodAmount = (BigDecimal) ObjectType.simpleTypeConvert(paymentMethodAmountStr, "BigDecimal", null, locale); + paymentMethodAmount = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(paymentMethodAmountStr, "BigDecimal", null, locale); } catch (GeneralException e) { request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderProblemsPaymentParsingAmount", locale)); return "error"; @@ -225,7 +225,7 @@ public class OrderManagerEvents { if (UtilValidate.isNotEmpty(amountStr)) { BigDecimal paymentTypeAmount = BigDecimal.ZERO; try { - paymentTypeAmount = (BigDecimal) ObjectType.simpleTypeConvert(amountStr, "BigDecimal", null, locale); + paymentTypeAmount = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(amountStr, "BigDecimal", null, locale); } catch (GeneralException e) { request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderProblemsPaymentParsingAmount", locale)); return "error"; Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderLookupServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderLookupServices.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderLookupServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderLookupServices.java Mon Dec 31 09:23:36 2018 @@ -225,7 +225,7 @@ public class OrderLookupServices { paramList.add("minDate=" + minDate); try { - Object converted = ObjectType.simpleTypeConvert(minDate, "Timestamp", null, null); + Object converted = ObjectType.simpleTypeOrObjectConvert(minDate, "Timestamp", null, null); if (converted != null) { conditions.add(EntityCondition.makeCondition(dateField, EntityOperator.GREATER_THAN_EQUAL_TO, converted)); } @@ -243,7 +243,7 @@ public class OrderLookupServices { paramList.add("maxDate=" + maxDate); try { - Object converted = ObjectType.simpleTypeConvert(maxDate, "Timestamp", null, null); + Object converted = ObjectType.simpleTypeOrObjectConvert(maxDate, "Timestamp", null, null); if (converted != null) { conditions.add(EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, converted)); } Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java Mon Dec 31 09:23:36 2018 @@ -3691,7 +3691,7 @@ public class OrderServices { String quantityStr = itemQtyMap.get(key); BigDecimal groupQty = BigDecimal.ZERO; try { - groupQty = (BigDecimal) ObjectType.simpleTypeConvert(quantityStr, "BigDecimal", null, locale); + groupQty = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(quantityStr, "BigDecimal", null, locale); } catch (GeneralException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -3755,7 +3755,7 @@ public class OrderServices { if (UtilValidate.isNotEmpty(priceStr)) { BigDecimal price = null; try { - price = (BigDecimal) ObjectType.simpleTypeConvert(priceStr, "BigDecimal", null, locale); + price = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(priceStr, "BigDecimal", null, locale); } catch (GeneralException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -3866,7 +3866,7 @@ public class OrderServices { String quantityStr = itemQtyMap.get(key); BigDecimal groupQty = BigDecimal.ZERO; try { - groupQty = (BigDecimal) ObjectType.simpleTypeConvert(quantityStr, "BigDecimal", null, locale); + groupQty = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(quantityStr, "BigDecimal", null, locale); } catch (GeneralException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java Mon Dec 31 09:23:36 2018 @@ -1472,7 +1472,7 @@ public class CheckOutHelper { } try { - this.cart.setShipBeforeDate(shipGroupIndex, (Timestamp) ObjectType.simpleTypeConvert(shipBeforeDate, "Timestamp", null, null)); + this.cart.setShipBeforeDate(shipGroupIndex, (Timestamp) ObjectType.simpleTypeOrObjectConvert(shipBeforeDate, "Timestamp", null, null)); } catch (Exception e) { errMsg = "Ship Before Date must be a valid date formed "; result = ServiceUtil.returnError(errMsg); @@ -1487,7 +1487,7 @@ public class CheckOutHelper { } try { - this.cart.setShipAfterDate(shipGroupIndex, (Timestamp) ObjectType.simpleTypeConvert(shipAfterDate,"Timestamp", null, null)); + this.cart.setShipAfterDate(shipGroupIndex, (Timestamp) ObjectType.simpleTypeOrObjectConvert(shipAfterDate,"Timestamp", null, null)); } catch (Exception e) { errMsg = "Ship After Date must be a valid date formed "; result = ServiceUtil.returnError(errMsg); Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java Mon Dec 31 09:23:36 2018 @@ -414,7 +414,7 @@ public class ShoppingCartEvents { reservLengthStr = (String) paramMap.remove("reservLength"); // parse the reservation Length try { - reservLength = (BigDecimal) ObjectType.simpleTypeConvert(reservLengthStr, "BigDecimal", null, locale); + reservLength = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(reservLengthStr, "BigDecimal", null, locale); } catch (Exception e) { Debug.logWarning(e, "Problems parsing reservation length string: " + reservLengthStr, module); @@ -427,7 +427,7 @@ public class ShoppingCartEvents { reservPersonsStr = (String) paramMap.remove("reservPersons"); // parse the number of persons try { - reservPersons = (BigDecimal) ObjectType.simpleTypeConvert(reservPersonsStr, "BigDecimal", null, locale); + reservPersons = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(reservPersonsStr, "BigDecimal", null, locale); } catch (Exception e) { Debug.logWarning(e, "Problems parsing reservation number of persons string: " + reservPersonsStr, module); request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderNumberOfPersonsShouldBeOneOrLarger", locale)); @@ -461,7 +461,7 @@ public class ShoppingCartEvents { // parse the price try { - price = (BigDecimal) ObjectType.simpleTypeConvert(priceStr, "BigDecimal", null, locale); + price = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(priceStr, "BigDecimal", null, locale); } catch (Exception e) { Debug.logWarning(e, "Problems parsing price string: " + priceStr, module); price = null; @@ -469,7 +469,7 @@ public class ShoppingCartEvents { // parse the quantity try { - quantity = (BigDecimal) ObjectType.simpleTypeConvert(quantityStr, "BigDecimal", null, locale); + quantity = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(quantityStr, "BigDecimal", null, locale); //For quantity we should test if we allow to add decimal quantity for this product an productStore : // if not and if quantity is in decimal format then return error. if(! ProductWorker.isDecimalQuantityOrderAllowed(delegator, productId, cart.getProductStoreId())){ @@ -500,7 +500,7 @@ public class ShoppingCartEvents { BigDecimal amount = null; if (UtilValidate.isNotEmpty(selectedAmountStr)) { try { - amount = (BigDecimal) ObjectType.simpleTypeConvert(selectedAmountStr, "BigDecimal", null, locale); + amount = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(selectedAmountStr, "BigDecimal", null, locale); } catch (Exception e) { Debug.logWarning(e, "Problem parsing amount string: " + selectedAmountStr, module); amount = null; Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java Mon Dec 31 09:23:36 2018 @@ -541,7 +541,7 @@ public class ShoppingCartHelper { if (UtilValidate.isNotEmpty(quantStr)) { BigDecimal quantity; try { - quantity = (BigDecimal) ObjectType.simpleTypeConvert(quantStr, "BigDecimal", null, cart.getLocale()); + quantity = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(quantStr, "BigDecimal", null, cart.getLocale()); } catch (GeneralException ge) { quantity = BigDecimal.ZERO; } @@ -744,12 +744,12 @@ public class ShoppingCartHelper { } } else if (parameterName.startsWith("reservLength")) { if (item != null) { - BigDecimal reservLength = (BigDecimal) ObjectType.simpleTypeConvert(quantString, "BigDecimal", null, locale); + BigDecimal reservLength = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(quantString, "BigDecimal", null, locale); item.setReservLength(reservLength); } } else if (parameterName.startsWith("reservPersons")) { if (item != null) { - BigDecimal reservPersons = (BigDecimal) ObjectType.simpleTypeConvert(quantString, "BigDecimal", null, locale); + BigDecimal reservPersons = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(quantString, "BigDecimal", null, locale); item.setReservPersons(reservPersons); } } else if (parameterName.startsWith("shipBeforeDate")) { @@ -784,7 +784,7 @@ public class ShoppingCartHelper { item.setItemType(quantString); } } else { - quantity = (BigDecimal) ObjectType.simpleTypeConvert(quantString, "BigDecimal", null, locale); + quantity = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(quantString, "BigDecimal", null, locale); //For quantity we should test if we allow to add decimal quantity for this product an productStore : // if not and if quantity is in decimal format then return error. if (!ProductWorker.isDecimalQuantityOrderAllowed(delegator, item.getProductId(), cart.getProductStoreId()) && parameterName.startsWith("update")) { Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/task/TaskEvents.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/task/TaskEvents.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/task/TaskEvents.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/task/TaskEvents.java Mon Dec 31 09:23:36 2018 @@ -62,7 +62,7 @@ public class TaskEvents { Locale locale = UtilHttp.getLocale(request); try { - fromDate = (java.sql.Timestamp) ObjectType.simpleTypeConvert(fromDateStr, "java.sql.Timestamp", null, null); + fromDate = (java.sql.Timestamp) ObjectType.simpleTypeOrObjectConvert(fromDateStr, "java.sql.Timestamp", null, null); } catch (GeneralException e) { request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderInvalidDateFormatForFromDate", locale)); return "error"; Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java Mon Dec 31 09:23:36 2018 @@ -236,7 +236,7 @@ public class ProductEvents { if (UtilValidate.isNotEmpty(fromDateStr)) { try { - fromDate = (Timestamp) ObjectType.simpleTypeConvert(fromDateStr, "Timestamp", null, UtilHttp.getTimeZone(request), UtilHttp.getLocale(request), false); + fromDate = (Timestamp) ObjectType.simpleTypeOrObjectConvert(fromDateStr, "Timestamp", null, UtilHttp.getTimeZone(request), UtilHttp.getLocale(request), false); } catch (Exception e) { errMsgList.add("From Date not formatted correctly."); } @@ -307,7 +307,7 @@ public class ProductEvents { if (UtilValidate.isNotEmpty(thruDateStr)) { try { - thruDate = (Timestamp) ObjectType.simpleTypeConvert(thruDateStr, "Timestamp", null, UtilHttp.getTimeZone(request), UtilHttp.getLocale(request), false); + thruDate = (Timestamp) ObjectType.simpleTypeOrObjectConvert(thruDateStr, "Timestamp", null, UtilHttp.getTimeZone(request), UtilHttp.getLocale(request), false); } catch (Exception e) { errMsgList.add(UtilProperties.getMessage(resource,"productevents.thru_date_not_formatted_correctly", UtilHttp.getLocale(request))); } 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=1850027&r1=1850026&r2=1850027&view=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 Mon Dec 31 09:23:36 2018 @@ -471,7 +471,7 @@ public class ICalConverter { if (serviceMap.containsKey(modelParam.name)) { Object value = serviceMap.get(modelParam.name); if (UtilValidate.isNotEmpty(modelParam.type)) { - value = ObjectType.simpleTypeConvert(value, modelParam.type, null, null, null, true); + value = ObjectType.simpleTypeOrObjectConvert(value, modelParam.type, null, null, null, true); } localMap.put(modelParam.name, value); } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java Mon Dec 31 09:23:36 2018 @@ -485,14 +485,21 @@ public class ObjectType { return isOrSubOf(objectClass, typeClass); } - public static Object simpleTypeConvert(Object obj, String type, String format, Locale locale, boolean noTypeFail) throws GeneralException { - return simpleTypeConvert(obj, type, format, null, locale, noTypeFail); + public static Object simpleTypeOrObjectConvert(Object obj, String type, String format, Locale locale, boolean noTypeFail) throws GeneralException { + return simpleTypeOrObjectConvert(obj, type, format, null, locale, noTypeFail); } /** - * Converts the passed object to the named simple type. Supported types - * include: String, Boolean, Double, Float, Long, Integer, Date (java.sql.Date), - * Time, Timestamp, TimeZone; + * Converts the passed object to the named type. + * Initially created for only simple types but actually handle more types and not all simple types. + * See ObjectTypeTests class for more, and (normally) up to date information + * + * Supported types: + * - All primitives + * - Simple types: String, Boolean, Double, Float, Long, Integer, BigDecimal. + * - Other Objects: List, Map, Set, Calendar, Date (java.sql.Date), Time, Timestamp, TimeZone, Date (util.Date and sql.Date) + * - Simple types (maybe) not handled: Short, BigInteger, Byte, Character, ObjectName and Void... + * * @param obj Object to convert * @param type Optional Java class name of type to convert to. A <code>null</code> or empty <code>String</code> will return the original object. * @param format Optional (can be null) format string for Date, Time, Timestamp @@ -504,7 +511,7 @@ public class ObjectType { */ @SourceMonitored @SuppressWarnings("unchecked") - public static Object simpleTypeConvert(Object obj, String type, String format, TimeZone timeZone, Locale locale, boolean noTypeFail) throws GeneralException { + public static Object simpleTypeOrObjectConvert(Object obj, String type, String format, TimeZone timeZone, Locale locale, boolean noTypeFail) throws GeneralException { if (obj == null || UtilValidate.isEmpty(type) || "Object".equals(type) || "java.lang.Object".equals(type)) { return obj; } @@ -517,7 +524,7 @@ public class ObjectType { if ("String".equals(type) || "java.lang.String".equals(type)) { return nodeValue; } - return simpleTypeConvert(nodeValue, type, format, timeZone, locale, noTypeFail); + return simpleTypeOrObjectConvert(nodeValue, type, format, timeZone, locale, noTypeFail); } int genericsStart = type.indexOf("<"); if (genericsStart != -1) { @@ -581,8 +588,8 @@ public class ObjectType { return obj; } - public static Object simpleTypeConvert(Object obj, String type, String format, Locale locale) throws GeneralException { - return simpleTypeConvert(obj, type, format, locale, true); + public static Object simpleTypeOrObjectConvert(Object obj, String type, String format, Locale locale) throws GeneralException { + return simpleTypeOrObjectConvert(obj, type, format, locale, true); } public static Boolean doRealCompare(Object value1, Object value2, String operator, String type, String format, @@ -626,7 +633,7 @@ public class ObjectType { value2Locale = UtilMisc.parseLocale("en"); } try { - convertedValue2 = simpleTypeConvert(value2, type, format, value2Locale); + convertedValue2 = simpleTypeOrObjectConvert(value2, type, format, value2Locale); } catch (GeneralException e) { Debug.logError(e, module); messages.add("Could not convert value2 for comparison: " + e.getMessage()); @@ -642,7 +649,7 @@ public class ObjectType { Object convertedValue1 = null; try { - convertedValue1 = simpleTypeConvert(value1, type, format, locale); + convertedValue1 = simpleTypeOrObjectConvert(value1, type, format, locale); } catch (GeneralException e) { Debug.logError(e, module); messages.add("Could not convert value1 for comparison: " + e.getMessage()); 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=1850027&r1=1850026&r2=1850027&view=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 Mon Dec 31 09:23:36 2018 @@ -146,7 +146,7 @@ public final class UtilProperties implem return defaultNumber; } try { - return (Number)(ObjectType.simpleTypeConvert(str, type, null, null)); + return (Number)(ObjectType.simpleTypeOrObjectConvert(str, type, null, null)); } catch (GeneralException e) { Debug.logWarning("Error converting String \"" + str + "\" to " + type + "; using defaultNumber " + defaultNumber + ".", module); } Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java Mon Dec 31 09:23:36 2018 @@ -439,7 +439,7 @@ public abstract class FlexibleStringExpa if (obj instanceof String) { buffer.append(obj); } else { - buffer.append(ObjectType.simpleTypeConvert(obj, "String", null, timeZone, locale, true)); + buffer.append(ObjectType.simpleTypeOrObjectConvert(obj, "String", null, timeZone, locale, true)); } } } catch (GeneralException | RuntimeException e) { Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ObjectTypeTests.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ObjectTypeTests.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ObjectTypeTests.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ObjectTypeTests.java Mon Dec 31 09:23:36 2018 @@ -96,7 +96,7 @@ public class ObjectTypeTests extends Gen } public static Object simpleTypeConvert(Object obj, String type, String format, TimeZone timeZone, Locale locale, boolean noTypeFail) throws GeneralException { - return ObjectType.simpleTypeConvert(obj, type, format, timeZone, locale, noTypeFail); + return ObjectType.simpleTypeOrObjectConvert(obj, type, format, timeZone, locale, noTypeFail); } public static void simpleTypeConvertTest(String label, Object toConvert, String type, Object wanted) throws GeneralException { @@ -249,7 +249,7 @@ public class ObjectTypeTests extends Gen public void testClassNotFound() { GeneralException caught = null; try { - ObjectType.simpleTypeConvert(this, "foobarbaz", null, null, null, false); + ObjectType.simpleTypeOrObjectConvert(this, "foobarbaz", null, null, null, false); } catch (GeneralException e) { caught = e; } finally { Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java Mon Dec 31 09:23:36 2018 @@ -485,7 +485,7 @@ public class GenericEntity implements Ma // make sure the type matches the field Java type if (value instanceof TimeDuration) { try { - value = ObjectType.simpleTypeConvert(value, type.getJavaType(), null, null); + value = ObjectType.simpleTypeOrObjectConvert(value, type.getJavaType(), null, null); } catch (GeneralException e) { Debug.logError(e, module); } Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelEntity.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelEntity.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelEntity.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelEntity.java Mon Dec 31 09:23:36 2018 @@ -1376,7 +1376,7 @@ public class ModelEntity implements Comp throw new IllegalArgumentException(errMsg); } try { - return ObjectType.simpleTypeConvert(value, fieldJavaType, null, null, false); + return ObjectType.simpleTypeOrObjectConvert(value, fieldJavaType, null, null, false); } catch (GeneralException e) { String errMsg = "Could not convert field value for the field: [" + modelField.getName() + "] on the [" + this.getEntityName() + "] entity to the [" + fieldJavaType + "] type for the value [" + value + "]: " + e.toString(); Debug.logError(e, errMsg, module); @@ -1404,7 +1404,7 @@ public class ModelEntity implements Comp } String fieldJavaType = modelFieldTypeReader.getModelFieldType(modelField.getType()).getJavaType(); try { - return ObjectType.simpleTypeConvert(value, fieldJavaType, null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true); + return ObjectType.simpleTypeOrObjectConvert(value, fieldJavaType, null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true); } catch (GeneralException e) { String errMsg = "Could not convert field value for the field: [" + modelField.getName() + "] on the [" + this.getEntityName() + "] entity to the [" + fieldJavaType + "] type for the value [" + value + "]: " + e.toString(); Debug.logError(e, errMsg, module); Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/Converters.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/Converters.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/Converters.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/Converters.java Mon Dec 31 09:23:36 2018 @@ -63,7 +63,7 @@ public class Converters implements Conve Object fieldValue = entry.getValue(); ModelField field = value.getModelEntity().getField(fieldName); ModelFieldType type = delegator.getEntityFieldType(value.getModelEntity(), field.getType()); - value.set(fieldName, ObjectType.simpleTypeConvert(fieldValue, type.getJavaType(), null, null)); + value.set(fieldName, ObjectType.simpleTypeOrObjectConvert(fieldValue, type.getJavaType(), null, null)); } return value; } catch (ConversionException e) { Modified: ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/SetCalendar.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/SetCalendar.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/SetCalendar.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/SetCalendar.java Mon Dec 31 09:23:36 2018 @@ -180,7 +180,7 @@ public final class SetCalendar extends M int millis = 0; try { if (!this.localeFse.isEmpty()) { - locale = (Locale) ObjectType.simpleTypeConvert(this.localeFse.expand(methodContext.getEnvMap()), "Locale", null, null); + locale = (Locale) ObjectType.simpleTypeOrObjectConvert(this.localeFse.expand(methodContext.getEnvMap()), "Locale", null, null); } if (locale == null) { locale = methodContext.getLocale(); @@ -189,7 +189,7 @@ public final class SetCalendar extends M locale = Locale.getDefault(); } if (!this.timeZoneFse.isEmpty()) { - timeZone = (TimeZone) ObjectType.simpleTypeConvert(this.timeZoneFse.expand(methodContext.getEnvMap()), "TimeZone", null, null); + timeZone = (TimeZone) ObjectType.simpleTypeOrObjectConvert(this.timeZoneFse.expand(methodContext.getEnvMap()), "TimeZone", null, null); } if (timeZone == null) { timeZone = methodContext.getTimeZone(); Modified: ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/Convert.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/Convert.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/Convert.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/Convert.java Mon Dec 31 09:23:36 2018 @@ -74,7 +74,7 @@ public class Convert extends SimpleMapOp } Object convertedObject = null; try { - convertedObject = ObjectType.simpleTypeConvert(fieldObject, type, format, locale); + convertedObject = ObjectType.simpleTypeOrObjectConvert(fieldObject, type, format, locale); } catch (GeneralException e) { addMessage(messages, loader, locale); Debug.logError(e, "Error in convert simple-map-processor operation: " + e.toString(), module); Modified: ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/InFieldOper.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/InFieldOper.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/InFieldOper.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/InFieldOper.java Mon Dec 31 09:23:36 2018 @@ -49,7 +49,7 @@ public class InFieldOper extends MakeInS return null; } try { - return (String) ObjectType.simpleTypeConvert(obj, "String", null, locale); + return (String) ObjectType.simpleTypeOrObjectConvert(obj, "String", null, locale); } catch (GeneralException e) { Debug.logWarning(e, module); messages.add("Error converting incoming field \"" + fieldName + "\" in map processor: " + e.getMessage()); Modified: ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/Regexp.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/Regexp.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/Regexp.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/Regexp.java Mon Dec 31 09:23:36 2018 @@ -56,7 +56,7 @@ public class Regexp extends SimpleMapOpe Object obj = inMap.get(fieldName); String fieldValue = null; try { - fieldValue = (String) ObjectType.simpleTypeConvert(obj, "String", null, locale); + fieldValue = (String) ObjectType.simpleTypeOrObjectConvert(obj, "String", null, locale); } catch (GeneralException e) { messages.add("Could not convert field value for comparison: " + e.getMessage()); return; Modified: ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/ValidateMethod.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/ValidateMethod.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/ValidateMethod.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/ValidateMethod.java Mon Dec 31 09:23:36 2018 @@ -50,7 +50,7 @@ public class ValidateMethod extends Simp Object obj = inMap.get(fieldName); String fieldValue = null; try { - fieldValue = (String) ObjectType.simpleTypeConvert(obj, "String", null, locale); + fieldValue = (String) ObjectType.simpleTypeOrObjectConvert(obj, "String", null, locale); } catch (GeneralException e) { messages.add("Could not convert field value for comparison: " + e.getMessage()); return; Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ModelService.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ModelService.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ModelService.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/ModelService.java Mon Dec 31 09:23:36 2018 @@ -784,7 +784,7 @@ public class ModelService extends Abstra // convert to string String converted; try { - converted = (String) ObjectType.simpleTypeConvert(testValue, "String", null, null); + converted = (String) ObjectType.simpleTypeOrObjectConvert(testValue, "String", null, null); } catch (GeneralException e) { throw new GeneralException("Unable to convert parameter to String"); } @@ -941,7 +941,7 @@ public class ModelService extends Abstra try { // no need to fail on type conversion; the validator will catch this - value = ObjectType.simpleTypeConvert(value, param.type, null, timeZone, locale, false); + value = ObjectType.simpleTypeOrObjectConvert(value, param.type, null, timeZone, locale, false); } catch (GeneralException e) { String errMsg = "Type conversion of field [" + key + "] to type [" + param.type + "] failed for value \"" + value + "\": " + e.toString(); Debug.logWarning("[ModelService.makeValid] : " + errMsg, module); 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=1850027&r1=1850026&r2=1850027&view=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 Mon Dec 31 09:23:36 2018 @@ -843,7 +843,7 @@ public abstract class AbstractModelActio newValue = new LinkedList(); } else { try { - newValue = ObjectType.simpleTypeConvert(newValue, this.type, null, (TimeZone) context.get("timeZone"), + newValue = ObjectType.simpleTypeOrObjectConvert(newValue, this.type, null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true); } catch (GeneralException e) { String errMsg = "Could not convert field value for the field: [" + this.field.getOriginalName() Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelCondition.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelCondition.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelCondition.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelCondition.java Mon Dec 31 09:23:36 2018 @@ -520,7 +520,7 @@ public abstract class AbstractModelCondi } String fieldString = null; try { - fieldString = (String) ObjectType.simpleTypeConvert(fieldVal, "String", null, (TimeZone) context.get("timeZone"), + fieldString = (String) ObjectType.simpleTypeOrObjectConvert(fieldVal, "String", null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true); } catch (GeneralException e) { Debug.logError(e, "Could not convert object to String, using empty String", module); @@ -679,7 +679,7 @@ public abstract class AbstractModelCondi String fieldString = null; if (fieldVal != null) { try { - fieldString = (String) ObjectType.simpleTypeConvert(fieldVal, "String", null, + fieldString = (String) ObjectType.simpleTypeOrObjectConvert(fieldVal, "String", null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true); } catch (GeneralException e) { Debug.logError(e, "Could not convert object to String, using empty String", module); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java Mon Dec 31 09:23:36 2018 @@ -1583,7 +1583,7 @@ public class ModelFormField { } try { - BigDecimal parsedRetVal = (BigDecimal) ObjectType.simpleTypeConvert(retVal, "BigDecimal", null, null, locale, + BigDecimal parsedRetVal = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(retVal, "BigDecimal", null, null, locale, true); retVal = UtilFormatOut.formatCurrency(parsedRetVal, isoCode, locale, 10); // we set the max to 10 digits as an hack to not round numbers in the ui } catch (GeneralException e) { @@ -1642,7 +1642,7 @@ public class ModelFormField { locale = Locale.getDefault(); } try { - Double parsedRetVal = (Double) ObjectType.simpleTypeConvert(retVal, "Double", null, locale, false); + Double parsedRetVal = (Double) ObjectType.simpleTypeOrObjectConvert(retVal, "Double", null, locale, false); String template = UtilProperties.getPropertyValue("arithmetic", "accounting-number.format", "#,##0.00;(#,##0.00)"); retVal = UtilFormatOut.formatDecimalNumber(parsedRetVal, template, locale); @@ -3052,7 +3052,7 @@ public class ModelFormField { key = (String) keyObj; } else { try { - key = (String) ObjectType.simpleTypeConvert(keyObj, "String", null, null); + key = (String) ObjectType.simpleTypeOrObjectConvert(keyObj, "String", null, null); } catch (GeneralException e) { String errMsg = "Could not convert field value for the field: [" + this.keyAcsr.toString() + "] to String for the value [" + keyObj + "]: " + e.toString(); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java Mon Dec 31 09:23:36 2018 @@ -152,7 +152,7 @@ public abstract class ModelMenuAction { newValue = new LinkedList(); } else { try { - newValue = ObjectType.simpleTypeConvert(newValue, this.type, null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true); + newValue = ObjectType.simpleTypeOrObjectConvert(newValue, this.type, null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true); } catch (GeneralException e) { String errMsg = "Could not convert field value for the field: [" + this.field.getOriginalName() + "] to the [" + this.type + "] type for the value [" + newValue + "]: " + e.toString(); Debug.logError(e, errMsg, module); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java Mon Dec 31 09:23:36 2018 @@ -304,7 +304,7 @@ public class ModelTheme implements Seria name.put(initThemePropertiesMap, value); } else { try { - name.put(initThemePropertiesMap, ObjectType.simpleTypeConvert(value, type, null, null)); + name.put(initThemePropertiesMap, ObjectType.simpleTypeOrObjectConvert(value, type, null, null)); } catch (GeneralException e) { Debug.logError("Impossible to parse the value " + value + " to type " + type + " for the property " + name + " on theme " + this.name, module); } Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java?rev=1850027&r1=1850026&r2=1850027&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java Mon Dec 31 09:23:36 2018 @@ -417,7 +417,7 @@ public abstract class ModelWidgetConditi } String fieldString = null; try { - fieldString = (String) ObjectType.simpleTypeConvert(fieldVal, "String", null, (TimeZone) context.get("timeZone"), + fieldString = (String) ObjectType.simpleTypeOrObjectConvert(fieldVal, "String", null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true); } catch (GeneralException e) { Debug.logError(e, "Could not convert object to String, using empty String", module); @@ -542,7 +542,7 @@ public abstract class ModelWidgetConditi String fieldString = null; if (fieldVal != null) { try { - fieldString = (String) ObjectType.simpleTypeConvert(fieldVal, "String", null, + fieldString = (String) ObjectType.simpleTypeOrObjectConvert(fieldVal, "String", null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true); } catch (GeneralException e) { Debug.logError(e, "Could not convert object to String, using empty String", module); |
Free forum by Nabble | Edit this page |