Skip to content

Commit 4669c7d

Browse files
nremondjfarcand
authored andcommitted
call getUrl() only once
1 parent 76a150c commit 4669c7d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/com/ning/http/client/RequestBuilderBase.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ public RequestImpl(boolean useRawUrl) {
7575
public RequestImpl(Request prototype) {
7676
if (prototype != null) {
7777
this.method = prototype.getMethod();
78-
int pos = prototype.getUrl().indexOf("?");
79-
this.url = pos > 0 ? prototype.getUrl().substring(0, pos) : prototype.getUrl();
78+
String prototypeUrl = prototype.getUrl();
79+
int pos = prototypeUrl.indexOf("?");
80+
this.url = pos > 0 ? prototypeUrl.substring(0, pos) : prototypeUrl;
8081
this.address = prototype.getInetAddress();
8182
this.localAddress = prototype.getLocalAddress();
8283
this.headers = new FluentCaseInsensitiveStringsMap(prototype.getHeaders());

0 commit comments

Comments
 (0)