This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release18.12 by this push:
new 98abd377d0 Fixed: Support non-breaking spaces in numeric strings
(OFBIZ-13168)
98abd377d0 is described below
commit 98abd377d05530190ee954bee16768c7dc4adb59
Author: Jacques Le Roux <[email protected]>
AuthorDate: Wed Nov 13 05:58:03 2024 +0100
Fixed: Support non-breaking spaces in numeric strings (OFBIZ-13168)
Uses isAssignableFrom instead of enumeration of possible Number subclasses
---
.../base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java | 4 +---
1 file changed, 1 insertion(+), 3 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 17aa452395..2fb1e89767 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
@@ -21,7 +21,6 @@ package org.apache.ofbiz.base.util;
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-import java.math.BigDecimal;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -561,8 +560,7 @@ public class ObjectType {
if (converter != null) {
// numeric types : replace everything that's not in [:IsAlnum:] or
[:IsPunct:] classes by an empty string
- List<?> numericClasses = UtilMisc.toList(BigDecimal.class,
Double.class, Float.class, Long.class);
- if (obj instanceof String && numericClasses.contains(targetClass))
{
+ if (obj instanceof String &&
Number.class.isAssignableFrom((targetClass))) {
obj = ((String) obj).replaceAll("[^\\p{IsAlnum}\\p{IsPunct}]",
"");
}