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:
parent
158ca6f4a0
commit
35d3f7ec77
|
@ -331,16 +331,14 @@ public class URLEncodedUtils {
|
||||||
int b = bb.get() & 0xff;
|
int b = bb.get() & 0xff;
|
||||||
if (safechars.get(b)) {
|
if (safechars.get(b)) {
|
||||||
buf.append((char) b);
|
buf.append((char) b);
|
||||||
|
} else if (blankAsPlus && b == ' ') {
|
||||||
|
buf.append('+');
|
||||||
} else {
|
} else {
|
||||||
if (blankAsPlus && b == ' ') {
|
buf.append("%");
|
||||||
buf.append('+');
|
char hex1 = Character.toUpperCase(Character.forDigit((b >> 4) & 0xF, RADIX));
|
||||||
} else {
|
char hex2 = Character.toUpperCase(Character.forDigit(b & 0xF, RADIX));
|
||||||
buf.append("%");
|
buf.append(hex1);
|
||||||
char hex1 = Character.toUpperCase(Character.forDigit((b >> 4) & 0xF, RADIX));
|
buf.append(hex2);
|
||||||
char hex2 = Character.toUpperCase(Character.forDigit(b & 0xF, RADIX));
|
|
||||||
buf.append(hex1);
|
|
||||||
buf.append(hex2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
|
|
Loading…
Reference in New Issue