hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1435089 - in /httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http: entity/InputStreamEntity.java util/EntityUtils.java
Date Fri, 18 Jan 2013 11:12:08 GMT
Author: olegk
Date: Fri Jan 18 11:12:08 2013
New Revision: 1435089

URL: http://svn.apache.org/viewvc?rev=1435089&view=rev
Log:
HTTPCORE-328, HTTPCORE-329: EntityUtils#toString ignores the default charset if there is no
ContentType in a http response

Modified:
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EntityUtils.java

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java?rev=1435089&r1=1435088&r2=1435089&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java
Fri Jan 18 11:12:08 2013
@@ -54,7 +54,7 @@ public class InputStreamEntity extends A
      *
      * @param instream
      * @throws IllegalArgumentException if {@code instream} is {@code null}
-     * @since 4.4
+     * @since 4.3
      */
     public InputStreamEntity(final InputStream instream) {
         this(instream, -1);
@@ -78,7 +78,7 @@ public class InputStreamEntity extends A
      * @param instream
      * @param contentType
      * @throws IllegalArgumentException if {@code instream} is {@code null}
-     * @since 4.4
+     * @since 4.3
      */
     public InputStreamEntity(final InputStream instream, final ContentType contentType) {
         this(instream, -1, contentType);

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EntityUtils.java?rev=1435089&r1=1435088&r2=1435089&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EntityUtils.java
Fri Jan 18 11:12:08 2013
@@ -224,8 +224,10 @@ public final class EntityUtils {
             }
             Charset charset = null;
             try {
-                final ContentType contentType = ContentType.getOrDefault(entity);
-                charset = contentType.getCharset();
+                final ContentType contentType = ContentType.get(entity);
+                if (contentType != null) {
+                    charset = contentType.getCharset();
+                }
             } catch (final UnsupportedCharsetException ex) {
                 throw new UnsupportedEncodingException(ex.getMessage());
             }



Mime
View raw message