Simplify nested if

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1353697 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2012-06-25 18:33:21 +00:00
parent 158ca6f4a0
commit 35d3f7ec77
1 changed files with 7 additions and 9 deletions

View File

@ -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();