amarkevich commented on a change in pull request #483: HttpHeaderHelper: 
String.replace instead of Pattern.matcher().replaceAll
URL: https://github.com/apache/cxf/pull/483#discussion_r241891380
 
 

 ##########
 File path: core/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
 ##########
 @@ -112,8 +111,8 @@ public static String mapCharset(String enc, String deflt) {
         }
         // Charsets can be quoted. But it's quite certain that they can't have 
escaped quoted or
         // anything like that.
-        enc = charsetPattern.matcher(enc).replaceAll("").trim();
-        if ("".equals(enc)) {
+        enc = enc.replace('"', ' ').replace('\'', ' ').trim();
 
 Review comment:
   char replacement performed without Pattern usage and replace all occurences. 
its required only in case of quotes and removed by existing trim. result value 
used as argument for Character.forName which is safe and throws exception on 
any wrong input

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to