HTTPCLIENT-1810: When path is null or '', URIBuilder.toString() return '' rather than '/'.

Contributed by CuiBaosen <baosencumt at 126.com>

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1782238 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2017-02-08 19:37:31 +00:00
parent ef95068aef
commit 9c26858924
1 changed files with 3 additions and 2 deletions

View File

@ -37,6 +37,7 @@ import org.apache.http.Consts;
import org.apache.http.NameValuePair;
import org.apache.http.conn.util.InetAddressUtils;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.TextUtils;
/**
* Builder for {@link URI} instances.
@ -492,8 +493,8 @@ public class URIBuilder {
private static String normalizePath(final String path) {
String s = path;
if (s == null) {
return "/";
if (TextUtils.isBlank(s)) {
return "";
}
int n = 0;
for (; n < s.length(); n++) {