hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1747899 - /httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/entity/ContentType.java
Date Sat, 11 Jun 2016 15:11:54 GMT
Author: olegk
Date: Sat Jun 11 15:11:54 2016
New Revision: 1747899

URL: http://svn.apache.org/viewvc?rev=1747899&view=rev
Log:
HTTPCORE-423: Fixed MIME type validation in ContentType#create(String) method

Modified:
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/entity/ContentType.java

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/entity/ContentType.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/entity/ContentType.java?rev=1747899&r1=1747898&r2=1747899&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/entity/ContentType.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/entity/ContentType.java
Sat Jun 11 15:11:54 2016
@@ -176,9 +176,9 @@ public final class ContentType implement
      * @return content type
      */
     public static ContentType create(final String mimeType, final Charset charset) {
-        final String type = Args.notBlank(mimeType, "MIME type").toLowerCase(Locale.ROOT);
-        Args.check(valid(type), "MIME type may not contain reserved characters");
-        return new ContentType(type, charset);
+        final String normalizedMimeType = Args.notBlank(mimeType, "MIME type").toLowerCase(Locale.ROOT);
+        Args.check(valid(normalizedMimeType), "MIME type may not contain reserved characters");
+        return new ContentType(normalizedMimeType, charset);
     }
 
     /**
@@ -189,7 +189,7 @@ public final class ContentType implement
      * @return content type
      */
     public static ContentType create(final String mimeType) {
-        return new ContentType(mimeType, (Charset) null);
+        return create(mimeType, (Charset) null);
     }
 
     /**



Mime
View raw message