coheigea commented on a change in pull request #481: CXF-7923 String.split via 
fastpath instead of precompiled Pattern
URL: https://github.com/apache/cxf/pull/481#discussion_r239783133
 
 

 ##########
 File path: 
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java
 ##########
 @@ -254,10 +257,15 @@ public MediaType getMediaType() {
         return getHeaderValues(headerName, originalValue, DEFAULT_SEPARATOR);
     }
 
-    private List<String> getHeaderValues(String headerName, String 
originalValue, String sep) {
+    private static List<String> getHeaderValues(String headerName, String 
originalValue, String sep) {
         if (!originalValue.contains(QUOTE)
             || HEADERS_WITH_POSSIBLE_QUOTES.contains(headerName)) {
-            String[] ls = StringUtils.split(originalValue, sep);
+            final String[] ls; 
+            if (COOKIE_SEPARATOR_CRLF_EXPRESSION != sep) {
+                ls = originalValue.split(sep);
+            } else {
+                ls = COOKIE_SEPARATOR_CRLF_PATTERN.split(originalValue);
+            }
 
 Review comment:
   I just have a minor reservation about this change. If the user specifies a 
custom separator that is larger than one character, then String.split will 
create a Pattern each time this is evaluated. Maybe instead we should move the 
cache of Patterns internally into this class to avoid this?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to