Return-Path: X-Original-To: apmail-hc-commits-archive@www.apache.org Delivered-To: apmail-hc-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2ECAE9FF6 for ; Mon, 25 Jun 2012 18:33:46 +0000 (UTC) Received: (qmail 57019 invoked by uid 500); 25 Jun 2012 18:33:46 -0000 Delivered-To: apmail-hc-commits-archive@hc.apache.org Received: (qmail 56987 invoked by uid 500); 25 Jun 2012 18:33:46 -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 56980 invoked by uid 99); 25 Jun 2012 18:33:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jun 2012 18:33:46 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jun 2012 18:33:43 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E847523889E1 for ; Mon, 25 Jun 2012 18:33:22 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1353697 - /httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java Date: Mon, 25 Jun 2012 18:33:22 -0000 To: commits@hc.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120625183322.E847523889E1@eris.apache.org> Author: sebb Date: Mon Jun 25 18:33:21 2012 New Revision: 1353697 URL: http://svn.apache.org/viewvc?rev=1353697&view=rev Log: Simplify nested if Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java?rev=1353697&r1=1353696&r2=1353697&view=diff ============================================================================== --- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java (original) +++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java Mon Jun 25 18:33:21 2012 @@ -331,16 +331,14 @@ public class URLEncodedUtils { int b = bb.get() & 0xff; if (safechars.get(b)) { buf.append((char) b); + } else if (blankAsPlus && b == ' ') { + buf.append('+'); } else { - if (blankAsPlus && b == ' ') { - buf.append('+'); - } else { - buf.append("%"); - char hex1 = Character.toUpperCase(Character.forDigit((b >> 4) & 0xF, RADIX)); - char hex2 = Character.toUpperCase(Character.forDigit(b & 0xF, RADIX)); - buf.append(hex1); - buf.append(hex2); - } + buf.append("%"); + char hex1 = Character.toUpperCase(Character.forDigit((b >> 4) & 0xF, RADIX)); + char hex2 = Character.toUpperCase(Character.forDigit(b & 0xF, RADIX)); + buf.append(hex1); + buf.append(hex2); } } return buf.toString();