You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2018/12/14 21:06:03 UTC

[GitHub] amarkevich commented on a change in pull request #483: HttpHeaderHelper: String.replace instead of Pattern.matcher().replaceAll

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


With regards,
Apache Git Services