You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2026/04/17 14:49:13 UTC
(ofbiz-framework) 02/08: Fixed: Replace deprecated StringUtils methods with native string operations to resolve compilation warnings
This is an automated email from the ASF dual-hosted git repository.
jacopoc pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
commit 685c1940e13f697063a7a7573f3cd2d768d774ca
Author: Jacopo Cappellato <ja...@gmail.com>
AuthorDate: Thu Apr 16 12:00:21 2026 +0200
Fixed: Replace deprecated StringUtils methods with native string operations to resolve compilation warnings
---
.../base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java | 3 ++-
.../src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java | 4 ++--
.../src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java | 3 +--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java
index 2c7fae4427..cf07507adf 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java
@@ -459,7 +459,8 @@ public class UtilCodec {
// check for js events
String onEvent = "on" + StringUtils.substringBetween(value, " on", "=");
- if (JS_EVENT_LIST.stream().anyMatch(str -> StringUtils.containsIgnoreCase(str, onEvent))
+ String onEventLower = onEvent.toLowerCase(Locale.ROOT);
+ if (JS_EVENT_LIST.stream().anyMatch(s -> s.toLowerCase(Locale.ROOT).contains(onEventLower))
|| value.contains("seekSegmentTime")) {
String issueMsg = null;
if (locale.equals(new Locale("test"))) { // labels are not available in testClasses Gradle task
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java
index 84ec581fd1..33730cfedb 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java
@@ -44,7 +44,6 @@ import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
-import org.apache.commons.lang3.StringUtils;
import org.apache.ofbiz.base.location.FlexibleLocation;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.FileUtil;
@@ -291,7 +290,8 @@ public class UelFunctions {
public static String replaceFirst(String str1, String str2, String str3) {
if (null == str1) return null;
- return StringUtils.replaceOnce(str1, str2, str3);
+ int idx = str1.indexOf(str2);
+ return idx < 0 ? str1 : str1.substring(0, idx) + str3 + str1.substring(idx + str2.length());
}
public static boolean startsWith(String str1, String str2) {
diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java
index 23b0f7d41a..81765da0e5 100644
--- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java
+++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java
@@ -48,7 +48,6 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import org.apache.commons.lang3.StringUtils;
import org.apache.ofbiz.base.location.FlexibleLocation;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.GeneralException;
@@ -815,7 +814,7 @@ public class WebToolsServices {
entityMap.put("title", entity.getTitle());
entityMap.put("description", entityDescription);
String entityLocation = entity.getLocation();
- entityLocation = StringUtils.replaceOnce(entityLocation, System.getProperty("ofbiz.home") + "/", "");
+ entityLocation = entityLocation.replace(System.getProperty("ofbiz.home") + "/", "");
entityMap.put("location", entityLocation);
entityMap.put("javaNameList", javaNameList);
entityMap.put("relationsList", relationsList);