You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2024/11/06 08:27:40 UTC

(ofbiz-framework) branch revert-845-OFBIZ-13168 created (now 30a59ba22d)

This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a change to branch revert-845-OFBIZ-13168
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


      at 30a59ba22d Revert "Fixed: Support non-breaking spaces in string to be converted to numer…"

This branch includes the following new commits:

     new 30a59ba22d Revert "Fixed: Support non-breaking spaces in string to be converted to numer…"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(ofbiz-framework) 01/01: Revert "Fixed: Support non-breaking spaces in string to be converted to numer…"

Posted by jl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch revert-845-OFBIZ-13168
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 30a59ba22dcafe060f63fce4dd9112a9d5a35207
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Wed Nov 6 09:27:33 2024 +0100

    Revert "Fixed: Support non-breaking spaces in string to be converted to numer…"
    
    This reverts commit 04020d71d0fde32d69f76b9e875f4108f23d4954.
---
 .../src/main/java/org/apache/ofbiz/base/util/ObjectType.java  | 11 -----------
 .../test/java/org/apache/ofbiz/base/util/ObjectTypeTests.java |  7 -------
 2 files changed, 18 deletions(-)

diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java
index 74b54b8032..6e98f5bd66 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java
@@ -20,7 +20,6 @@ package org.apache.ofbiz.base.util;
 
 import java.io.Serializable;
 import java.lang.reflect.InvocationTargetException;
-import java.math.BigDecimal;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -331,15 +330,6 @@ public class ObjectType {
         }
 
         if (converter != null) {
-            // numeric types : replace non-breaking spaces (which break parsing) by normal spaces
-            List<?> numericClasses = UtilMisc.toList(BigDecimal.class, Double.class, Float.class);
-            if (obj instanceof String && numericClasses.contains(targetClass)) {
-                final String[] tmp = {String.valueOf(obj)};
-                List<Character> nonBreakingWhitespaces = UtilMisc.toList('\u00A0', '\u202F', '\u2007');
-                nonBreakingWhitespaces.forEach(character -> tmp[0] = tmp[0].replace(character, ' '));
-                obj = tmp[0];
-            }
-
             if (converter instanceof LocalizedConverter) {
                 LocalizedConverter<Object, Object> localizedConverter = UtilGenerics.cast(converter);
                 if (timeZone == null) {
@@ -355,7 +345,6 @@ public class ObjectType {
                     throw new GeneralException(e.getMessage(), e);
                 }
             }
-
             try {
                 return converter.convert(obj);
             } catch (ConversionException e) {
diff --git a/framework/base/src/test/java/org/apache/ofbiz/base/util/ObjectTypeTests.java b/framework/base/src/test/java/org/apache/ofbiz/base/util/ObjectTypeTests.java
index 0afdd88b73..c6308597fd 100644
--- a/framework/base/src/test/java/org/apache/ofbiz/base/util/ObjectTypeTests.java
+++ b/framework/base/src/test/java/org/apache/ofbiz/base/util/ObjectTypeTests.java
@@ -48,7 +48,6 @@ public class ObjectTypeTests {
     // These numbers are all based on 1 / 128, which is a binary decimal
     // that can be represented by both float and double
     private final BigDecimal dcml = new BigDecimal("781.25");
-    private final BigDecimal largeBigDecimal = new BigDecimal("29000");
     private final Double dbl = Double.valueOf("7.8125E2");
     private final Float flt = Float.valueOf("7.8125E2");
     private final Long lng = Long.valueOf("781");
@@ -386,12 +385,6 @@ public class ObjectTypeTests {
                 new String[] {"TimeDuration", "org.apache.ofbiz.base.util.TimeDuration"}, duration);
         simpleTypeOrObjectConvertTestError("String->error-TimeDuration", "o",
                 new String[] {"TimeDuration", "org.apache.ofbiz.base.util.TimeDuration"});
-
-        // usual pattern assumes that the String->BigDecimal conversion will break with bad timezone/locale
-        // which is not the case for this particular test
-        assertEquals("String->BigDecimal supports NBSP",
-                simpleTypeOrObjectConvert("29 000", "BigDecimal", null, LOCALE_DATA.goodTimeZone,
-                        LOCALE_DATA.goodLocale, false), largeBigDecimal);
     }
 
     @Test