[GitHub] amarkevich closed pull request #479: String.split via fastpath instead of precompiled Pattern

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] amarkevich closed pull request #479: String.split via fastpath instead of precompiled Pattern

GitBox
amarkevich closed pull request #479: String.split via fastpath instead of precompiled Pattern
URL: https://github.com/apache/cxf/pull/479
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core/src/main/java/org/apache/cxf/common/util/ClasspathScanner.java b/core/src/main/java/org/apache/cxf/common/util/ClasspathScanner.java
index 98581b00a57..7cc898ed530 100644
--- a/core/src/main/java/org/apache/cxf/common/util/ClasspathScanner.java
+++ b/core/src/main/java/org/apache/cxf/common/util/ClasspathScanner.java
@@ -175,7 +175,7 @@ private static ClasspathScanner getClasspathScanner() {
     }
 
     public static Set<String> parsePackages(final String packagesAsCsv) {
-        final String[] values = StringUtils.split(packagesAsCsv, ",");
+        final String[] values = packagesAsCsv.split(",");
         final Set<String> basePackages = new HashSet<>(values.length);
         for (final String value : values) {
             final String trimmed = value.trim();
diff --git a/core/src/main/java/org/apache/cxf/common/util/StringUtils.java b/core/src/main/java/org/apache/cxf/common/util/StringUtils.java
index effe6ca2f89..2657d15020f 100644
--- a/core/src/main/java/org/apache/cxf/common/util/StringUtils.java
+++ b/core/src/main/java/org/apache/cxf/common/util/StringUtils.java
@@ -26,37 +26,33 @@
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.function.Predicate;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Stream;
 
 public final class StringUtils {
-    public static final Map<String, Pattern> PATTERN_MAP = new HashMap<>();
-    static {
-        String[] patterns = {"/", " ", ":", ",", ";", "=", "\\.", "\\+"};
-        for (String p : patterns) {
-            PATTERN_MAP.put(p, Pattern.compile(p));
-        }
-    }
+    private static final Map<String, Pattern> PATTERN_MAP = new ConcurrentHashMap<>();
     private static final Predicate<String> NOT_EMPTY = (String s) -> !s.isEmpty();
 
     private StringUtils() {
     }
 
+    /* String.split via fastpath preferred */
     public static String[] split(String s, String regex) {
         return split(s, regex, 0);
     }
+    @Deprecated
     public static String[] split(String s, String regex, int limit) {
-        Pattern p = PATTERN_MAP.getOrDefault(regex, Pattern.compile(regex));
+        Pattern p = PATTERN_MAP.computeIfAbsent(regex, key -> Pattern.compile(key));
         return p.split(s, limit);
     }
-    
+    @Deprecated
     public static Stream<String> splitAsStream(String s, String regex) {
-        Pattern p = PATTERN_MAP.getOrDefault(regex, Pattern.compile(regex));
+        Pattern p = PATTERN_MAP.computeIfAbsent(regex, key -> Pattern.compile(key));
         return p.splitAsStream(s);
     }
 
diff --git a/core/src/main/java/org/apache/cxf/interceptor/security/SimpleAuthorizingInterceptor.java b/core/src/main/java/org/apache/cxf/interceptor/security/SimpleAuthorizingInterceptor.java
index 1c5e1df31e6..ba2b10bd74d 100644
--- a/core/src/main/java/org/apache/cxf/interceptor/security/SimpleAuthorizingInterceptor.java
+++ b/core/src/main/java/org/apache/cxf/interceptor/security/SimpleAuthorizingInterceptor.java
@@ -25,7 +25,6 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.security.SecurityContext;
 
 
@@ -101,7 +100,7 @@ public void setUserRolesMap(Map<String, String> rolesMap) {
     }
 
     public void setGlobalRoles(String roles) {
-        globalRoles = Arrays.asList(StringUtils.split(roles, " "));
+        globalRoles = Arrays.asList(roles.split(" "));
     }
 
     public void setCheckConfiguredRolesOnly(boolean checkConfiguredRolesOnly) {
@@ -111,7 +110,7 @@ public void setCheckConfiguredRolesOnly(boolean checkConfiguredRolesOnly) {
     private static Map<String, List<String>> parseRolesMap(Map<String, String> rolesMap) {
         Map<String, List<String>> map = new HashMap<>();
         for (Map.Entry<String, String> entry : rolesMap.entrySet()) {
-            map.put(entry.getKey(), Arrays.asList(StringUtils.split(entry.getValue(), " ")));
+            map.put(entry.getKey(), Arrays.asList(entry.getValue().split(" ")));
         }
         return map;
     }
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSServerFactoryBeanDefinitionParser.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSServerFactoryBeanDefinitionParser.java
index a9d3612ada8..fcc9a4bbab3 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSServerFactoryBeanDefinitionParser.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSServerFactoryBeanDefinitionParser.java
@@ -30,7 +30,6 @@
 import org.apache.aries.blueprint.mutable.MutableBeanMetadata;
 import org.apache.aries.blueprint.mutable.MutableCollectionMetadata;
 import org.apache.aries.blueprint.mutable.MutablePassThroughMetadata;
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.blueprint.SimpleBPBeanDefinitionParser;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
@@ -51,7 +50,7 @@ protected void mapAttribute(MutableBeanMetadata bean,
                                 Element e, String name,
                                 String val, ParserContext context) {
         if ("beanNames".equals(name)) {
-            String[] values = StringUtils.split(val, " ");
+            String[] values = val.split(" ");
             MutableCollectionMetadata tempFactories = context.createMetadata(MutableCollectionMetadata.class);
             for (String v : values) {
                 String theValue = v.trim();
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProvider.java
index 07b1718832e..d3e64bfa9cf 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProvider.java
@@ -30,7 +30,6 @@
 import javax.ws.rs.core.CacheControl;
 import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate;
 
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.PhaseInterceptorChain;
@@ -93,7 +92,7 @@ public CacheControl fromString(String c) {
                 noCache = true;
                 addFields(noCacheFields, token);
             } else {
-                String[] extPair = StringUtils.split(token, "=");
+                String[] extPair = token.split("=");
                 String value = extPair.length == 2 ? extPair[1] : "";
                 extensions.put(extPair[0], value);
             }
@@ -131,7 +130,7 @@ public CacheControl fromString(String c) {
             return values.toArray(new String[0]);
         }
         String separator = getSeparator();
-        return StringUtils.split(c, separator);
+        return c.split(separator);
     }
 
     public String toString(CacheControl c) {
@@ -193,7 +192,7 @@ private static void addFields(List<String> fields, String token) {
             }
             f = f.length() == 2 ? "" : f.substring(1, f.length() - 1);
             if (f.length() > 0) {
-                String[] values = StringUtils.split(f, ",");
+                String[] values = f.split(",");
                 for (String v : values) {
                     fields.add(v.trim());
                 }
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java
index 2ef296e8ae4..b657f66f71a 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/CookieHeaderProvider.java
@@ -21,8 +21,6 @@
 import javax.ws.rs.core.Cookie;
 import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate;
 
-import org.apache.cxf.common.util.StringUtils;
-
 public class CookieHeaderProvider implements HeaderDelegate<Cookie> {
 
     private static final String VERSION = "$Version";
@@ -42,7 +40,7 @@ public Cookie fromString(String c) {
         String domain = null;
 
         // ignore the fact the possible version may be seperated by ','
-        String[] tokens = StringUtils.split(c, ";");
+        String[] tokens = c.split(";");
         for (String token : tokens) {
             String theToken = token.trim();
             if (theToken.startsWith(VERSION)) {
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java
index 1f433981a46..6115bb50660 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java
@@ -188,13 +188,13 @@ public MediaType getMediaType() {
         List<Locale> newLs = new ArrayList<>();
         Map<Locale, Float> prefs = new HashMap<>();
         for (String l : ls) {
-            String[] pair = StringUtils.split(l, ";");
+            String[] pair = l.split(";");
 
             Locale locale = HttpUtils.getLocale(pair[0].trim());
 
             newLs.add(locale);
             if (pair.length > 1) {
-                String[] pair2 = StringUtils.split(pair[1], "=");
+                String[] pair2 = pair[1].split("=");
                 if (pair2.length > 1) {
                     prefs.put(locale, JAXRSUtils.getMediaTypeQualityFactor(pair2[1].trim()));
                 } else {
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkBuilderImpl.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkBuilderImpl.java
index e25434404c7..5902d8bc9d3 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkBuilderImpl.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkBuilderImpl.java
@@ -32,7 +32,6 @@
 import javax.ws.rs.core.Link.Builder;
 import javax.ws.rs.core.UriBuilder;
 
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.jaxrs.utils.HttpUtils;
 
 public class LinkBuilderImpl implements Builder {
@@ -95,7 +94,7 @@ public Builder link(String link) {
             }
         }
 
-        String[] tokens = StringUtils.split(link, ";");
+        String[] tokens = link.split(";");
         for (String token : tokens) {
             String theToken = token.trim();
             if (!theToken.isEmpty()) {
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkHeaderProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkHeaderProvider.java
index 8eaaf4f2bd7..84e8a46858b 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkHeaderProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkHeaderProvider.java
@@ -54,7 +54,7 @@ public Link fromString(String value) {
         builder.uri(value.substring(1, closeIndex).trim());
         if (closeIndex < value.length() - 1) {
 
-            String[] tokens = StringUtils.split(value.substring(closeIndex + 1), ";");
+            String[] tokens = value.substring(closeIndex + 1).split(";");
             for (String token : tokens) {
                 String theToken = token.trim();
                 if (theToken.isEmpty()) {
@@ -68,7 +68,7 @@ public Link fromString(String value) {
                     paramValue = i == theToken.length() - 1 ? "" : theToken.substring(i + 1).trim();
                 }
                 if (REL.equals(paramName)) {
-                    String[] rels = StringUtils.split(removeQuotesIfNeeded(paramValue), ",");
+                    String[] rels = removeQuotesIfNeeded(paramValue).split(",");
                     for (String rel : rels) {
                         builder.rel(rel.trim());
                     }
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java
index db1aeb2d400..df19f3ecef0 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProvider.java
@@ -25,7 +25,6 @@
 import javax.ws.rs.core.NewCookie;
 import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate;
 
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.jaxrs.utils.HttpUtils;
 
 public class NewCookieHeaderProvider implements HeaderDelegate<NewCookie> {
@@ -62,7 +61,7 @@ public NewCookie fromString(String c) {
         boolean httpOnly = false;
         int version = Cookie.DEFAULT_VERSION;
 
-        String[] tokens = StringUtils.split(c, ";");
+        String[] tokens = c.split(";");
         for (String token : tokens) {
             String theToken = token.trim();
 
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestImpl.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestImpl.java
index 63b44d9a841..2cbc951f495 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestImpl.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestImpl.java
@@ -166,9 +166,9 @@ private static boolean isEncMatached(String accepts, String enc) {
             return Collections.emptyList();
         }
         List<String> list = new LinkedList<>();
-        String[] values = StringUtils.split(acceptEnc, ",");
+        String[] values = acceptEnc.split(",");
         for (String value : values) {
-            String[] pair = StringUtils.split(value.trim(), ";");
+            String[] pair = value.trim().split(";");
             // ignore encoding qualifiers if any for now
             list.add(pair[0]);
         }
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
index e17d9169505..821b176326f 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
@@ -394,7 +394,7 @@ public URI buildFromEncodedMap(Map<String, ?> map) throws IllegalArgumentExcepti
                 // contain template vars - technically this can be covered by checking where a given template
                 // var is coming from and act accordingly. Confusing nonetheless.
                 StringBuilder buf = new StringBuilder();
-                String[] values = StringUtils.split(theValue, "/");
+                String[] values = theValue.split("/");
                 for (int i = 0; i < values.length; i++) {
                     buf.append(HttpUtils.encodePartiallyEncoded(values[i], false));
                     if (i + 1 < values.length) {
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/JAASAuthenticationFilter.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/JAASAuthenticationFilter.java
index 0980e36d466..8dce1a52094 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/JAASAuthenticationFilter.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/JAASAuthenticationFilter.java
@@ -35,7 +35,6 @@
 import javax.ws.rs.core.Response.ResponseBuilder;
 import javax.ws.rs.core.UriBuilder;
 
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.interceptor.security.JAASLoginInterceptor;
 import org.apache.cxf.interceptor.security.NamePasswordCallbackHandler;
 import org.apache.cxf.jaxrs.impl.HttpHeadersImpl;
@@ -144,7 +143,7 @@ protected Response handleAuthenticationException(SecurityException ex, Message m
         List<String> authHeader = headers.getRequestHeader(HttpHeaders.AUTHORIZATION);
         if (authHeader != null && !authHeader.isEmpty()) {
             // should HttpHeadersImpl do it ?
-            String[] authValues = StringUtils.split(authHeader.get(0), " ");
+            String[] authValues = authHeader.get(0).split(" ");
             if (authValues.length > 0) {
                 sb.append(authValues[0]);
             }
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/KerberosAuthenticationFilter.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/KerberosAuthenticationFilter.java
index 924057a60d8..1a3590ddcaa 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/KerberosAuthenticationFilter.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/KerberosAuthenticationFilter.java
@@ -78,7 +78,7 @@ public void filter(ContainerRequestContext context) {
             LOG.fine("No Authorization header is available");
             throw ExceptionUtils.toNotAuthorizedException(null, getFaultResponse());
         }
-        String[] authPair = StringUtils.split(authHeaders.get(0), " ");
+        String[] authPair = authHeaders.get(0).split(" ");
         if (authPair.length != 2 || !NEGOTIATE_SCHEME.equalsIgnoreCase(authPair[0])) {
             LOG.fine("Negotiate Authorization scheme is expected");
             throw ExceptionUtils.toNotAuthorizedException(null, getFaultResponse());
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
index eaa81d276a9..2f2f4591479 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
@@ -201,11 +201,11 @@ protected void setSchemasLocations(JAXRSServerFactoryBean bean, ServletConfig se
         if (schemas == null) {
             return;
         }
-        String[] locations = StringUtils.split(schemas, " ");
+        String[] locations = schemas.split(" ");
         List<String> list = new ArrayList<>();
         for (String loc : locations) {
             String theLoc = loc.trim();
-            if (theLoc.length() != 0) {
+            if (!theLoc.isEmpty()) {
                 list.add(theLoc);
             }
         }
@@ -229,12 +229,12 @@ protected void setInterceptors(JAXRSServerFactoryBean bean, ServletConfig servle
         if (value == null) {
             return;
         }
-        String[] values = StringUtils.split(value, splitChar);
+        String[] values = value.split(splitChar);
         List<Interceptor<? extends Message>> list = new ArrayList<>();
         for (String interceptorVal : values) {
             Map<String, List<String>> props = new HashMap<>();
             String theValue = getClassNameAndProperties(interceptorVal, props);
-            if (theValue.length() != 0) {
+            if (!theValue.isEmpty()) {
                 try {
                     Class<?> intClass = loadClass(theValue, "Interceptor");
                     Object object = intClass.newInstance();
@@ -267,7 +267,7 @@ protected void setInvoker(JAXRSServerFactoryBean bean, ServletConfig servletConf
         }
         Map<String, List<String>> props = new HashMap<>();
         String theValue = getClassNameAndProperties(value, props);
-        if (theValue.length() != 0) {
+        if (!theValue.isEmpty()) {
             try {
                 Class<?> intClass = loadClass(theValue, "Invoker");
                 Object object = intClass.newInstance();
@@ -294,12 +294,12 @@ protected void setInvoker(JAXRSServerFactoryBean bean, ServletConfig servletConf
             }
             throw new ServletException("At least one resource class should be specified");
         }
-        String[] classNames = StringUtils.split(serviceBeans, splitChar);
+        String[] classNames = serviceBeans.split(splitChar);
         Map<Class<?>, Map<String, List<String>>> map = new HashMap<>();
         for (String cName : classNames) {
             Map<String, List<String>> props = new HashMap<>();
             String theName = getClassNameAndProperties(cName, props);
-            if (theName.length() != 0) {
+            if (!theName.isEmpty()) {
                 Class<?> cls = loadClass(theName);
                 map.put(cls, props);
             }
@@ -317,12 +317,12 @@ protected void setInvoker(JAXRSServerFactoryBean bean, ServletConfig servletConf
         if (featuresList == null) {
             return Collections.< Feature >emptyList();
         }
-        String[] classNames = StringUtils.split(featuresList, splitChar);
+        String[] classNames = featuresList.split(splitChar);
         List< Feature > features = new ArrayList<>();
         for (String cName : classNames) {
             Map<String, List<String>> props = new HashMap<>();
             String theName = getClassNameAndProperties(cName, props);
-            if (theName.length() != 0) {
+            if (!theName.isEmpty()) {
                 Class<?> cls = loadClass(theName);
                 if (Feature.class.isAssignableFrom(cls)) {
                     features.add((Feature)createSingletonInstance(cls, props, servletConfig));
@@ -337,12 +337,12 @@ protected void setInvoker(JAXRSServerFactoryBean bean, ServletConfig servletConf
         if (providersList == null) {
             return Collections.emptyList();
         }
-        String[] classNames = StringUtils.split(providersList, splitChar);
+        String[] classNames = providersList.split(splitChar);
         List<Object> providers = new ArrayList<>();
         for (String cName : classNames) {
             Map<String, List<String>> props = new HashMap<>();
             String theName = getClassNameAndProperties(cName, props);
-            if (theName.length() != 0) {
+            if (!theName.isEmpty()) {
                 Class<?> cls = loadClass(theName);
                 providers.add(createSingletonInstance(cls, props, servletConfig));
             }
@@ -364,13 +364,13 @@ private String getClassNameAndProperties(String cName, Map<String, List<String>>
         if (sequence != null) {
             sequence = sequence.trim();
             Map<String, List<String>> map = new HashMap<>();
-            String[] pairs = StringUtils.split(sequence, " ");
+            String[] pairs = sequence.split(" ");
             for (String pair : pairs) {
                 String thePair = pair.trim();
                 if (thePair.length() == 0) {
                     continue;
                 }
-                String[] values = StringUtils.split(thePair, "=");
+                String[] values = thePair.split("=");
                 String key;
                 String value;
                 if (values.length == 2) {
@@ -493,7 +493,7 @@ protected void createServerFromApplication(String applicationNames, ServletConfi
 
         boolean ignoreApplicationPath = isIgnoreApplicationPath(servletConfig);
 
-        String[] classNames = StringUtils.split(applicationNames, getParameterSplitChar(servletConfig));
+        String[] classNames = applicationNames.split(getParameterSplitChar(servletConfig));
 
         if (classNames.length > 1 && ignoreApplicationPath) {
             throw new ServletException("\"" + IGNORE_APP_PATH_PARAM
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
index 661af9379ac..660723fd4d6 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
@@ -68,7 +68,7 @@ public JAXRSServerFactoryBeanDefinitionParser() {
     @Override
     protected void mapAttribute(BeanDefinitionBuilder bean, Element e, String name, String val) {
         if ("beanNames".equals(name)) {
-            String[] values = StringUtils.split(val, " ");
+            String[] values = val.split(" ");
             List<SpringResourceFactory> tempFactories = new ArrayList<>(values.length);
             for (String v : values) {
                 String theValue = v.trim();
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
index a216b2d7bdb..ff913da2862 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
@@ -131,8 +131,8 @@ public static void populateMapFromString(MultivaluedMap<String, String> params,
         if (StringUtils.isEmpty(postBody)) {
             return;
         }
-        List<String> parts = Arrays.asList(StringUtils.split(postBody, "&"));
-        checkNumberOfParts(m, parts.size());
+        String[] parts = postBody.split("&");
+        checkNumberOfParts(m, parts.length);
         for (String part : parts) {
             String[] keyValue = new String[2];
             int index = part.indexOf("=");
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
index 21b7539d0d4..ce4d239403f 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
@@ -989,7 +989,7 @@ private static void addToCollectionValues(Object theValues, Object o, int index)
         }
         List<String> newValues = new ArrayList<>();
         for (String v : values) {
-            String[] segments = StringUtils.split(v, "/");
+            String[] segments = v.split("/");
             for (String s : segments) {
                 if (s.length() != 0) {
                     newValues.add(s);
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
index cadc02857d6..8fdc16ac814 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
@@ -181,7 +181,7 @@ public static boolean isStreamingOutType(Class<?> type) {
     public static List<PathSegment> getPathSegments(String thePath, boolean decode,
                                                     boolean ignoreLastSlash) {
         List<PathSegment> theList =
-            StringUtils.splitAsStream(thePath, "/")
+            Arrays.asList(thePath.split("/")).stream()
             .filter(StringUtils.notEmpty())
             .map(p -> new PathSegmentImpl(p, decode))
             .collect(Collectors.toList());
diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java
index abdc7b76d79..922f310346a 100644
--- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java
+++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java
@@ -156,7 +156,7 @@ public void customize(final OpenAPI oas) {
     protected String getNormalizedPath(String classResourcePath, String operationResourcePath) {
         StringBuilder normalizedPath = new StringBuilder();
 
-        String[] segments = StringUtils.split(classResourcePath + operationResourcePath, "/");
+        String[] segments = (classResourcePath + operationResourcePath).split("/");
         for (String segment : segments) {
             if (!StringUtils.isEmpty(segment)) {
                 normalizedPath.append("/").append(segment);
diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Customizer.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Customizer.java
index a1d28828579..1c867fe61bc 100644
--- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Customizer.java
+++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Customizer.java
@@ -154,7 +154,7 @@ private MessageContext createMessageContext() {
     protected String getNormalizedPath(String classResourcePath, String operationResourcePath) {
         StringBuilder normalizedPath = new StringBuilder();
 
-        String[] segments = StringUtils.split(classResourcePath + operationResourcePath, "/");
+        String[] segments = (classResourcePath + operationResourcePath).split("/");
         for (String segment : segments) {
             if (!StringUtils.isEmpty(segment)) {
                 normalizedPath.append("/").append(segment);
diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
index c4fc81cbf59..865ca83e0fe 100644
--- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
+++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
@@ -45,7 +45,6 @@
 import org.apache.cxf.annotations.Provider.Scope;
 import org.apache.cxf.annotations.Provider.Type;
 import org.apache.cxf.common.util.PropertyUtils;
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.jaxrs.JAXRSServiceFactoryBean;
 import org.apache.cxf.jaxrs.ext.ContextProvider;
@@ -553,7 +552,7 @@ protected void addReaderConfig(String ignoreRoutesParam) {
             rc.setScanAllResources(true);
             if (ignoreRoutesParam != null) {
                 Set<String> routes = new LinkedHashSet<>();
-                for (String route : StringUtils.split(ignoreRoutesParam, ",")) {
+                for (String route : ignoreRoutesParam.split(",")) {
                     routes.add(route.trim());
                 }
                 rc.setIgnoredRoutes(routes);
diff --git a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseUtils.java b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseUtils.java
index 470ede16e4c..f5bbfec1f56 100644
--- a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseUtils.java
+++ b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseUtils.java
@@ -32,7 +32,6 @@
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.PropertyUtils;
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.jaxrs.json.basic.JsonMapObjectReaderWriter;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
@@ -53,7 +52,7 @@ private JoseUtils() {
         if (compactContent.startsWith("\"") && compactContent.endsWith("\"")) {
             compactContent = compactContent.substring(1, compactContent.length() - 1);
         }
-        return StringUtils.split(compactContent, "\\.");
+        return compactContent.split("\\.");
     }
     public static void setJoseContextProperty(JoseHeaders headers) {
         Message message = PhaseInterceptorChain.getCurrentMessage();
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java
index e09a5c34877..33e59e84743 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java
@@ -27,7 +27,6 @@
 import javax.ws.rs.core.UriBuilder;
 import javax.ws.rs.core.UriInfo;
 
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.jaxrs.json.basic.JsonMapObjectReaderWriter;
 import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.rs.security.oauth2.client.ClientCodeRequestFilter;
@@ -60,7 +59,7 @@ public OidcClientCodeRequestFilter() {
     }
 
     public void setAuthenticationContextRef(String acr) {
-        this.authenticationContextRef = Arrays.asList(StringUtils.split(acr, " "));
+        this.authenticationContextRef = Arrays.asList(acr.split(" "));
     }
 
     @Override
diff --git a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlHeaderInHandler.java b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlHeaderInHandler.java
index c76f179be54..8708a80aa3e 100644
--- a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlHeaderInHandler.java
+++ b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlHeaderInHandler.java
@@ -25,7 +25,6 @@
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
 
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 
@@ -45,7 +44,7 @@ public void filter(ContainerRequestContext context) {
             throwFault("Authorization header must be available and use SAML profile", null);
         }
 
-        String[] parts = StringUtils.split(values.get(0), " ");
+        String[] parts = values.get(0).split(" ");
         if (parts.length != 2) {
             throwFault("Authorization header is malformed", null);
         }
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Cookies.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Cookies.java
index 27d53b53be1..0724309dc72 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Cookies.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Cookies.java
@@ -22,7 +22,6 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
 
@@ -69,11 +68,11 @@ private void handleSetCookie(List<String> headers) {
         }
 
         for (String header : headers) {
-            String[] cookies = StringUtils.split(header, ",");
+            String[] cookies = header.split(",");
             for (String cookie : cookies) {
-                String[] parts = StringUtils.split(cookie, ";");
+                String[] parts = cookie.split(";");
 
-                String[] kv = StringUtils.split(parts[0], "=", 2);
+                String[] kv = parts[0].split("=", 2);
                 if (kv.length != 2) {
                     continue;
                 }
@@ -82,7 +81,7 @@ private void handleSetCookie(List<String> headers) {
                 Cookie newCookie = new Cookie(name, value);
 
                 for (int i = 1; i < parts.length; i++) {
-                    kv = StringUtils.split(parts[i], "=", 2);
+                    kv = parts[i].split("=", 2);
                     name = kv[0].trim();
                     value = (kv.length > 1) ? kv[1].trim() : null;
                     if (name.equalsIgnoreCase(Cookie.DISCARD_ATTRIBUTE)) {
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
index 315ec480fb0..e0ffc6c43cb 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractHTTPServlet.java
@@ -181,7 +181,7 @@ public String getInitParameter(String name) {
     protected static List<Pattern> parseListSequence(String values) {
         if (values != null) {
             List<Pattern> list = new LinkedList<>();
-            String[] pathValues = StringUtils.split(values, " ");
+            String[] pathValues = values.split(" ");
             for (String value : pathValues) {
                 String theValue = value.trim();
                 if (theValue.length() > 0) {
@@ -197,13 +197,13 @@ public String getInitParameter(String name) {
         if (sequence != null) {
             sequence = sequence.trim();
             Map<String, String> map = new HashMap<>();
-            String[] pairs = StringUtils.split(sequence, " ");
+            String[] pairs = sequence.split(" ");
             for (String pair : pairs) {
                 String thePair = pair.trim();
                 if (thePair.length() == 0) {
                     continue;
                 }
-                String[] value = StringUtils.split(thePair, "=");
+                String[] value = thePair.split("=");
                 if (value.length == 2) {
                     map.put(value[0].trim(), value[1].trim());
                 } else {
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
index 260288745b6..e30dec649ba 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
@@ -40,7 +40,6 @@
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.PropertyUtils;
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.message.MessageImpl;
@@ -132,7 +131,7 @@ static String getEncoding(String ct) throws UnsupportedEncodingException {
         String contentType = ct.toLowerCase();
         String enc = null;
 
-        String[] tokens = StringUtils.split(contentType, ";");
+        String[] tokens = contentType.split(";");
         for (String token : tokens) {
             int index = token.indexOf("charset=");
             if (index >= 0) {
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIParser.java b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIParser.java
index faef2e2017d..f5ffcb331e1 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIParser.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIParser.java
@@ -27,7 +27,6 @@
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.common.util.StringUtils;
 
 /**
  * Unfortunately soap/jms URIs are not recognized correctly in URI.
@@ -76,7 +75,7 @@ private String parseUntil(String separator) {
     public Map<String, Object> parseQuery() {
         Map<String, Object> rc = new HashMap<>();
         if (query != null) {
-            String[] parameters = StringUtils.split(query, "&");
+            String[] parameters = query.split("&");
             for (String parameter : parameters) {
                 int p = parameter.indexOf("=");
                 if (p >= 0) {
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractBindingPolicyValidator.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractBindingPolicyValidator.java
index 5e6862f84c8..20df5867627 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractBindingPolicyValidator.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AbstractBindingPolicyValidator.java
@@ -27,7 +27,6 @@
 
 import org.w3c.dom.Element;
 
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.ws.policy.AssertionInfo;
@@ -119,7 +118,7 @@ protected boolean validateEntireHeaderAndBodySignatures(
                 for (WSDataRef dataRef : dataRefs) {
                     String xpath = dataRef.getXpath();
                     if (xpath != null) {
-                        String[] nodes = StringUtils.split(xpath, "/");
+                        String[] nodes = xpath.split("/");
                         // envelope/Body || envelope/Header/header || envelope/Header/wsse:Security/header
                         if (nodes.length < 3 || nodes.length > 5) {
                             return false;
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/LayoutPolicyValidator.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/LayoutPolicyValidator.java
index 7e90e1a805e..70f7ed793f4 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/LayoutPolicyValidator.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/LayoutPolicyValidator.java
@@ -28,7 +28,6 @@
 
 import org.w3c.dom.Element;
 
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.ws.policy.AssertionInfo;
 import org.apache.cxf.ws.policy.AssertionInfoMap;
@@ -138,7 +137,7 @@ private boolean validateStrictSignaturePlacement(
             for (WSDataRef r : sl) {
                 String xpath = r.getXpath();
                 if (xpath != null) {
-                    String[] nodes = StringUtils.split(xpath, "/");
+                    String[] nodes = xpath.split("/");
                     // envelope/Header/wsse:Security/header
                     if (nodes.length == 5) {
                         Element protectedElement = r.getProtectedElement();
diff --git a/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java b/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
index 429340dd570..e1cacfcbd12 100644
--- a/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
+++ b/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
@@ -58,7 +58,6 @@
 import org.apache.cxf.common.jaxb.JAXBContextCache;
 import org.apache.cxf.common.jaxb.JAXBUtils;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.jaxws.EndpointImpl;
 import org.apache.cxf.jaxws.spi.ProviderImpl;
@@ -336,8 +335,8 @@ private boolean compare(String s, String s2) {
     private boolean matchURIs(URI probe, URI target) {
         if (compare(target.getScheme(), probe.getScheme())
             && compare(target.getAuthority(), probe.getAuthority())) {
-            String[] ppath = StringUtils.split(probe.getPath(), "/");
-            String[] tpath = StringUtils.split(target.getPath(), "/");
+            String[] ppath = probe.getPath().split("/");
+            String[] tpath = target.getPath().split("/");
 
             if (ppath.length <= tpath.length) {
                 for (int i = 0; i < ppath.length; i++) {
diff --git a/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java b/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
index a56648910b6..91a1ca0d883 100644
--- a/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
+++ b/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
@@ -750,7 +750,7 @@ private void writeResourceMethod(Element methodEl,
                     String mediaType = requestRepWithElement.getAttribute("mediaType");
                     if (!StringUtils.isEmpty(mediaType)) {
                         String subType = MediaType.valueOf(mediaType).getSubtype();
-                        String[] parts = StringUtils.split(subType, "\\+");
+                        String[] parts = subType.split("\\+");
                         if (parts.length == 2) {
                             suffixName += StringUtils.capitalize(parts[1]);
                         } else {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services