Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 12313200AF6 for ; Sat, 11 Jun 2016 17:11:58 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 10B79160A34; Sat, 11 Jun 2016 15:11:58 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5A451160A2B for ; Sat, 11 Jun 2016 17:11:57 +0200 (CEST) Received: (qmail 44834 invoked by uid 500); 11 Jun 2016 15:11:56 -0000 Mailing-List: contact commits-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list commits@hc.apache.org Received: (qmail 44825 invoked by uid 99); 11 Jun 2016 15:11:56 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Jun 2016 15:11:56 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 36C73C0EF6 for ; Sat, 11 Jun 2016 15:11:56 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.426 X-Spam-Level: X-Spam-Status: No, score=-0.426 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id xBCiCcoF7ws4 for ; Sat, 11 Jun 2016 15:11:55 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTP id 54E415FB33 for ; Sat, 11 Jun 2016 15:11:55 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 88283E021F for ; Sat, 11 Jun 2016 15:11:54 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 85C8D3A0051 for ; Sat, 11 Jun 2016 15:11:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@hc.apache.org From: olegk@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160611151154.85C8D3A0051@svn01-us-west.apache.org> archived-at: Sat, 11 Jun 2016 15:11:58 -0000 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); } /**