This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new d177648400 Fixed: Support non-breaking spaces in numeric strings
(OFBIZ-13168)
d177648400 is described below
commit d1776484000b9f16c2bc07f20c05fae8c769c0fa
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 67b73acb61..3090723e31 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;
@@ -332,8 +331,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}]",
"");
}