hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
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 GMT
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();



Mime
View raw message