cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r600756 - /incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
Date Tue, 04 Dec 2007 01:01:17 GMT
Author: bimargulies
Date: Mon Dec  3 17:01:16 2007
New Revision: 600756

URL: http://svn.apache.org/viewvc?rev=600756&view=rev
Log:
Don't yammer if there is no charset at all, only if there's an incomprehensible one.

Modified:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java?rev=600756&r1=600755&r2=600756&view=diff
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
(original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java
Mon Dec  3 17:01:16 2007
@@ -28,7 +28,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 
 public final class HttpHeaderHelper {
-    
+    private final static Charset UTF8 = Charset.forName("utf-8"); 
     public static final String CONTENT_TYPE = "Content-Type";
     public static final String CONTENT_ID = "Content-ID";
     public static final String CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
@@ -72,12 +72,15 @@
     //into something that is actually supported by Java and the Stax parsers and such.
     public static String mapCharset(String enc) {
         if (enc == null) {
-            return null;
+            return UTF8.name();
         }
         // Charsets can be quoted. But it's quite certain that they can't have escaped quoted
or
         // anything like that.
         enc = enc.replace("\"", "");
         enc = enc.replace("'", "");
+        if ("".equals(enc)) {
+            return UTF8.name();
+        }
         String newenc = encodings.get(enc);
         if (newenc == null) {
             try {



Mime
View raw message