Author: pmouawad
Date: Fri Feb 8 21:26:52 2019
New Revision: 1853237
URL: http://svn.apache.org/viewvc?rev=1853237&view=rev
Log:
Delay StringBuilder creation if not needed
Use isEmpty
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=1853237&r1=1853236&r2=1853237&view=diff
==============================================================================
---
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
(original)
+++
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
Fri Feb 8 21:26:52 2019
@@ -1011,7 +1011,6 @@ public abstract class HTTPSamplerBase ex
* @throws MalformedURLException if url is malformed
*/
public URL getUrl() throws MalformedURLException {
- StringBuilder pathAndQuery = new StringBuilder(100);
String path = this.getPath();
// Hack to allow entire URL to be provided in host field
if (path.startsWith(HTTP_PREFIX)
@@ -1021,6 +1020,7 @@ public abstract class HTTPSamplerBase ex
String domain = getDomain();
String protocol = getProtocol();
String method = getMethod();
+ StringBuilder pathAndQuery = new StringBuilder(100);
if (PROTOCOL_FILE.equalsIgnoreCase(protocol)) {
domain = null; // allow use of relative file URLs
} else {
@@ -1077,7 +1077,7 @@ public abstract class HTTPSamplerBase ex
CollectionProperty arguments = getArguments().getArguments();
// Optimisation : avoid building useless objects if empty arguments
- if(arguments.size() == 0) {
+ if(arguments.isEmpty()) {
return "";
}
String lContentEncoding = contentEncoding;
@@ -1106,7 +1106,7 @@ public abstract class HTTPSamplerBase ex
item = new HTTPArgument((Argument) objectValue);
}
final String encodedName = item.getEncodedName();
- if (encodedName.length() == 0) {
+ if (encodedName.isEmpty()) {
continue; // Skip parameters with a blank name (allows use of
optional variables in parameter lists)
}
if (!first) {