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 1a567ed42e Improved: In UtilHttp, for regex processing of urls, 
replace Java regex with Google RE2J. (#512)
1a567ed42e is described below

commit 1a567ed42ebb582181984e3ac4ed1d700973fdb9
Author: Jacopo Cappellato <jacopo.cappell...@gmail.com>
AuthorDate: Thu Apr 14 07:29:09 2022 +0200

    Improved: In UtilHttp, for regex processing of urls, replace Java regex 
with Google RE2J. (#512)
    
    The Main advantage of RE2J is that it guarantees linear time execution.
---
 build.gradle                                                         | 1 +
 .../base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java      | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/build.gradle b/build.gradle
index cd5bab06b4..06cd6fdab8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -242,6 +242,7 @@ dependencies {
     implementation 'wsdl4j:wsdl4j:1.6.3'
     implementation 'com.auth0:java-jwt:3.18.1'
     implementation 'org.jdom:jdom:1.1.3' // don't upgrade above 1.1.3, makes a 
lot of not obvious and useless complications, see last commits of OFBIZ-12092 
for more
+    implementation 'com.google.re2j:re2j:1.6'
 
     testImplementation 'org.hamcrest:hamcrest-library:2.2' // Enable junit4 to 
not depend on hamcrest-1.3
     testImplementation 'org.mockito:mockito-core:3.12.4'
diff --git 
a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java 
b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java
index 1ce2e003d5..cc1989a1cd 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java
@@ -61,8 +61,6 @@ import java.util.StringTokenizer;
 import java.util.TimeZone;
 import java.util.function.Function;
 import java.util.function.Predicate;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -91,6 +89,9 @@ import org.apache.ofbiz.webapp.control.SameSiteFilter;
 import org.apache.ofbiz.webapp.event.FileUploadProgressListener;
 import org.apache.ofbiz.widget.renderer.VisualTheme;
 
+import com.google.re2j.Matcher;
+import com.google.re2j.Pattern;
+
 /**
  * HttpUtil - Misc HTTP Utility Functions
  */

Reply via email to